Sudoku as a Constraint Problem H. Simonis IC Parc.

Slides:



Advertisements
Similar presentations
A* Search. 2 Tree search algorithms Basic idea: Exploration of state space by generating successors of already-explored states (a.k.a.~expanding states).
Advertisements

This lecture topic (two lectures) Chapter 6.1 – 6.4, except 6.3.3
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
ICS-271:Notes 5: 1 Lecture 5: Constraint Satisfaction Problems ICS 271 Fall 2008.
© Imperial College London Eplex: Harnessing Mathematical Programming Solvers for Constraint Logic Programming Kish Shen and Joachim Schimpf IC-Parc.
Generating Implied Constraints via Proof Planning Alan Frisch, Ian Miguel, Toby Walsh Dept of CS University of York EPSRC funded project GR/N16129.
Constraint Programming for Compiler Optimization March 2006.
Message-Passing and Sudoku Scott Kirkpatrick, HUJI Danny Bickson, HUJI TAU, June 18, 2006.
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
Leeds: 6 June 02Constraint Technology for the Masses Alan M. Frisch Artificial Intelligence Group Department of Computer Science University of York Collaborators:
Hospital placements allocation Stephen Cresswell and Lee McCluskey.
1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali.
1 Introduction to Linear and Integer Programming Lecture 9: Feb 14.
Scott Grissom, copyright 2004 Chapter 5 Slide 1 Analysis of Algorithms (Ch 5) Chapter 5 focuses on: algorithm analysis searching algorithms sorting algorithms.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
Chapter 10: Iterative Improvement
Senior Project Database: Design and Usability Evaluation Stephanie Cheng Rachelle Hom Ronald Mg Hoang Bao CSC 484 – Winter 2005.
1 Consistency algorithms Chapter 3. Spring 2007 ICS 275A - Constraint Networks 2 Consistency methods Approximation of inference: Arc, path and i-consistecy.
Solving the Protein Threading Problem in Parallel Nocola Yanev, Rumen Andonov Indrajit Bhattacharya CMSC 838T Presentation.
Support: UCARE grant awarded to Chris Reeson & CAREER Award # from the National Science Foundation. To the public: –Illustrate the power of CP For.
Constraint Systems Laboratory March 26, 2007Reeson–Undergraduate Thesis1 Using Constraint Processing to Model, Solve, and Support Interactive Solving of.
A game of logic where the player must assign the numbers 1..9 to cells on a 9x9 grid. The placement of the numbers must be such that every number must.
Modeling the Covering Test Problem Brahim Hnich, Steven Prestwich, and Evgeny Selensky Cork Constraint Computation Center UCC Supported by SFI.
Global Constraints for Lexicographic Orderings Alan Frisch, Ian Miguel (University of York) Brahim Hnich, Toby Walsh (4C) Zeynep Kiziltan (Uppsala University)
Cardinality & Sorting Networks. Cardinality constraint Appears in many practical problems: scheduling, timetabling etc’. Also takes place in the Max-Sat.
SOLVING SUDOKU Graham Hutton University of Nottingham (with thanks to Richard Bird)
Copyright © Cengage Learning. All rights reserved. 7.6 The Inverse of a Square Matrix.
More Realistic Power Grid Verification Based on Hierarchical Current and Power constraints 2 Chung-Kuan Cheng, 2 Peng Du, 2 Andrew B. Kahng, 1 Grantham.
Stevenson and Ozgur First Edition Introduction to Management Science with Spreadsheets McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies,
CS194 Project: Sudoku Difficulty Kha Chu Advisor: Professor Sahai.
Sudoku Puzzles Frank Hilvers Taylor O’Brien. The History of Sudoku The history of Sudoku puzzles dates back to the 18th century.  Swiss mathematician.
Algebra 2: Lesson 5 Using Matrices to Organize Data and Solve Problems.
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
1 Algebraic Structure in Almost-Symmetries Igor Markov, Univ. of Michigan Presented by Ian Gent, St. Andrews.
A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21.
Relaxation and Hybrid constraint processing Different relaxation techniques Some popular hybrid techniques.
Big Idea 1: The Practice of Science Description A: Scientific inquiry is a multifaceted activity; the processes of science include the formulation of scientifically.
2009/11/14GPW20091 Analysis of the Behavior of People Solving Sudoku Puzzles Reijer Grimbergen School of Computer Science, Tokyo University of Technology.
Modelling for Constraint Programming Barbara Smith CP 2010 Doctoral Programme.
On Algorithms for Decomposable Constraints Kostas Stergiou Ian Gent, Patrick Prosser, Toby Walsh A.P.E.S. Research Group.
Whiteboardmaths.com © 2008 All rights reserved
Sudoku Solver Comparison A comparative analysis of algorithms for solving Sudoku.
The AllDifferent Constraint: Efficiency Measures Ian P. Gent, Ian Miguel, Peter Nightingale.
HandoutMay 2007Task Scheduling A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
CSC 423 ARTIFICIAL INTELLIGENCE Constraint Satisfaction Problems.
To create a program, written in C++, that could generate a Sudoku. Elements to take into consideration: The Sudoku created must have one unique solution.
Quality of LP-based Approximations for Highly Combinatorial Problems Lucian Leahu and Carla Gomes Computer Science Department Cornell University.
Arc consistency AC5, AC2001, MAC. AC5 A generic arc-consistency algorithm and its specializations AIJ 57 (2-3) October 1992 P. Van Hentenryck, Y. Deville,
Monster (“Mega”) Sudoku
Warm-Up: Solve and Graph  1.  2.. CHAPTER 6 SECTION 5 Graphing Linear Inequalities in Two Variables.
Eliminating non- binary constraints Toby Walsh Cork Constraint Computation Center.
Custom Computing Machines for the Set Covering Problem Paper Written By: Christian Plessl and Marco Platzner Swiss Federal Institute of Technology, 2002.
Lecture 5: Constraint Satisfaction Problems
CompSci Problem Solving: Sudoku  Rules of the Game Sudoku is played with a 9 by 9 "board" consisting of nine 3 by 3 sub-boards. The symbols 1 -
CS 171: Intro to AI Discussion Week 2 Jan 15 th 2016.
Notes Over 4.2 Finding the Product of Two Matrices Find the product. If it is not defined, state the reason. To multiply matrices, the number of columns.
SUDOKU SOLVER Will Bazil, Ryan Covert, Ricky Parker.
CSC 421: Algorithm Design & Analysis
Lesson 4-1 Solving linear system of equations by graphing
A CIS 5603 Course Project By: Qizhong Mao, Baiyi Tao, Arif Aziz
Constraint Satisfaction Problem
CSC 421: Algorithm Design & Analysis
Example Fill in the grid so that every row, column and box contains each of the numbers 1 to 9:
Solving Linear Systems by Graphing
SAT-Based Area Recovery in Technology Mapping
Sudoku (数独 sūdoku?), also known as Number Place or Nanpure, is a logic-based placement puzzle. The objective is to fill the grid so that every column,
Artificial Intelligence
Solving Sudoku with Consistency: A Visual and Interactive Approach
Chapter 10: Iterative Improvement
Presentation transcript:

Sudoku as a Constraint Problem H. Simonis IC Parc

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

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

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

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

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

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

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)

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

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

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

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

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, ) –How-to books (all 2005) Vorderman Wilson Sinden Huckvale –Sudoku Fandom (all 2005) Royle (>7000 instances) Stertenbrink Eppstein (>30000 instances)

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

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

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

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?

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