# A SAT-based Sudoku Solver

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 A SAT-based Sudoku Solver Tjark Weber Institut für Informatik, Technische Universität München Boltzmannstr. 3, D Garching b. München, Germany Abstract. This paper presents a SAT-based Sudoku solver. A Sudoku is translated into a propositional formula that is satisfiable if and only if the Sudoku has a solution. A standard SAT solver can then be applied, and a solution for the Sudoku can be read off from the satisfying assignment returned by the SAT solver. No coding was necessary to implement this solver: The translation into propositional logic is provided by a framework for finite model generation available in the Isabelle/HOL theorem prover. Only the constraints on a Sudoku solution had to be specified in the prover s logic. 1 Introduction Sudoku, also known as Number Place in the United States, is a placement puzzle. Given a grid most frequently a 9 9 grid made up of 3 3 subgrids called regions with various digits given in some cells (the givens ), the aim is to enter a digit from 1 through 9 in each cell of the grid so that each row, column and region contains only one instance of each digit. Fig. 1 shows a Sudoku on the left, along with its unique solution on the right [12]. Note that other symbols (e.g. letters, icons) could be used instead of digits, as their arithmetic properties are irrelevant in the context of Sudoku. This is currently a rather popular puzzle that is featured in a number of newspapers and puzzle magazines [1, 3, 9]. Several Sudoku solvers are available already [6, 10]. Since there are more than possible Sudoku grids [5], a naïve backtracking algorithm would be infeasible. Sudoku solvers therefore combine backtracking with sometimes complicated methods for constraint propagation. In this paper we propose a SAT-based approach: A Sudoku is translated into a propositional formula that is satisfiable if and only if the Sudoku has a solution. The propositional formula is then presented to a standard SAT solver, and if the SAT solver finds a satisfying assignment, this assignment can readily be transformed into a solution for the original Sudoku. The presented translation into SAT is simple, and requires minimal implementation effort since we can make use of an existing framework for finite model generation [11] available in the Isabelle/HOL [8] theorem prover. This work was supported by the PhD program Logic in Computer Science of the German Research Foundation.

2 Fig. 1. Sudoku example and solution 2 Implementation in Isabelle/HOL An implementation of the Sudoku rules in the interactive theorem prover Isabelle/HOL is straightforward. Digits are modelled by a datatype with nine elements 1,..., 9. We say that nine grid cells x 1,..., x 9 are valid iff they contain every digit. Definition 1 (valid). valid(x 1, x 2, x 3, x 4, x 5, x 6, x 7, x 8, x 9 ) 9 d=1 i=1 9 x i = d. Labeling the 81 cells of a 9 9 grid as shown in Fig. 2, we can now define what it means for them to be a Sudoku solution: each row, column and region must be valid. Definition 2 (sudoku). sudoku({x ij } i,j {1,...,9} ) 9 valid(x i1, x i2, x i3, x i4, x i5, x i6, x i7, x i8, x i9 ) i=1 9 valid(x 1j, x 2j, x 3j, x 4j, x 5j, x 6j, x 7j, x 8j, x 9j ) j=1 i,j {1,4,7} valid(x ij, x i(j+1), x i(j+2), x (i+1)j, x (i+1)(j+1), x (i+1)(j+2), x (i+2)j, x (i+2)(j+1), x (i+2)(j+2) ). The next section describes the translation of these definitions into propositional logic. 3 Translation to SAT We encode a Sudoku by introducing 9 Boolean variables for each cell of the 9 9 grid, i.e. 9 3 = 729 variables in total. Each Boolean variable p d ij (with

3 x 11 x 12 x 13 x 14 x 15 x 16 x 17 x 18 x 19 x 21 x 22 x 23 x 24 x 25 x 26 x 27 x 28 x 29 x 31 x 32 x 33 x 34 x 35 x 36 x 37 x 38 x 39 x 41 x 42 x 43 x 44 x 45 x 46 x 47 x 48 x 49 x 51 x 52 x 53 x 54 x 55 x 56 x 57 x 58 x 59 x 61 x 62 x 63 x 64 x 65 x 66 x 67 x 68 x 69 x 71 x 72 x 73 x 74 x 75 x 76 x 77 x 78 x 79 x 81 x 82 x 83 x 84 x 85 x 86 x 87 x 88 x 89 x 91 x 92 x 93 x 94 x 95 x 96 x 97 x 98 x 99 Fig. 2. Sudoku grid 1 i, j, d 9) represents the truth value of the equation x ij = d. A clause ensures that the cell x ij denotes one of the nine digits, and 36 clauses p d ij pd ij 9 d=1 1 d<d 9 make sure that the cell does not denote two different digits at the same time. Since there are just as many digits as cells in each row, column, and region, Def. 1 is equivalent to the following characterization of validity, stating that the nine grid cells x 1,..., x 9 contain distinct values. Lemma 1 (Equivalent characterization of validity). valid(x 1, x 2,x 3, x 4, x 5, x 6, x 7, x 8, x 9 ) p d ij 1 i<j 9 d=1 1 i<j 9 9 x i d x j d. x i x j The latter characterization turns out to be much more efficient when translated to SAT. While Def. 1, when translated directly, produces 9 clauses with 9 literals each (one literal for each equation), the formula given in Lemma 1 is translated into 324 clauses (9 clauses for each of the 36 inequations x i x j ), but each clause of length 2 only. This allows for more unit propagation [14] at the Boolean level, which in terms of the original Sudoku corresponds to crosshatching [12] of digits, a technique that is essential to reduce the search space.

