Sudoku Solutions Using Logic Equations Christian Posthoff The University of The West Indies, Trinidad & Tobago Bernd Steinbach Freiberg University of Mining.

Slides:



Advertisements
Similar presentations
Hybrid BDD and All-SAT Method for Model Checking Orna Grumberg Joint work with Assaf Schuster and Avi Yadgar Technion – Israel Institute of Technology.
Advertisements

“Using Weighted MAX-SAT Engines to Solve MPE” -- by James D. Park Shuo (Olivia) Yang.
On Solving Presburger and Linear Arithmetic with SAT Ofer Strichman Carnegie Mellon University.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Mar, 4, 2015 Slide credit: some slides adapted from Stuart.
Data Structures for SAT Solvers The 2-Literal Representation Gábor Kusper Eszterházy Károly College Eger, Hungary.
Properties of SLUR Formulae Ondřej Čepek, Petr Kučera, Václav Vlček Charles University in Prague SOFSEM 2012 January 23, 2012.
1.2 Row Reduction and Echelon Forms
Linear Equations in Linear Algebra
CSE (c) S. Tanimoto, 2008 Propositional Logic
Artificial Intelligence Chapter 11: Planning
On the Use of Automata Techniques to Decide Satisfiability Mia Minnes May 3, 2005.
Calculating Spectral Coefficients for Walsh Transform using Butterflies Marek Perkowski September 21, 2005.
1 Boolean Satisfiability in Electronic Design Automation (EDA ) By Kunal P. Ganeshpure.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
GRASP-an efficient SAT solver Pankaj Chauhan. 6/19/ : GRASP and Chaff2 What is SAT? Given a propositional formula in CNF, find an assignment.
NP-Complete Problems Problems in Computer Science are classified into
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Boolean Unification EE219B Presented by: Jason Shamberger March 1, 2000.
Shatter: Efficient Symmetry- Breaking for Boolean Satisfiability Fadi A. Aloul Igor L. Markov, Karem A. Sakallah The University of Michigan.
5.6 Maximization and Minimization with Mixed Problem Constraints
New Approach to Quantum Calculation of Spectral Coefficients Marek Perkowski Department of Electrical Engineering, 2005.
1 Message Passing and Local Heuristics as Decimation Strategies for Satisfiability Lukas Kroc, Ashish Sabharwal, Bart Selman (presented by Sebastian Brand)
Cardinality & Sorting Networks. Cardinality constraint Appears in many practical problems: scheduling, timetabling etc’. Also takes place in the Max-Sat.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
Algorithms for a large sparse nonlinear eigenvalue problem Yusaku Yamamoto Dept. of Computational Science & Engineering Nagoya University.
Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique.
Boolean Satisfiability and SAT Solvers
Quantified Formulas - Decision Procedure Daniel Kroening, Ofer Strichman Presented by Changki Hong 07 NOV 08.
4 4.4 © 2012 Pearson Education, Inc. Vector Spaces COORDINATE SYSTEMS.
MBSat Satisfiability Program and Heuristics Brief Overview VLSI Testing B Marc Boulé April 2001 McGill University Electrical and Computer Engineering.
Theory of Computation, Feodor F. Dragan, Kent State University 1 NP-Completeness P: is the set of decision problems (or languages) that are solvable in.
Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 TexPoint fonts used in EMF. Read the TexPoint manual before you.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
BoolTool: A Tool for Manipulation of Boolean Functions Petr Fišer, David Toman Czech Technical University in Prague Dept. of Computer Science and Engineering.
Linear Programming Erasmus Mobility Program (24Apr2012) Pollack Mihály Engineering Faculty (PMMK) University of Pécs João Miranda
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module Logic Representations.
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.
Clase 3: Basic Concepts of Search. Problems: SAT, TSP. Tarea 1 Computación Evolutiva Gabriela Ochoa
NP-completeness Section 7.4 Giorgi Japaridze Theory of Computability.
Finding Models for Blocked 3-SAT Problems in Linear Time by Systematical Refinement of a Sub- Model Gábor Kusper Eszterházy Károly.
Making Path-Consistency Stronger for SAT Pavel Surynek Faculty of Mathematics and Physics Charles University in Prague Czech Republic.
Solving the Logic Satisfiability problem Solving the Logic Satisfiability problem Jesus De Loera.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
Y=3x+1 y 5x + 2 =13 Solution: (, ) Solve: Do you have an equation already solved for y or x?
1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu.
SAT Encodings for Sudoku Bug Catching in 2006 Fall Sep. 26, 2006 Gi-Hwon Kwon.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
1 1.2 Linear Equations in Linear Algebra Row Reduction and Echelon Forms © 2016 Pearson Education, Ltd.
(iii) Simplex method - I D Nagesh Kumar, IISc Water Resources Planning and Management: M3L3 Linear Programming and Applications.
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.
On the Relation Between Simulation-based and SAT-based Diagnosis CMPE 58Q Giray Kömürcü Boğaziçi University.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
© 2012 IBM Corporation Perfect Hashing and CNF Encodings of Cardinality Constraints Yael Ben-Haim Alexander Ivrii Oded Margalit Arie Matsliah SAT 2012.
Automatic Test Generation
Hybrid BDD and All-SAT Method for Model Checking
Dr. Rachel Ben-Eliyahu – Zohary
NP-Completeness Proofs
ECE 667 Synthesis and Verification of Digital Circuits
Linear Equations in Linear Algebra
Propositional Equivalences
This Lecture Substitution model
Instructor: Aaron Roth
Linear Equations in Linear Algebra
Vector Spaces COORDINATE SYSTEMS © 2012 Pearson Education, Inc.
Linear Equations in Linear Algebra
Linear Equations in Linear Algebra
Presentation transcript:

