Antoine Deza McMaster Universitydeza/slide1_solitaire.pdf · Rules of the game Choose 2 consecutive...

40
Antoine Deza McMaster University

Transcript of Antoine Deza McMaster Universitydeza/slide1_solitaire.pdf · Rules of the game Choose 2 consecutive...

AntoineDeza

McMasterUniversity

History• Uncertainorigins(Frenchnoblemen,AmericanIndian,Chaldaea,China…)

• FashionableinthecourtofLouisXIV

• EngravingofMadamelaPrincessedeSoubizein1697

• DescribedbyLeibnizin1710(paperfortheBerlinAcademy)

2

Books

3

Rulesofthegame

�  Initiallyonlythecentralholeisempty

Englishboard4

Rulesofthegame�  Choose2consecutivepegsinarow(orcolumn)adjacenttoanemptyholeinthesamerow(orcolumn)

�  Removethe2consecutivepegsandplaceonepegintheemptyhole

�  Youwinifonly1pegisleftinthecentralhole

Englishboard5

Thepurgingstrategy�  3-purge:sometriplescanberemovedwithoutaffectingothers

�  6-purgeincludesa3-purge

� L-purge

� Game over

6

Canwesolveanygame?�  ToyshopsallegedlypromisedfreeticketstoNewYorktothefirstpersonabletosolvethegameonaFrenchboard

�  Butonehadtobuythegamefromthetoyshoptoenterthecontest...

�  Butthisgameisinfeasible

7

Frenchboard

InfeasibilityofFrenchsolitairegame

Initialconfiguration Finalconfiguration

8

InfeasibilityofFrenchsolitairegameRule-of-Three[SuremaindeMissery1841]

� Colourthediagonalsoftheboardinred,blue,andgreen

� Any3adjacentpositionsinarow(orcolumn)haveall3colours

9

� Anymoveremoves2pegsfrom2colours,andadds1 pegtotheothercolour

#pegsinred

#pegsinblue

#pegsingreen

-1 -1 +1-1 +1 -1+1 -1 -1

�  3cases:

10

InfeasibilityofFrenchsolitairegameRule-of-Three[SuremaindeMissery1841]

Wehave3invariantsunderanymove:

#pegsinred

#pegsinblue

#pegsingreen

-1 -1 +1-1 +1 -1+1 -1 -1

#(occupiedredholes)–#(occupiedgreenholes)(mod2)

#(occupiedgreenholes)–#(occupiedblueholes)(mod2)

#(occupiedblueholes)–#(occupiedredholes)(mod2)

11

InfeasibilityofFrenchsolitairegameRule-of-Three[SuremaindeMissery1841]

Initialconfiguration Finalconfiguration

#Peg-#Peg=0(mod2)#Peg-#Peg=0(mod2)#Peg-#Peg=0(mod2)

#Peg-#Peg=1(mod2)#Peg-#Peg=1(mod2)#Peg-#Peg=0(mod2) 12

InfeasibilityofFrenchsolitairegameRule-of-Three[SuremaindeMissery1841]

Solitairearmy[Conway1961]

�  Infiniteboard,asmanypegsasneeded� Goal:advanceonepegasfarnorthaspossible

13

#ofadvances 1 2 3 4 5 min#ofpegsneeded 2

14

Solitairearmy[Conway1961]

#ofadvances 1 2 3 4 5 min#ofpegsneeded 2 4

15

Solitairearmy[Conway1961]

#ofadvances 1 2 3 4 5 min#ofpegsneeded 2 4 8

16

Solitairearmy[Conway1961]

#ofadvances 1 2 3 4 5 min#ofpegsneeded 2 4 8 ?

17

Solitairearmy[Conway1961]

#ofadvances 1 2 3 4 5 min#ofpegsneeded 2 4 8 20 ?

18

Solitairearmy[Conway1961]

#ofadvances 1 2 3 4 5 min#ofpegsneeded 2 4 8 20 impossible

19

Solitairearmy[Conway1961]

Solitairearmy:goldenpagodap: goldenratio(p2+p=1)… p5 p4 p3 p2 p p2 p3 p4 p5 …