4 The 9 clauses obtained from a direct translation of Def. 1 could still be used as well; unit propagation on these clauses would correspond to counting the digits 1 9 in regions, rows, and columns to identify missing numbers. However, in our experiments we did not experience any speedup by including these clauses. This gives us a total of clauses: 81 definedness clauses of length 9, uniqueness clauses of length 2, and validity clauses, 1 again of length 2. However, we do not need to introduce Boolean variables for cells whose value is given in the original Sudoku, and we can omit definedness and uniqueness clauses for these cells as well as some of the validity clauses therefore the total number of variables and clauses used in the encoding of a Sudoku with givens will be less than 729 and 11745, respectively. Note that our encoding already yields a propositional formula in conjunctive normal form (CNF). Therefore conversion into DIMACS CNF format [4] the standard input format used by most SAT solvers is trivial. Isabelle can search for a satisfying assignment using either an internal DPLL-based [2] SAT solver, or write the formula to a file in DIMACS format and execute an external solver. We have employed zchaff [7] to find the solution to various Sudoku classified as hard by their respective authors (see Fig. 3 for an example), and in every case the runtime was only a few milliseconds Fig. 3. hard Sudoku example and solution 4 Concluding Remarks We have presented a straightforward translation of a Sudoku into a propositional formula. The translation can easily be generalized from 9 9 grids to grids of arbitrary dimension. It is polynomial in the size of the grid, and since Sudoku is NP-complete [13], no algorithm with better complexity is known. The translation, combined with a state-of-the-art SAT solver, is also practically successful: 9 9 Sudoku puzzles are solved within milliseconds. Traditionally the givens in a Sudoku are chosen so that the puzzle s solution is unique; nevertheless our algorithm can be extended to enumerate all possi- 1 This number includes some duplicates, caused by the overlap between rows/columns and regions: certain cells that must be distinct because they belong to the same row (or column) must also be distinct because they belong to the same region.

5 ble solutions (by explicitly disallowing all solutions found so far, and perhaps using an incremental SAT solver that allows adding clauses on-the-fly to avoid searching through the same search space multiple times). Particularly remarkable is the fact that our solver, while it can certainly compete with hand-crafted Sudoku solvers, some of which use rather complex patterns and search heuristics, required very little implementation effort. Aside from Lemma 1, no domain-specific knowledge was used. The impressive performance is largely due to the SAT solver. Even the translation into propositional logic was not written by hand, but is an instance of a framework for finite model generation that is readily available in the Isabelle/HOL theorem prover. Only the Sudoku rules had to be defined in the prover, and this was a trouble-free task. References [1] Col Allan, editor. New York Post. News Corporation, New York City, NY, USA, [2] M. Davis, G. Logemann, and D. Loveland. A machine program for theorem proving. Communications of the ACM, 5: , [3] Giovanni di Lorenzo, editor. Die Zeit. Zeitverlag Gerd Bucerius GmbH & Co. KG, Hamburg, Germany, [4] DIMACS satisfiability suggested format, Available online at ftp://dimacs. rutgers.edu/pub/challenge/satisfiability/doc. [5] Bertram Felgenhauer and Frazer Jarvis. Enumerating possible Sudoku grids, June Available online at pm1afj/sudoku/. [6] DeadMan s Handle Ltd. Sudoku solver, September Available online at [7] M. Moskewicz, C. Madigan, Y. Zhao, L. Zhang, and S. Malik. Chaff: Engineering an efficient SAT solver. In Proceedings of the 38th Design Automation Conference, Las Vegas, June [8] Tobias Nipkow, Lawrence C. Paulson, and Markus Wenzel. Isabelle/HOL A Proof Assistant for Higher-Order Logic, volume 2283 of Lecture Notes in Computer Science. Springer, [9] Robert James Thomson, editor. The Times. Times Newspapers Ltd., London, UK, [10] Pete Wake. Sudoku solver by logic, September Available online at http: //www.sudokusolver.co.uk/. [11] Tjark Weber. Bounded model generation for Isabelle/HOL. In Wolfgang Ahrendt, Peter Baumgartner, Hans de Nivelle, Silvio Ranise, and Cesare Tinelli, editors, Selected Papers from the Workshops on Disproving and the Second International Workshop on Pragmatics of Decision Procedures (PDPAR 2004), volume 125(3) of Electronic Notes in Theoretical Computer Science, pages Elsevier, July [12] Wikipedia. Sudoku Wikipedia, the free encyclopedia, September Available online at [13] Takayuki Yato and Takahiro Seta. Complexity and completeness of finding another solution and its application to puzzles. In IPSJ SIG Notes 2002-AL IPSJ, [14] L. Zhang and S. Malik. The quest for efficient boolean satisfiability solvers. In Andrei Voronkov, editor, Proceedings of the 8th International Conference on Computer Aided Deduction (CADE 2002), volume 2392 of Lecture Notes in Computer Science. Springer, 2002.

