Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sudoku as a Constraint Problem H. Simonis IC Parc.

Similar presentations


Presentation on theme: "Sudoku as a Constraint Problem H. Simonis IC Parc."— Presentation transcript:

1 Sudoku as a Constraint Problem H. Simonis IC Parc

2 Copyright 2005, IC Parc Page 2 Overview Problem Contribution Different forms of alldifferent Shaving Redundant constraints Evaluation

3 Copyright 2005, IC Parc Page 3 Sudoku Each row, column and major block must be alldifferent “Well posed” if it has unique solution

4 Copyright 2005, IC Parc Page 4 Contribution Analysis of Sudoku as a constraint problem Solve problem only by propagation –Unique solution –Search considered “unfair” Modest improvement of propagation of multiple alldifferent constraints Comparison of available Sudoku collections Most published puzzles contain (many) redundant hints Generating puzzles of given difficulty

5 Copyright 2005, IC Parc Page 5 Model for problem of order N (typical 3) N 2 x N 2 matrix Domains 1..N 2 3* N 2 alldifferent constraints –Rows –Columns –Major blocks No symmetries

6 Copyright 2005, IC Parc Page 6 Forms of alldifferent (van Hoeve 2001) FC (Forward checking, Haralick 80) BC (Bound Consistency, Puget 98) HAC (Hyper-arc consistency, Regin 94) FCI: 2xFC + Channeling (Cheng 96) –Needs inverse constraint (Beldiceanu 2005) –Simple hyper arc-consistent implementation BCI: 2xBC + Channeling

7 Copyright 2005, IC Parc Page 7 Shaving Classical technique when constraints are not strong enough Test if variable can be set to value –If this fails, you can remove value from domain Often used in scheduling (Torres 2000) –Only test smallest and largest value Here –Test all values –Test all variables (once, not recursive) FCV, BCV, HACV: Shaving + FC, BC, HAC

8 Copyright 2005, IC Parc Page 8 Redundant constraints Colored matrix (Regin 2004) Same with cardinality (Beldiceanu 2005) Rows/Blocks interaction Rows/Columns/Blocks? –Looks like 3D Matching Linear relaxation Bilocation/Bivalue graph (Eppstein 2005)

9 Copyright 2005, IC Parc Page 9 HACC: Colored matrix(Beldiceanu 2005) Cardinality matrix (Regin & Gomes 2004) One constraint per value Matching between rows and columns

10 Copyright 2005, IC Parc Page 10 HACS: Same with cardinality (Beldiceanu 2005) Sets x14,x15,x16,x17,x18,x19 x21,x22,x23,x31,x32,x33 must use the same values A value in one of the sets which does not occur in the other can be removed

11 Copyright 2005, IC Parc Page 11 HAC3: Rows(Columns)/Blocks overlap 54 matching problems of this form:

12 Copyright 2005, IC Parc Page 12 Lattice of model alternatives Strongest Fastest No difference detected

13 Copyright 2005, IC Parc Page 13 Evaluation Available Sudoku sources –Newspaper collections (all 2005) The Times The Daily Telegraph The Guardian The Independent The Daily Mail The Sun –Puzzle magazines (Nikoli, 1988-2005) –How-to books (all 2005) Vorderman Wilson Sinden Huckvale –Sudoku Fandom (all 2005) Royle (>7000 instances) Stertenbrink Eppstein (>30000 instances)

14 Copyright 2005, IC Parc Page 14 Results with propagation The Guardian The Daily Telegraph The Independent The Times The Daily Mail Nikoli The Sun Wilson Vorderman Big Book Little Book Fandom

15 Copyright 2005, IC Parc Page 15 Results with shaving The Guardian The Daily Telegraph The Independent The Times The Daily Mail Nikoli The Sun Wilson Vorderman Big Book Little Book Fandom

16 Copyright 2005, IC Parc Page 16 Proposed problem grading GradeSearchfree with BeginnerFC Easy2xFC + Channeling MediumHAC DifficultHAC + Same + Colored Matrix ChallengeHAC + Shaving MonsterNone known

17 Copyright 2005, IC Parc Page 17 Further work LP relaxation –Suggested in Regin&Gomes Bilocation/Bivalue graphs (Eppstein 2005) –Significantly stronger than redundant constraints presented here Rows/Columns/Blocks interaction –Is this possible?

18 Copyright 2005, IC Parc Page 18 Conclusions Millions of constraint programmers out there –Perfect to explain to your partner what you are working on Propagation alone –Good test for reasoning power Something to be learnt from Sudoku community –Rediscovery of many CP concepts (they are simple) –Very efficient (non-systematic) FD implementations –New constraint reasoning for interacting alldifferent constraints Many (too many?) modelling variants for rather simple problem “Daily Telegraph” has most challenging puzzles –May be not reason enough to buy the paper


Download ppt "Sudoku as a Constraint Problem H. Simonis IC Parc."

Similar presentations


Ads by Google