intelligent sudoku solver

Download Intelligent Sudoku Solver

If you can't read please download the document

Upload: amrish-jhaveri

Post on 16-Apr-2017

4.255 views

Category:

Technology


4 download

TRANSCRIPT

INTELLIGENT SUDOKU SOLVER

INTELLIGENT SUDOKU SOLVERUnder the Guidance ofDr. SUNIL PATEKARGroup Members:Amrish JhaveriRohit IyerKrutika ParabUNIVERSITY OF MUMBAI2012-2013

CONTENTSINTRODUCTIONAIMS & OBJECTIVESPROBLEM STATEMENTSCOPEPROPOSED SYSTEMMETHODOLOGY Expert SystemBACKTRACKING ALGORITHMPATTERNSDESIGN Flow Chart

2INTELLIGENT SUDOKU SOLVERFEATURESCODE SNIPPETS

INTRODUCTIONRule:Fill a given grid(9x9) with the numbers 1 to 9, so that every column, row, and 3x3 box the numbers 1 to 9, keeping in mind that the same number doesnt repeat in that particular row, column or the 3x3 box.

3INTELLIGENT SUDOKU SOLVER

AIMS & OBJECTIVES

To successfully implement a novel approach to solve computationally intensive problems like Sudoku. To solve the classical Sudoku puzzle in a much more efficient way than a conventional Brute Force and Backtracking approach. 4INTELLIGENT SUDOKU SOLVER

PROBLEM STATEMENTOur job is to place a number into every empty box so that each row across, each column down, and each small 9-box square within the large square (there are 9 of these) will contain each number from 1 through 9. Remember that no number may appear more than once in any row across, any column down, or within any small 9-box square. The numbers will be filled with the help of pattern matching. 5INTELLIGENT SUDOKU SOLVER

5

SCOPEOur project aims at solving Sudoku using pattern matching. Assumptions: Fixed Grid Size: 9 x 9 Fixed Symbols: 1-9 Limitations on the number of patterns implemented.

6INTELLIGENT SUDOKU SOLVER

PROPOSED SYSTEMOur project uses five main modules:Reading the input from file.Search for patterns.Provide solution.Solve by Backtracking.Compare the run-time.7INTELLIGENT SUDOKU SOLVER

EXPERT SYSTEMIn Artificial Intelligence, an Expert System is a computer system that emulates the decision-making ability of a human expert.It consists of a rule-base (permanent data), an inference engine (process), and a workspace or working memory (temporary data). Not part of the basic reasoning process, but essential to applications, is the user interface. 8INTELLIGENT SUDOKU SOLVER

8

EXPERT SYSTEM

9INTELLIGENT SUDOKU SOLVER

EXPERT SYSTEMIn our approach the components of expert system are as follows: Client interface is a command line interface or GUI. Knowledge base are set of data structures stored which contain prior information needed to proceed. Rule translator is a function which translates the rule from human understandable form to machine understandable form. For e.g. A function called HiddenSingles() may translate the rule in such a way that the Rule Engine (in our case our main program)understands. Knowledge base editor would be a simple text editor which can change/add the built-in rules in the code. Rule Engine is another function which checks every pattern if it matches a rule or not.10INTELLIGENT SUDOKU SOLVER

BACKTRACKING ALGORITHMWe basically check that the same number is not present in current row, current column and current 3X3 sub grid. After checking for safety, we assign the number, and recursively check whether this assignment leads to a solution or not. If the assignment doesnt lead to a solution, then we try next number for current empty cell. And if none of number (1 to 9) lead to solution, we return false. 11INTELLIGENT SUDOKU SOLVER

PATTERNS NAKED SINGLE Any cells which have only one candidate can safely be assigned that value.It is very important whenever a value is assigned to a cell, that this value is also excluded as a candidate from all other blank cells sharing the same row, column and box

12INTELLIGENT SUDOKU SOLVER

NAKED SINGLE

13INTELLIGENT SUDOKU SOLVER PATTERNS