### Complexity and Completeness of Finding Another Solution and Its Application to Puzzles

yato@is.s.u-tokyo.ac.jp seta@is.s.u-tokyo.ac.jp Π (ASP) Π x s x s ASP Ueda Nagao n n-asp parsimonious ASP ASP NP Complexity and Completeness of Finding Another Solution and Its Application to Puzzles Takayuki

### Sudoku as a SAT Problem

Sudoku as a SAT Problem Inês Lynce IST/INESC-ID, Technical University of Lisbon, Portugal ines@sat.inesc-id.pt Joël Ouaknine Oxford University Computing Laboratory, UK joel@comlab.ox.ac.uk Abstract Sudoku

### Optimized CNF Encoding for Sudoku Puzzles

Optimized CNF Encoding for Sudoku Puzzles Gihwon Kwon 1, Himanshu Jain 2 1 Department of Computer Science, Kyonggi University khkwon@kyonggi.ac.kr 2 Department of Computer Science, Carnegie Mellon University

### Lecture 2: March 20, 2015

Automatic Software Verification Spring Semester, 2015 Lecture 2: March 20, 2015 Lecturer: Prof. Mooly Sagiv Scribe: Kalev Alpernas and Elizabeth Firman 2.1 Introduction In this lecture we will go over

### 3 times Sudoku. Logic and Constraints in Clojure. Burkhardt Renz. Institut für SoftwareArchitektur Technische Hochschule Mittelhessen

3 times Sudoku Logic and Constraints in Clojure Burkhardt Renz Institut für SoftwareArchitektur Technische Hochschule Mittelhessen :clojured January 24 th, 2015 The Nature of the Game Rules and Terminology

### A Sudoku-Solver for Large Puzzles using SAT

Uwe Pfeiffer, Tomas Karnagel and Guido Scheffler Technische Universitt Dresden (TUD), Germany {Uwe.Pfeiffer,Tomas.Karnagel}@mailbox.tu-dresden.de, guido.scheffler@email.de Abstract Sudoku puzzles can be

### Satisfiability of Boolean Expressions

Satisfiability of Boolean Expressions In the previous section, we have analysed in great detail one particular problem reachability in directed graphs. The reason for the attention devoted to this one

### Solving Single-digit Sudoku Subproblems

Solving Single-digit Sudoku Subproblems David Eppstein Int. Conf. Fun with Algorithms, June 2012 Sudoku An ab ab array of cells, partitioned into a b blocks, partially filled in with numbers from 1 to

### 38050 Povo Trento (Italy), Via Sommarive 14 TOWARDS EXPLAINING SEMANTIC MATCHING

UNIVERSITY OF TRENTO DEPARTMENT OF INFORMATION AND COMMUNICATION TECHNOLOGY 38050 Povo Trento (Italy), Via Sommarive 14 http://www.dit.unitn.it TOWARDS EXPLAINING SEMANTIC MATCHING Deborah L. McGuinness,

### npsolver A SAT Based Solver for Optimization Problems

npsolver A SAT Based Solver for Optimization Problems Norbert Manthey and Peter Steinke Knowledge Representation and Reasoning Group Technische Universität Dresden, 01062 Dresden, Germany peter@janeway.inf.tu-dresden.de

### Enumerating possible Sudoku grids

Enumerating possible Sudoku grids Bertram Felgenhauer Department of Computer Science TU Dresden 00 Dresden Germany bf@mail.inf.tu-dresden.de Frazer Jarvis Department of Pure Mathematics University of Sheffield,

### Practical Applications of Boolean Satisfiability

Practical Applications of Boolean Satisfiability Joao Marques-Silva School of Electronics and Computer Science University of Southampton WODES 08, Göteborg, Sweden, May 2008 Motivation Many Uses of Satisfiability

### IMPLEMENTING A CSP SOLVER FOR SUDOKU

IMPLEMENTING A CSP SOLVER FOR SUDOKU Benjamin Bittner 1 and Kris Oosting 2 1 University of Amsterdam, The Netherlands; bittner@science.uva.nl. 2 Vrije Universiteit Amsterdam, The Netherlands; kris.oosting@lfri.nl.

### NUMB3RS Activity: Sudoku Puzzles. Episode: All s Fair