Sudoku Solutions Using Logic Equations Christian Posthoff The University of The West Indies, Trinidad & Tobago Bernd Steinbach Freiberg University of Mining and Technology, Germany

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations2 Outline  Introduction  Modeling Using a SAT – Instance  Modeling Using a System of Logic Equations  Basic Approaches of Parallel SAT-Solving  New Approach: Implicit 2-Phase SAT-Solver  Basic Idea  First Phase  Second Phase  Experimental Results  Conclusions

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations3 Introduction Basic Definitions  Boolean Space  disjunction (clauses) of variables or complemented variables (literals) SAT-Problem  most general: Find all solutions of this equation!

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations4 Introduction SAT-Subproblems  Find some solutions!  Confirm that there are solutions!  Confirm that there is no solution! Complexity of the SAT-Problem  SAT is an NP-complete problem! Cook-Levin theorem Application of SAT-Solver  verification in circuit design  decision in artificial intelligence

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations5 Introduction Logic Function f of n Variables x  Logic Equation   no restriction for the expressions of the functions  Solution: set of Boolean vectors with 0  0 or 1  1 System of Logic Equations   Solution: set of Boolean vectors that solves each equation of the system

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations6 Modeling Using a SAT – Instance Example - Sudoku  Boolean model row:i column: j value: k 2 5

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations7 Two Types of Laws  1. requirements  defined for each row and value according to the first line each column and value according to the second line each subsquare and value according to the third line each field (row, column) according to the fourth line  number of literals in requirement clauses: n Modeling Using a SAT – Instance

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations8 Two Types of Laws  2. restrictions  using  it follows for a single basic value  number of literals in restrictive clauses:2 Modeling Using a SAT – Instance

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations9 Modeling Using a SAT – Instance Numbers of clauses for a 9 x 9 Sudoku (known from the literature)  Lynce, I. and Ouaknine, J.: Sudoku as a SAT Problem. 9th International Symposium on Artificial Intelligence and Mathematics, January 2006  minimal encoding8829 clauses  extended encoding11988 clauses  Weber, T: A SAT-based Sudoku Solver. TU Munich, November  one encoding gives only11745 clauses

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations10 Modeling Using a System of Logic Equations Restrictions  Constraints can be stated by one single conjunction for each number on each field.  The conjunction describes completely the setting of 1 on the field (1,1) and all the consequences.  There are 729 of such conjunctions for a 9 x 9 Sudoku which are defined uniquely.

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations11 Modeling Using a System of Logic Equations Requirements  Each of the four types of requirements can be expressed in terms of the 9 variables x i,j,k but also in terms of the associated 9 conjunctions K i,j,k, e.g.  Taking into consideration the conjunctions K i,j,k all the consequences resulting from a given setting are used immediately.

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations12 Modeling Using a System of Logic Equations Four Types of Requirements  value in a selected field  fixed value in a selected row  fixed value in a selected column  fixed value in a selected subsquare  number of logic equations in the system: 4 * 81 = 324

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations13 Modeling Using a System of Logic Equations Simplification  Due to the used conjunctions of restrictions K i,j,k each type of requirements solves the problem completely.  Hence, the system of logic equations consists of 81 equations (disjunctions of 9 conjunctions) completed by a single characteristic equation of the given setting.

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations14 abcde abcde abcde abcde Processing of variables in parallel SAT – example: Partial solutions expressed by orthogonal TVLs Basic Approaches of Parallel SAT-Solving

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations15 All global solutions calculated by intersections in parallel constructive solution process finds all solutions without any search Basic Approaches of Parallel SAT-Solving abcde abcde abcde abcde  abcde abcde abcde  

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations16 New Approach: Implicit 2-Phase SAT-Solver Basic Idea  the problem knowledge is widely distributed over the clauses of the SAT formula  preserve this knowledge by substituting the huge number of clauses by a much smaller amount of partial solution sets of logic equations  requires the new two-phase SAT-solver first phase: create partial solution sets second phase: combine these partial solution sets to the final solution

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations17 First Phase  all literal in requirement clauses: not negated  all literal in restrictive clauses: negated  n 3 particular SAT- problems, e.g.  solution of a particular SAT- problem  n 3 such solutions stored as matrix of ternary vectors  number of zeros: New Approach: Implicit 2-Phase SAT-Solver

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations18 First Phase  solution of the first phase: matrix of partial solution sets (mpss) or the simple case of a 4  4 Sudoku New Approach: Implicit 2-Phase SAT-Solver

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations19 First Phase  restrictive problem laws are captured by an algorithm that creates the matrix mpss of partial solutions New Approach: Implicit 2-Phase SAT-Solver

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations20 Second Phase  each requirement law can be extended by the partial solution sets of mpss known from the first phase; e.g. the clause can be extended to  due to the repeated use of the same literal in different clauses, the associated partial solution set of mpss is used several times New Approach: Implicit 2-Phase SAT-Solver

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations21 Second Phase  the global solution is calculated straight forward controlled by the requirement laws of one type only  applying the partial solution sets of the given settings first restricts the remaining solution space  no search procedures are involved  due to the fixed values in the restrictions, it is a disadvantage to take the requirement type of values in a selected field in the second phase New Approach: Implicit 2-Phase SAT-Solver

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations22 Second Phase  required problem laws are captured by an algorithm that uses the matrix mpss and calculates the final solutions  main operations union of selected partial solution sets intersection of these sets New Approach: Implicit 2-Phase SAT-Solver

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations23 9  9 Sudoku  16 of 81 fixed values only  729 Boolean variable  first phase: 667 msec  second phase:15 msec  2 solutions 16  16 Sudoku  120 of 256 fixed values  4096 Boolean variables  first phase: 0 msec  second phase: 148,4 sec  1 solution Experimental Results

IWSBP 2008 / Christian Posthoff & Bernd Steinbach: Sudoku Solutions Using Logic Equations24 Conclusions  Many combinatorial problems can be transformed into satisfiability problems.  advantages of SAT  unique representation of different problems  universal well explored SAT – solver  disadvantage of SAT  large number of clauses  loss of problem knowledge  our new implicit two-phase SAT – solver breaks this disadvantage first phase: generate matrix of partial solution sets mpss based on the restrictive laws second phase: solve the SAT – problem controlled by the required laws using the matrix mpss  Several problems having up to more than 4000 Boolean variables were solved in a couple of seconds.