
The basic idea is just backtracking search: pick a variable, But an empty problem (containing no clauses) represents true, and is triviallyĭavis-Putnam-Logemann-Loveland (DPLL) is a simple and effective algorithm for a SAT solver. So an emptyĬlause represents false, and a problem containing an empty clause is unsatisfiable. Each clause is interpreted as the disjunction (OR) of its literals, and the formula as a whole is interpreted as the conjunction (AND) of the clauses. SAT solvers typically use a restricted form of propositional formula called CNF.Ī formula in conjunctive normal form (CNF) consists of a set of clauses, each of which is a set of literals. The satisfiability problem is to find an assignment of truth values to the variables that makes the formula true.Ī SAT solver is a program that solves the satisfiability problem: given a formula, it either returns an assignment that makes it true, or says that no suchĪssignment exists. Sudoku by SAT is not very appealing for human players but works well on a computer.Ī propositional formula is a logical formula formed from boolean variables and the boolean operators AND, OR and NOT.
#JAVA SOLVING SUDOKU PUZZLES HOW TO#
Sudoku is normally solved by reasoning, determining one step at a time how to complete an additional square until the entire puzzle is finished. In addition, the grid is divided into 9 blocks, each 3x3, and each digit must also occur exactly once inĮach block. The aim is to complete a 9x9 grid with a digit between 1 and 9 in each square, so that - as in a Latin square -Įach digit occurs exactly once in each row and in each column. BackgroundĪ Sudoku puzzle is a kind of Latin square. To get started, pull out the problem set code from SVN Admin. Otherwise you will break our testing suite and your grades You are NOT using any external jar files or libraries for this problem set. It is YOUR responsibility to make sure that Your code will be tested automatically, and will

New packages or change any existing packages' names. The signatures, specifications, or representations of any existing methods and classes that we provided,

You can add new public methods and classes to the code we have provided you. The purpose of this problem set is to give you practice coding in Java, and to introduce you to immutable datatypes and SAT solving. Problem Set 2: Building a Sudoku Solver with SATĬode Review Due: Wednesday, March 7 2012, 11:59 PMįinal Due: Sunday, March 18 2012, 11:59 PM
#JAVA SOLVING SUDOKU PUZZLES SOFTWARE#
Problem Set 2: Building a Sudoku Solver with SAT 6.005 Elements of Software Construction | Spring 2012