Teacher Page 1 NUMBRS Activity: Sudoku Puzzles Topic: Sudoku Puzzles Grade Level: 8-10 Objective: Explore sudoku puzzles and Latin squares Time: 60-90 minutes Introduction In All s Fair, Alan, Larry, and

### Introduction to Logic in Computer Science: Autumn 2006

Introduction to Logic in Computer Science: Autumn 2006 Ulle Endriss Institute for Logic, Language and Computation University of Amsterdam Ulle Endriss 1 Plan for Today Now that we have a basic understanding

### Sudoku as an Expression in Propositional Logic

Sudoku as an Expression in Propositional Logic Peter Cappello Department of Computer Science University of California, Santa Barbara INTRODUCTION Sudoku is a kind of puzzle that involves a 9 9 array of

### An Integer Programming Model for the Sudoku Problem

An Integer Programming Model for the Sudoku Problem Andrew C. Bartlett Amy N. Langville March 8, 2006 Abstract Sudoku is the new craze in logic puzzles. Players must fill in an n n matrix, which contains

### Boolean Representations and Combinatorial Equivalence

Chapter 2 Boolean Representations and Combinatorial Equivalence This chapter introduces different representations of Boolean functions. It then discuss the applications of these representations for proving

### A Simple and Flexible Way of Computing Small Unsatisfiable Cores in SAT Modulo Theories

A Simple and Flexible Way of Computing Small Unsatisfiable Cores in SAT Modulo Theories Alessandro Cimatti 1, Alberto Griggio 2, and Roberto Sebastiani 2 1 ITC-IRST, Povo, Trento, Italy. cimatti@itc.it

### Mathematics of Sudoku I

Mathematics of Sudoku I Bertram Felgenhauer Frazer Jarvis January, 00 Introduction Sudoku puzzles became extremely popular in Britain from late 00. Sudoku, or Su Doku, is a Japanese word (or phrase) meaning

### Sudoku and OR. F. Della Croce Dipartimento di Automatica ed Informatica, Politecnico di Torino address:

Sudoku and OR F. Della Croce Dipartimento di Automatica ed Informatica, Politecnico di Torino E-mail address: federico.dellacroce@polito.it Keywords: Combinatorial Optimization, Integer Programming 1 Introduction

### A Sudoku Solver. CSC 242: Artificial Intelligence. Mike Schermerhorn

A Sudoku Solver CSC 242: Artificial Intelligence Mike Schermerhorn Introduction The standard Sudoku puzzle consists of a nine by nine grid, broken into nine three by three boxes. Each of the eighty one

### The Application of Exact Cover to the. Creating of Sudoku Puzzle

Team # 3140 Page 1 of 24 The Application of Exact Cover to the Summary Creating of Sudoku Puzzle In this paper, we develop an algorithm to create a Sudoku puzzle of a desired difficulty level. The main

### University of Potsdam Faculty of Computer Science. Clause Learning in SAT Seminar Automatic Problem Solving WS 2005/06

University of Potsdam Faculty of Computer Science Clause Learning in SAT Seminar Automatic Problem Solving WS 2005/06 Authors: Richard Tichy, Thomas Glase Date: 25th April 2006 Contents 1 Introduction

### Satisfiability Checking

Satisfiability Checking SAT-Solving Prof. Dr. Erika Ábrahám Theory of Hybrid Systems Informatik 2 WS 10/11 Prof. Dr. Erika Ábrahám - Satisfiability Checking 1 / 40 A basic SAT algorithm Assume the CNF

### Sudoku puzzles and how to solve them

Sudoku puzzles and how to solve them Andries E. Brouwer 2006-05-31 1 Sudoku Figure 1: Two puzzles the second one is difficult A Sudoku puzzle (of classical type ) consists of a 9-by-9 matrix partitioned

### Sudoku Puzzles and How to Solve Them

1 258 NAW 5/7 nr. 4 december 2006 Sudoku Puzzles and How to Solve Them Andries E. Brouwer Andries E. Brouwer Technische Universiteit Eindhoven Postbus 513, 5600 MB Eindhoven aeb@win.tue.nl Recreational

### Creating Sudoku Puzzles

Page 1 of 15 Control # 2883 Creating Sudoku Puzzles Control # 2883 February 19, 2008 Abstract We consider the problem of generating well-formed Sudoku puzzles. Weighing the benefits of constructing a problem

### Solving SAT and SAT Modulo Theories: from an Abstract Davis-Putnam-Logemann-Loveland Procedure to DPLL(T)

Solving SAT and SAT Modulo Theories: from an Abstract Davis-Putnam-Logemann-Loveland Procedure to DPLL(T) ROBERT NIEUWENHUIS and ALBERT OLIVERAS Technical University of Catalonia, Barcelona and CESARE

### CS510 Software Engineering