… p4 p3 p2 p 1 p p2 p3 p4 … … p5 p4 p3 p2 p p2 p3 p4 p5 … … p6 p5 p4 p3 p2 p3 p4 p5 p6 … … p7 p6 p5 p4 p3 p4 p5 p6 p7 … … p8 p7 p6 p5 p4 p5 p6 p7 p8 … … p9 p8 p7 p6 p5 p6 p7 p8 p9 … … p10 p9 p8 p7 p6 p7 p8 p9 p10 … … p11 p10 p9 p8 p7 p8 p9 p10 p11 … … p12 p11 p10 p9 p8 p9 p10 p11 p12 … … p13 p12 p11 p10 p9 p10 p11 p12 p13 …

Assignavaluetoeachhole20

p: goldenratio(p2+p=1)… p5 p4 p3 p2 p p2 p3 p4 p5 … … p4 p3 p2 p 1 p p2 p3 p4 … … p5 p4 p3 p2 p p2 p3 p4 p5 … … p6 p5 p4 p3 p2 p3 p4 p5 p6 … … p7 p6 p5 p4 p3 p4 p5 p6 p7 … … p8 p7 p6 p5 p4 p5 p6 p7 p8 … … p9 p8 p7 p6 p5 p6 p7 p8 p9 … … p10 p9 p8 p7 p6 p7 p8 p9 p10 … … p11 p10 p9 p8 p7 p8 p9 p10 p11 … … p12 p11 p10 p9 p8 p9 p10 p11 p12 … … p13 p12 p11 p10 p9 p10 p11 p12 p13 …

Assumingwehaveaninfinitenumberofpegsinitially

= p2

= p3

= p4

= p5

= p6

p2 + p3 + p4 + ... = p2 / (1- p) = 1

Initialtotalvalue=1

p6 + p7 + p8 + ... = p6/ (1- p) = p4

p4 + p5 + p4 = p3 + p4 = p2

21

Solitairearmy:goldenpagoda

p: goldenratio(p2+p=1)… p5 p4 p3 p2 p p2 p3 p4 p5 … … p4 p3 p2 p 1 p p2 p3 p4 … … p5 p4 p3 p2 p p2 p3 p4 p5 … … p6 p5 p4 p3 p2 p3 p4 p5 p6 … … p7 p6 p5 p4 p3 p4 p5 p6 p7 … … p8 p7 p6 p5 p4 p5 p6 p7 p8 … … p9 p8 p7 p6 p5 p6 p7 p8 p9 … … p10 p9 p8 p7 p6 p7 p8 p9 p10 … … p11 p10 p9 p8 p7 p8 p9 p10 p11 … … p12 p11 p10 p9 p8 p9 p10 p11 p12 … … p13 p12 p11 p10 p9 p10 p11 p12 p13 …

Initialtotalvalue=1

Finaltotalvalue≥1

22

Solitairearmy:goldenpagoda

p: goldenratio(p2+p=1)… p5 p4 p3 p2 p p2 p3 p4 p5 … … p4 p3 p2 p 1 p p2 p3 p4 … … p5 p4 p3 p2 p p2 p3 p4 p5 … … p6 p5 p4 p3 p2 p3 p4 p5 p6 … … p7 p6 p5 p4 p3 p4 p5 p6 p7 … … p8 p7 p6 p5 p4 p5 p6 p7 p8 … … p9 p8 p7 p6 p5 p6 p7 p8 p9 … … p10 p9 p8 p7 p6 p7 p8 p9 p10 … … p11 p10 p9 p8 p7 p8 p9 p10 p11 … … p12 p11 p10 p9 p8 p9 p10 p11 p12 … … p13 p12 p11 p10 p9 p10 p11 p12 p13 …

Afteranymove,thetotalvaluecanonlydecreaseorstaythesame

Initialtotalvalue=1

Finaltotalvalue≥1

23

6 7 8p p p+ ≥

9 10 8p p p+ =

Solitairearmy:pagodafuncKon