NAKED PAIRA Naked Pair (also known as a Conjugate Pair) is a set of two candidate numbers sited in two cells that belong to at least one unit in common. That is they reside in the same row, box or column.14INTELLIGENT SUDOKU SOLVER PATTERNS

PATTERNS NAKED PAIR15INTELLIGENT SUDOKU SOLVER

HIDDEN SINGLE Very frequently, there is only one candidate for a given row, column or box, but it is hidden among other candidates.

In the example on the right, the candidate 6 is only found in the middle right cell of the 3x3 box. Since every box must have a 6, this cell must be that 6.16INTELLIGENT SUDOKU SOLVER PATTERNS

Locked Candidates -I

Sometimes a candidate within a box is restricted to one row or column. Since one of these cells must contain that specific candidate, the candidate can safely be excluded from the remaining cells in that row or column outside of the box. PATTERNS INTELLIGENT SUDOKU SOLVER

17

Locked Candidates I Example

In the example above, the right box only has candidate 2's in its bottom row. Since, one of those cells must be a 2, no cells in that row outside that box can be a 2. Therefore 2 can be excluded as a candidate from the highlighted cells. PATTERNS INTELLIGENT SUDOKU SOLVER

18

Locked Candidates II

Sometimes a candidate within a row or column is restricted to one box. Since one of these cells must contain that specific candidate, the candidate can safely be excluded from the remaining cells in the box. PATTERNS INTELLIGENT SUDOKU SOLVER

19

Locked Candidates II Example

In the example on the right, the left column has candidate 9's only in the middle box. Therefore, since one of these cells must be a 9 (otherwise the column would be without a 9), 9's can safely be excluded from all cells in this middle box except those in the left column. PATTERNS INTELLIGENT SUDOKU SOLVER

20

DESIGN (FLOW CHART)

21INTELLIGENT SUDOKU SOLVER

FEATURESA Java based Sudoku SolverBenchmarked at solving 49151 random puzzles within 16159 milliseconds.Used optimized pattern detection strategies like Naked Singles, Hidden Singles and Locked Candidates to aid solving.Reviewed the performance of our solver with existing Sudoku Solvers in the world.Comprehensive statistical and graphical results to record the solver's performance using JFreeChart API.

INTELLIGENT SUDOKU SOLVER

Our SOLver solved it in 6.85 seconds!!! (6th)We conducted a test on some of the worlds popular and fastest Sudoku solvers.

The test consisted of solving 1000 very hard puzzles.

We fed the same set of 1000 puzzles to all solvers and result is here.INTELLIGENT SUDOKU SOLVER

OUR OPPONENT.

a puzzle took 15.5 billion nanoseconds!!!INTELLIGENT SUDOKU SOLVER

OUR INTELLIGENT SOLVER.

a puzzle took 25 million nanoseconds!!!INTELLIGENT SUDOKU SOLVER

NO COMPARISON!!!

cant compare millions with billions!!!INTELLIGENT SUDOKU SOLVER

NO COMPARISON!!! cant compare millions with billions!!!

INTELLIGENT SUDOKU SOLVER

Code SnippetsINTELLIGENT SUDOKU SOLVER28NAKED SINGLE

INTELLIGENT SUDOKU SOLVER

Code SnippetsINTELLIGENT SUDOKU SOLVER30NAKED PAIR

Code SnippetsINTELLIGENT SUDOKU SOLVER32HIDDEN SINGLE

Our paper titled - 'A Review on Sudoku Solving using Patterns' has been reviewed and accepted by International Journal of Scientific Research and Publications and will be published in Volume 3, Issue 5, May 2013.

INTELLIGENT SUDOKU SOLVER

THANK YOUWe would like to thank our project guide Dr. Sunil Patekar & Prof Mahesh Bhave for helping us identify the flaws and correcting them. We would also like to thank Assistant Professors Rugved Deolekar and Aman Mahadeshwar for their inputs.35INTELLIGENT SUDOKU SOLVER