CS510 Software Engineering Propositional Logic Asst. Prof. Mathias Payer Department of Computer Science Purdue University TA: Scott A. Carr Slides inspired by Xiangyu Zhang http://nebelwelt.net/teaching/15-cs510-se

### Solving Systems of Linear Inequalities by Bound Propagation

Solving Systems of Linear Inequalities by Bound Propagation Konstantin Korovin and Andrei Voronkov The University of Manchester Abstract. In this paper we introduce a new method for solving systems of

### A SAT Based Scheduler for Tournament Schedules

A SAT Based Scheduler for Tournament Schedules Hantao Zhang, Dapeng Li, and Haiou Shen Department of Computer Science The University of Iowa Iowa City, IA 52242-1419, USA {dapli, hshen, hzhang}@cs.uiowa.edu

### Inference in propositional logic

C 1571 Introduction to AI Lecture 13 Inference in propositional logic Milos Hauskrecht milos@cs.pitt.edu 5329 ennott quare Logical inference problem Logical inference problem: Given: a knowledge base KB

### You ve seen them played in coffee shops, on planes, and

Every Sudoku variation you can think of comes with its own set of interesting open questions There is math to be had here. So get working! Taking Sudoku Seriously Laura Taalman James Madison University

### Rating and Generating Sudoku Puzzles Based On Constraint Satisfaction Problems

Rating and Generating Sudoku Puzzles Based On Constraint Satisfaction Problems Bahare Fatemi, Seyed Mehran Kazemi, Nazanin Mehrasa Abstract Sudoku is a logic-based combinatorial puzzle game which people

### Extending Semantic Resolution via Automated Model Building: applications

Extending Semantic Resolution via Automated Model Building: applications Ricardo Caferra Nicolas Peltier LIFIA-IMAG L1F1A-IMAG 46, Avenue Felix Viallet 46, Avenue Felix Viallei 38031 Grenoble Cedex FRANCE

### Generating models of a matched formula with a polynomial delay

Generating models of a matched formula with a polynomial delay Petr Savicky Institute of Computer Science, Academy of Sciences of Czech Republic, Pod Vodárenskou Věží 2, 182 07 Praha 8, Czech Republic

### Foundations of Artificial Intelligence

Foundations of Artificial Intelligence 7. Propositional Logic Rational Thinking, Logic, Resolution Wolfram Burgard, Bernhard Nebel and Martin Riedmiller Albert-Ludwigs-Universität Freiburg Contents 1 Agents

### Genetic Algorithms and Sudoku

Genetic Algorithms and Sudoku Dr. John M. Weiss Department of Mathematics and Computer Science South Dakota School of Mines and Technology (SDSM&T) Rapid City, SD 57701-3995 john.weiss@sdsmt.edu MICS 2009

### We shall turn our attention to solving linear systems of equations. Ax = b

59 Linear Algebra We shall turn our attention to solving linear systems of equations Ax = b where A R m n, x R n, and b R m. We already saw examples of methods that required the solution of a linear system

### A Tool for Generating Partition Schedules of Multiprocessor Systems

A Tool for Generating Partition Schedules of Multiprocessor Systems Hans-Joachim Goltz and Norbert Pieth Fraunhofer FIRST, Berlin, Germany {hans-joachim.goltz,nobert.pieth}@first.fraunhofer.de Abstract.

### Lecture 7: NP-Complete Problems

IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 7: NP-Complete Problems David Mix Barrington and Alexis Maciel July 25, 2000 1. Circuit

### An Integer Programming Model for the Sudoku Problem

An Integer Programming Model for the Sudoku Problem Andrew C. Bartlett Timothy P. Chartier Amy N. Langville Timothy D. Rankin May 3, 2008 Abstract Sudoku is the recent craze in logic puzzles. Players must

### Offline 1-Minesweeper is NP-complete

Offline 1-Minesweeper is NP-complete James D. Fix Brandon McPhail May 24 Abstract We use Minesweeper to illustrate NP-completeness proofs, arguments that establish the hardness of solving certain problems.

### Fundamentals of Mathematics Lecture 6: Propositional Logic

Fundamentals of Mathematics Lecture 6: Propositional Logic Guan-Shieng Huang National Chi Nan University, Taiwan Spring, 2008 1 / 39 Connectives Propositional Connectives I 1 Negation: (not A) A A T F

### Mathematical Logic. Tableaux Reasoning for Propositional Logic. Chiara Ghidini. FBK-IRST, Trento, Italy

Tableaux Reasoning for Propositional Logic FBK-IRST, Trento, Italy Outline of this lecture An introduction to Automated Reasoning with Analytic Tableaux; Today we will be looking into tableau methods for

### System Description: The MathWeb Software Bus for Distributed Mathematical Reasoning

System Description: The MathWeb Software Bus for Distributed Mathematical Reasoning Jürgen Zimmer 1 and Michael Kohlhase 2 1 FB Informatik, Universität des Saarlandes jzimmer@mathweb.org 2 School of Computer

### NP-Completeness and Cook s Theorem