p: goldenratio(p2+p=1)… p5 p4 p3 p2 p p2 p3 p4 p5 … … p4 p3 p2 p 1 p p2 p3 p4 … … p5 p4 p3 p2 p p2 p3 p4 p5 … … p6 p5 p4 p3 p2 p3 p4 p5 p6 … … p7 p6 p5 p4 p3 p4 p5 p6 p7 … … p8 p7 p6 p5 p4 p5 p6 p7 p8 … … p9 p8 p7 p6 p5 p6 p7 p8 p9 … … p10 p9 p8 p7 p6 p7 p8 p9 p10 … … p11 p10 p9 p8 p7 p8 p9 p10 p11 … … p12 p11 p10 p9 p8 p9 p10 p11 p12 … … p13 p12 p11 p10 p9 p10 p11 p12 p13 …

Initialtotalvalue<1

finaltotalvalue≥1

24

Solitairearmy:goldenpagoda

Assumingwehaveafinitenumberofpegsinitially

Howevermanypegsweputontheboard,level5cannotbereached

FeasibilityproblemGivenaboard,aninitialconfigurationcandafinalconfigurationc’,istherealegalsequenceofmovesfromctoc’?

ThepegsolitaireproblemisfeasibleontheEnglishboard,butinfeasibleontheFrenchboard.

25

Feasibilityproblem-formulaKon

110

⎛ ⎞⎜ ⎟⎜ ⎟⎜ ⎟⎝ ⎠

• Theboardhasnholes

• Aconfigurationc canberepresentedbya{0,1}-vectoroflengthn

• Amovecanberepresentedbyavectoroflengthnwith3non-zeroentries:two-1andone1

001

⎛ ⎞⎜ ⎟⎜ ⎟⎜ ⎟⎝ ⎠

111

−⎛ ⎞⎜ ⎟−⎜ ⎟⎜ ⎟⎝ ⎠

+ =im

Feasibilitycondition:

c '− c = mii=1

n−2

∑ , c+ mii=1

j

∑ ∈ 0,1{ }n, j =1,2,...,n− 2

26

SomeRelaxaKonsFeasibilitycondition:

c '− c = mii=1

n−2

∑ , c+ mii=1

j

∑ ∈ 0,1{ }n, j =1,2,...,n− 2

c '− c = λmmm∈M∑ , λm ∈ !

+

relax 0-1 condition

relax non-negativity

c '− c = λmmm∈M∑ , λm ∈ !

relax integrality

c '− c = λmmm∈M∑ , λm ∈ !

+

27

RelaxaKons:non-negaKveintegers

?

1 1 0 1 11 1 1 1 0

1 1 1 1 01 0 1 0 0

−⎛ ⎞ ⎛ ⎞ ⎛ ⎞ ⎛ ⎞ ⎛ ⎞⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟− −⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟+ + + =⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟− −⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟

−⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠

Feasibilitycondition:c '− c = λmmm∈M∑ , λm ∈ !

+

28

RelaxaKonsFeasibilitycondition:

{ }2

1 1' , 0,1 , 1,2,..., 2

jnn

i ii i

c c m c m j n−

= =

− = + ∈ = −∑ ∑

c '− c = λmmm∈M∑ , λm ∈ !

+

relax 0-1 condition

relax non-negativity

c '− c = λmmm∈M∑ , λm ∈ !

relax integrality

c '− c = λmmm∈M∑ , λm ∈ !

+

29

RelaxaKons:integergame

?

1 1 0 00 1 1 0

+ (-1) (1) 0 1 1 00 0 1 1

⎛ ⎞ ⎛ ⎞ ⎛ ⎞ ⎛ ⎞⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟− −⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟+ =⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟− −⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠

Feasibilitycondition: c '− c = λmmm∈M∑ , λm ∈ !

30

RelaxaKonsFeasibilitycondition:

c '− c = mii=1

n−2

∑ , c+ mii=1

j

∑ ∈ 0,1{ }n, j =1,2,...,n− 2

c '− c = λmmm∈M∑ , λm ∈ !

+

relax 0-1 condition

relax non-negativity

c '− c = λmmm∈M∑ , λm ∈ !

relax integrality

c '− c = λmmm∈M∑ , λm ∈ !

+

31

RelaxaKons:fracKonalgame

