Modeling Sudoku as a CNF Formula

Slides:



Advertisements
Similar presentations
SAT Encoding For Sudoku Puzzles
Advertisements

Order encoding x i ↔ (X ≥ i)(X = 3) = [1,1,1,0,0] Problem (hard) Problem (hard) Solution CNF Encoding Finite Domain Problem Solving Model Constraint Model.
Programming with Boolean Satisfaction Michael Codish Department of Computer Science Ben Gurion University Beer-Sheva, Israel CP meets CAV Joint.
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Mar, 4, 2015 Slide credit: some slides adapted from Stuart.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View SAT.
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
Number puzzles in the paper Did you know there’s a whole range of number puzzles you can try in most newspapers? Click on the puzzles below to complete.
1 Boolean Satisfiability in Electronic Design Automation (EDA ) By Kunal P. Ganeshpure.
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
SAT Algorithms in EDA Applications Mukul R. Prasad Dept. of Electrical Engineering & Computer Sciences University of California-Berkeley EE219B Seminar.
GRASP: A Search Algorithm for Propositional Satisfiability EE878C Homework #2 2002/11/1 KAIST, EECS ICS Lab Lee, Dongsoo.
SAT Solving Presented by Avi Yadgar. The SAT Problem Given a Boolean formula, look for assignment A for such that.  A is a solution for. A partial assignment.
SAT Solver Math Foundations of Computer Science. 2 Boolean Expressions  A Boolean expression is a Boolean function  Any Boolean function can be written.
SOLVING SUDOKU WITH MATLAB VERIFICATION FUNCTION correctness verification of the puzzle: checks if the current element appears twice in the same line,
Boolean Satisfiability and SAT Solvers
Quantified Formulas - Decision Procedure Daniel Kroening, Ofer Strichman Presented by Changki Hong 07 NOV 08.
Propositional Equivalences
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 3 Logic Representations (Part 2)
Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 TexPoint fonts used in EMF. Read the TexPoint manual before you.
Sudoku Solver Comparison A comparative analysis of algorithms for solving Sudoku.
HW #1. Due Mar 22 Midnight Verify the following program using SAT solver 1. Translate the program into a SSA form 2. Create a Boolean formula from.
Propositional Satisfiability A compound proposition is satisfiable if there is an assignment of truth values to its variables that make it true. When no.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module Logic Representations.
HW #2. Due Mar 27 23:59 Do NOT forget to submit both a hardcopy solution to the HW box and a softcopy solution to TA (Youngjoo Kim):
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
Planning as Satisfiability (SAT-Plan). SAT-Plan Translate the planning problem into a satisfiability problem for length n of Plan garb 0 (proposition)present.
Custom Computing Machines for the Set Covering Problem Paper Written By: Christian Plessl and Marco Platzner Swiss Federal Institute of Technology, 2002.
1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu.
SAT Encodings for Sudoku Bug Catching in 2006 Fall Sep. 26, 2006 Gi-Hwon Kwon.
Optimized SAT Encoding For Sudoku Puzzles Will Klieber and Gi-Hwon Kwon Sept 27, 2007 rev. 2 Changes from v1: Added a new slide after “A Better Encoding.
Constraint Satisfaction Problems (CSPs) Introduction
Chapter 10 NP-Complete Problems.
Monster (“Mega”) Sudoku
Inference and search for the propositional satisfiability problem
Introduction to MiniSAT
More NP-complete Problems
A CIS 5603 Course Project By: Qizhong Mao, Baiyi Tao, Arif Aziz
The Propositional Calculus
More NP-complete Problems
Recovering and Exploiting Structural Knowledge from CNF Formulas
(xy)(yz)(xz)(zy)
Constraint Satisfaction Problems (CSPs) Introduction
Clause Learning and Intelligent Backtracking in MiniSAT
Watched Literals and Restarts in MiniSAT
Example Fill in the grid so that every row, column and box contains each of the numbers 1 to 9:
Where Can We Draw The Line?
Automated Proof Generation for EG
More NP-complete Problems
Branch and Bound.
Introduction to the Boolean Satisfiability Problem
Propositional Equivalences
Unit Propagation and Variable Ordering in MiniSAT
Decision Procedures An Algorithmic Point of View
Clause Learning and Intelligent Backtracking in MiniSAT
Modeling Sudoku as a CNF Formula
Unit Propagation and Variable Ordering in MiniSAT
Resolution Proofs for Combinational Equivalence
Introduction to the Boolean Satisfiability Problem
Introduction to MiniSAT
Linear Programming Excel Solver.
Constraint satisfaction problems
HW #2. Due Apr 25 23:59 Do NOT forget to submit both a hardcopy solution to the HW box and a softcopy solution to TA.
Clause Learning and Intelligent Backtracking in MiniSAT
Sudoku.
Watched Literals and Restarts in MiniSAT
Modeling Sudoku as a CNF Formula
Instructor: Aaron Roth
Constraint satisfaction problems
Presentation transcript:

Modeling Sudoku as a CNF Formula Spring 2017 CSCE 235H Introduction to Discrete Structures URL: cse.unl.edu/~cse235h All questions: Piazza

Sudoku Rules: Each cell filled with a number 1…9 Each row, column, and 3x3 box contains all nine numbers (i.e., no duplicates)

Sudoku Rules: Each cell filled with a number 1…9 Each row, column, and 3x3 box contains all nine numbers (i.e., no duplicates)

Defining the Variables asserts than the cell in row and column is assigned value .

Assigning Numbers (1) One number in 1…9 in cell in row i, column j Every cell contains at least one number:

Assigning Numbers (2) The cell in row i column j cannot take two numbers

Assigning Numbers (3) Each cell must contain a number: Every cell contains at most one number:

Restricting Rows, Columns Every row contains every number: Every column contains every number:

Restricting 3x3 Boxes Every 3x3 box contains every number:

Redundant Clauses Sudoku problem can be modeled in many ways May involve redundant clauses that can be removed to obtain an equivalent formula Can be generated using inference rules on other clauses in the problem Redundant clauses may be useful and speed the solving process

Defining Initial Setup Initial setup is defined by including unary clauses containing the variables corresponding to the values in the filled cells

Sudoku CNF Formula 729 variables 324 clauses with 9 literals 3240 total clauses (+ clauses for initial setup)

Solving Sudoku Total number of possible assignments: Testing one billion assignments a second: Modern SAT solvers can solve Sudoku in milliseconds by aggressively pruning the search tree