NP-Completeness and Cook s Theorem Lecture notes for COM3412 Logic and Computation 15th January 2002 1 NP decision problems The decision problem D L for a formal language L Σ is the computational task:

### Behind the scenes of Sudoku: Application of genetic algorithms for the optimal fun.

Behind the scenes of Sudoku: Application of genetic algorithms for the optimal fun. Thomas Bridi Thomas.bridi@studio.unibo.it Abstract. This work discusses about algorithms belonging to the branch of artificial

### 10.1 Integer Programming and LP relaxation

CS787: Advanced Algorithms Lecture 10: LP Relaxation and Rounding In this lecture we will design approximation algorithms using linear programming. The key insight behind this approach is that the closely

### Wildcat: a Local Search PB Optimizer

Wildcat: a Local Search PB Optimizer Lengning Liu and Mirosław Truszczyński Department of Computer Science, University of Kentucky, Lexington, KY 40506-0046, USA 1 Introduction Wildcat is an optimizer

### Difficulty Rating of Sudoku Puzzles by a Computational Model

Difficulty Rating of Sudoku Puzzles by a Computational Model Radek Pelánek Masaryk University Brno, Czech Republic Abstract We discuss and evaluate metrics for difficulty rating of Sudoku puzzles. The

### Sudoku, logic and proof Catherine Greenhill

Sudoku, logic and proof Catherine Greenhill As you probably know, a Sudoku puzzle is a 9 9 grid divided into nine 3 3 subgrids. Some of the cells in the grid contain a symbol: usually the symbols are the

### Outline. Database Theory. Perfect Query Optimization. Turing Machines. Question. Definition VU , SS Trakhtenbrot s Theorem

Database Theory Database Theory Outline Database Theory VU 181.140, SS 2016 4. Trakhtenbrot s Theorem Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 4.

### Bounded-width QBF is PSPACE-complete

Bounded-width QBF is PSPACE-complete Albert Atserias 1 and Sergi Oliva 2 1 Universitat Politècnica de Catalunya Barcelona, Spain atserias@lsi.upc.edu 2 Universitat Politècnica de Catalunya Barcelona, Spain

### Memory Efficient All-Solutions SAT Solver and Its Application for Reachability Analysis

Memory Efficient All-Solutions SAT Solver and Its Application for Reachability Analysis Orna Grumberg, Assaf Schuster, and Avi Yadgar Computer Science Department, Technion, Haifa, Israel Abstract. This

### Logic in general. Inference rules and theorem proving

Logical Agents Knowledge-based agents Logic in general Propositional logic Inference rules and theorem proving First order logic Knowledge-based agents Inference engine Knowledge base Domain-independent

### Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

Chapter 1, Part I: Propositional Logic With Question/Answer Animations Chapter Summary Propositional Logic The Language of Propositions Applications Logical Equivalences Predicate Logic The Language of

### Sudoku Puzzles Generating: from Easy to Evil

Team # 3485 Page 1 of 20 Sudoku Puzzles Generating: from Easy to Evil Abstract As Sudoku puzzle becomes worldwide popular among many players in different intellectual levels, the task is to devise an algorithm

### Building SMT-based Software Model Checkers: an Experience Report

Building SMT-based Software Model Checkers: an Experience Report Alessandro Armando Artificial Intelligence Laboratory (AI-Lab) Dipartimento di Informatica Sistemistica e Telematica (DIST) University of

### EFFICIENT KNOWLEDGE BASE MANAGEMENT IN DCSP

EFFICIENT KNOWLEDGE BASE MANAGEMENT IN DCSP Hong Jiang Mathematics & Computer Science Department, Benedict College, USA jiangh@benedict.edu ABSTRACT DCSP (Distributed Constraint Satisfaction Problem) has

### The Classes P and NP

The Classes P and NP We now shift gears slightly and restrict our attention to the examination of two families of problems which are very important to computer scientists. These families constitute the

### Each value (1 through 9) must appear exactly once in each row. Each value (1 through 9) must appear exactly once in each column.

INTRODUCTION TO COMPUTER SCIENCE I PROJECT 6 Sudoku! 1 The game of Sudoku Sudoku is a popular game giving crossword puzzles a run for their money in newspapers. 1 It s a game well suited for computers

### The Impact of Balancing on Problem Hardness in a Highly Structured Domain

The Impact of Balancing on Problem Hardness in a Highly Structured Domain Carlos Ansótegui, Ramón Béjar, César Fernàndez, Carla Gomes, Carles Mateu carlos@iiia.csic.es, IIIA-CSIC, Barcelona, SPAIN {ramon,cesar,carlesm}@diei.udl.es,

### Methods for Solving Sudoku Puzzles

Methods for Solving Sudoku Puzzles CSCI - 5454, CU Boulder Anshul Kanakia kanakia@colorado.edu John Klingner john.klingner@colorado.edu 1 Introduction 1.1 A Brief History This number puzzle is relatively