1 1 1 11 0.5 1 0.5 1 01 1 1 1

−⎛ ⎞ ⎛ ⎞ ⎛ ⎞ ⎛ ⎞⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟+ − + − =⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟−⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠

Feasibilitycondition:c '− c = λmm

m∈M∑ , λm ∈ !

+

?

32

Fractional0-1 Non-negativeInteger

GeometricinterpretaKonFeasibilityconditions:

{ }1

2

1' , , 1,2,..., 20,1

jn

n

ii

ii

cc c m j nm−

==

− = = −+ ∈∑ ∑

c '− c = λmmm∈M∑ , λm ∈ !

c '− c = λmmm∈M∑ , λm ∈ !

+

0-1

Integer

Fractional

m1

m2

Agivengameisfeasibleifc’ – c isinacertainrange:

c '− c = λmmm∈M∑ , λm ∈ !

+Natural

33

GeometricinterpretaKonSolitairelattice:thesetofallintegercombinationsofmoves

m1

m2

Rule-of-Three(almost)amountstolatticefeasibility

34

GeometricinterpretaKonSolitairecone:thesetofnon-negativecombinationsofalllegalmoves

m1

m2

Pagodafunctions(inparticularfacets)amountstoconefeasibility

35

GeometricinterpretaKon

Solitairelattice SolitaireconeSolitaireintegercone

∩=?

1 2 3 4

1 3 0 0 21 , 0 , 3 , 0 , 28 3 3 3 1

v m m m m⎛ ⎞ ⎛ ⎞ ⎛ ⎞ ⎛ ⎞ ⎛ ⎞⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟= = = = =⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠

visinthesolitairelattice: v = m1 + m2 + m3 – m4

visinthesolitairecone: 1 2 3 41 1 2 03 3

v m m m m= + + +

visnotinthesolitaireintegercone 36

The image cannot be displayed. Your computer

GeometricinterpretaKon

PegsolitaireinfeasibleonFrenchboard:c’–cisnotinthesolitairelattice

Infeasibilityoftheoriginalgameisimpliedbyinfeasibilityofanyrelaxation

Solitairearmyinfeasibleatlevel5:c’–cisnotinthesolitairecone

37

c’-c

c’-c

�  Englishboard:33-dimensionalcone,76moves,9.2millionfacets(estimated)--questionraisedbyDonaldKnuth,GünterZiegler[Avis,Deza:MathematicalProgramming2002]

�  LatticecriterionvsRule-of-Three[Deza,Onn:GraphsandCombinatorics2002]

�  Upper&lowerboundsonthenumberoffacets(exponentialinthedimension)fortoricboards,characterizationof{0,1}-facets,incidence,adjacencyanddiameter(rectangularboards)[Avis,Deza:DiscreteAppliedMathematics2001][Avis,Deza,Onn:IEICETransactions2000]

38

GeometricandcombinatorialproperKesofthesolitaireconeandlaNce

� Equivalencewitha(dual)metricconeforageneralizedsolitairegame;relatedNP-completeness[Avis,Deza2001]

� Metric/cutanaloguefortherelaxationofthesolitaireconebyits{0,1}-valuedfacets[Avis,Deza2001]

� Thefeasibilityof0-1gameisNP-completeonthenbynboard,evenifthefinalpositioncontainsexactlyonepeg[Uehara-Iwata1990];thisindicatesthateasilycheckednecessaryandsufficientconditionsforfeasibilityareunlikelytoexist

39

GeometricandcombinatorialproperKesofthesolitaireconeandlaNce

� Equivalencewitha(dual)metricconeforageneralizedsolitairegame;relatedNP-completeness[Avis,Deza2001]

� Metric/cutanaloguefortherelaxationofthesolitaireconebyits{0,1}-valuedfacets[Avis,Deza2001]

� Thefeasibilityof0-1gameisNP-completeonthenbynboard,evenifthefinalpositioncontainsexactlyonepeg[Uehara-Iwata1990];thisindicatesthateasilycheckednecessaryandsufficientconditionsforfeasibilityareunlikelytoexist

ThankYou40

GeometricandcombinatorialproperKesofthesolitaireconeandlaNce