### Approximated Probabilistic Answer Set Programming

Approximated Probabilistic Answer Set Programming Department of Computer Science Universidade de São Paulo São Paulo, Brazil 2014 Toy Example 4 6 2 5 1 3 Limit the percentage of time the edge (1, 3) is

### OHJ-2306 Introduction to Theoretical Computer Science, Fall 2012 8.11.2012

276 The P vs. NP problem is a major unsolved problem in computer science It is one of the seven Millennium Prize Problems selected by the Clay Mathematics Institute to carry a \$ 1,000,000 prize for the

### 1. LINEAR EQUATIONS. A linear equation in n unknowns x 1, x 2,, x n is an equation of the form

1. LINEAR EQUATIONS A linear equation in n unknowns x 1, x 2,, x n is an equation of the form a 1 x 1 + a 2 x 2 + + a n x n = b, where a 1, a 2,..., a n, b are given real numbers. For example, with x and

### Constraint Satisfaction Problems (CSP)

Example: Map-Coloring c: Artificial Intelligence Constraint Satisfaction Problems (CSP) Chapter, Textbook ariables WA, NT, Q,,,, T Domains D i = {red,green,blue} Constraints: adjacent regions must have

### Introduction to NP-Completeness Written and copyright c by Jie Wang 1

91.502 Foundations of Comuter Science 1 Introduction to Written and coyright c by Jie Wang 1 We use time-bounded (deterministic and nondeterministic) Turing machines to study comutational comlexity of

### Verifying Refutations with Extended Resolution

Verifying Refutations with Extended Resolution Marijn J. H. Heule, Warren A. Hunt Jr., and Nathan Wetzler The University of Texas at Austin Abstract. Modern SAT solvers use preprocessing and inprocessing

### A Theory-Based Decision Heuristic for DPLL(T )

A Theory-Based Decision Heuristic for DPLL(T ) Dan Goldwasser CS, Haifa University Haifa, Israel dgoldwas@cs.haifa.ac.il Ofer Strichman Information System Engineering, IE, Technion, Haifa, Israel ofers@ie.technion.ac.il

### Random vs. Structure-Based Testing of Answer-Set Programs: An Experimental Comparison

Random vs. Structure-Based Testing of Answer-Set Programs: An Experimental Comparison Tomi Janhunen 1, Ilkka Niemelä 1, Johannes Oetsch 2, Jörg Pührer 2, and Hans Tompits 2 1 Aalto University, Department

### A Cellular Sudoku Solver

A Cellular Sudoku Solver Daniel Díaz-Pernil, Carlos M. Fernández-Márquez, Manuel García-Quismondo, Miguel A. Gutiérrez-Naranjo, Miguel A. Martínez-del-Amor Research Group on Natural Computing Department

### Counting Falsifying Assignments of a 2-CF via Recurrence Equations

Counting Falsifying Assignments of a 2-CF via Recurrence Equations Guillermo De Ita Luna, J. Raymundo Marcial Romero, Fernando Zacarias Flores, Meliza Contreras González and Pedro Bello López Abstract

### CIS 391 Introduction to Artificial Intelligence Practice Midterm II With Solutions (From old CIS 521 exam)

CIS 391 Introduction to Artificial Intelligence Practice Midterm II With Solutions (From old CIS 521 exam) Problem Points Possible 1. Perceptrons and SVMs 20 2. Probabilistic Models 20 3. Markov Models

### CHAPTER 7 GENERAL PROOF SYSTEMS

CHAPTER 7 GENERAL PROOF SYSTEMS 1 Introduction Proof systems are built to prove statements. They can be thought as an inference machine with special statements, called provable statements, or sometimes

### Cracking the Sudoku: A Deterministic Approach

Cracking the Sudoku: A Deterministic Approach David Martin Erica Cross Matt Alexander Youngstown State University Center for Undergraduate Research in Mathematics Abstract The model begins with the formulation

### Section 3 Sequences and Limits

Section 3 Sequences and Limits Definition A sequence of real numbers is an infinite ordered list a, a 2, a 3, a 4,... where, for each n N, a n is a real number. We call a n the n-th term of the sequence.

### Foundational Proof Certificates

An application of proof theory to computer science INRIA-Saclay & LIX, École Polytechnique CUSO Winter School, Proof and Computation 30 January 2013 Can we standardize, communicate, and trust formal proofs?

### Block 1 Block 3. Figure 2: A Programmable Interconnection Network

Reconfigurable Interconnect Synthesis via Quantified Boolean Satisfiability Subramanyan Siva½ Ranga Vemuri½ Willard Vanfleet¾ John Franco½ John Schlipf½ ½Department of ECECS, University of Cincinnati,

### Sudoku an alternative history

Sudoku an alternative history Peter J. Cameron p.j.cameron@qmul.ac.uk Talk to the Archimedeans, February 2007 Sudoku There s no mathematics involved. Use logic and reasoning to solve the puzzle. Instructions

### Math 115 Spring 2014 Written Homework 3 Due Wednesday, February 19

Math 11 Spring 01 Written Homework 3 Due Wednesday, February 19 Instructions: Write complete solutions on separate paper (not spiral bound). If multiple pieces of paper are used, they must be stapled with

### Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms

CSCE 310J Data Structures & Algorithms P, NP, and NP-Complete Dr. Steve Goddard goddard@cse.unl.edu CSCE 310J Data Structures & Algorithms Giving credit where credit is due:» Most of the lecture notes

### Sudoku solvers. Introduction. CS 550 Programming Languages Project Writeup

Sudoku solvers My project was to implement a sudoku solver, and within that larger goal, I implemented two versions. The first is a pure prolog implementation, while the second uses Ciao s finite domain

### Sudoku Tips & Guides as described by Neil Pomerleau on sudokusource.mabuhaynet.com

Sudoku Tips & Guides as described by Neil Pomerleau on sudokusource.mabuhaynet.com Introduction to Sudoku Contrary to what many people believe, Sudoku didn't actually originate in Japan. The game was first

### On the Fixed-Parameter Tractability of the Equivalence Test of Monotone Normal Forms

On the Fixed-Parameter Tractability of the Equivalence Test of Monotone Normal Forms Matthias Hagen Friedrich-Schiller-Universität Jena, Institut für Informatik, D 07737 Jena Abstract We consider the problem

### Overlapping Alldifferent Constraints and the Sudoku puzzle

Overlapping Alldifferent Constraints and the Sudoku puzzle F. Lardeux 3, E. Monfroy 1,2, F. Saubion 3, B. Crawford 1,4, and C. Castro 1 1 Universidad Técnica Federico Santa María, Valparaíso, Chile 2 LINA,

### Opus: University of Bath Online Publication Store http://opus.bath.ac.uk/

England, M. (2014) Formulating problems for real algebraic geometry. In: UNSPECIFIED. Link to official URL (if available): Opus: University of Bath Online Publication Store http://opus.bath.ac.uk/ This

### Exponential time algorithms for graph coloring

Exponential time algorithms for graph coloring Uriel Feige Lecture notes, March 14, 2011 1 Introduction Let [n] denote the set {1,..., k}. A k-labeling of vertices of a graph G(V, E) is a function V [k].

### Practical Guide to the Simplex Method of Linear Programming

Practical Guide to the Simplex Method of Linear Programming Marcel Oliver Revised: April, 0 The basic steps of the simplex algorithm Step : Write the linear programming problem in standard form Linear

### TECHNIQUES FOR OPTIMIZING THE RELATIONSHIP BETWEEN DATA STORAGE SPACE AND DATA RETRIEVAL TIME FOR LARGE DATABASES

Techniques For Optimizing The Relationship Between Data Storage Space And Data Retrieval Time For Large Databases TECHNIQUES FOR OPTIMIZING THE RELATIONSHIP BETWEEN DATA STORAGE SPACE AND DATA RETRIEVAL

### R u t c o r Research R e p o r t. Boolean functions with a simple certificate for CNF complexity. Ondřej Čepeka Petr Kučera b Petr Savický c

R u t c o r Research R e p o r t Boolean functions with a simple certificate for CNF complexity Ondřej Čepeka Petr Kučera b Petr Savický c RRR 2-2010, January 24, 2010 RUTCOR Rutgers Center for Operations

### A Model Checking Example

DISTRIBUTION STATEMENT A Approved for Public Release. Distribution is unlimited. Ref: LM Aero PIRA AER200910006 A Model Checking Example Solving Sudoku Using Simulink Design Verifier A BSTRACT. This paper

### PARALLELIZED SUDOKU SOLVING ALGORITHM USING OpenMP

PARALLELIZED SUDOKU SOLVING ALGORITHM USING OpenMP Sruthi Sankar CSE 633: Parallel Algorithms Spring 2014 Professor: Dr. Russ Miller Sudoku: the puzzle A standard Sudoku puzzles contains 81 grids :9 rows

### Counting, Generating, and Solving Sudoku

Counting, Generating, and Solving Sudoku Mathias Weller April 21, 2008 Abstract In this work, we give an overview of the research done so far on the topic of Sudoku grid enumeration, solving, and generating

### 1 Polyhedra and Linear Programming

CS 598CSC: Combinatorial Optimization Lecture date: January 21, 2009 Instructor: Chandra Chekuri Scribe: Sungjin Im 1 Polyhedra and Linear Programming In this lecture, we will cover some basic material

### A Working Knowledge of Computational Complexity for an Optimizer

A Working Knowledge of Computational Complexity for an Optimizer ORF 363/COS 323 Instructor: Amir Ali Ahmadi TAs: Y. Chen, G. Hall, J. Ye Fall 2014 1 Why computational complexity? What is computational