Font Size: a A A

Research On Solving Sudoku Problem Based On Constraint Programming

Posted on:2020-02-15Degree:MasterType:Thesis
Country:ChinaCandidate:MOHAMMED ABDO MOHAMMED HAMIDHFull Text:PDF
GTID:2428330575477672Subject:Computer software and theory
Abstract/Summary:PDF Full Text Request
Sudoku is an infamous logic-based puzzle as is famous including puzzle fanatics the world over.From a computational perspective,Sudoku is also a problem up to expectation belongs to the set of NP-complete problems,implying to that amount we can't wish in imitation of finding a polynomial bounded algorithm for solving the problem into the general.Constraint Programming(CP)is a strong illustration for modeling and fixing Complex Combinatorial Problems(generally issued out of Decision Making).Constraint programming has ultimately reached the masses,lots of magazine readers(especially within the UK)are solving them everyday obedience problem.They appeal complicated propagation schemes with names kind of “X-Wing” and “Swordfish”according to locate options of an instead easy looking puzzle referred to as Sudoku.Unfortunately,it is no longer conscious up to expectation it is constraint programming.In this paper,we attempt in conformity with recognizing the puzzle beyond a constraint factor about the view,exhibit models to solve then create puzzles then relinquish a goal dimension on the challenge about a puzzle instance.This measurement seems after correlate nicely together with grades(e.g.effortless to hard)to that amount are assigned to trouble instances because of the common public.We also exhibit how the model performs stand reinforced including redundant constraints and whether it may stay carried out the use of bipartite matching then flow algorithms.On the theoretical side,Yato has established therefore a great deal Sudoku is NP-Complete by way about bargain out of the Latin Square(Yato 2003).Simonis(2005)studied a number of models touching the constraints among the primary 9×9 Sudoku puzzle and their related propagation algorithms(often primarily based absolutely upon discovery matchings into bipartite graphs).He,in contrast,their ability in accordance in imitation of explicit up puzzles on a range of difficulties.Our strategy differs beyond Simonis' s among over to hope we hinder ourselves between imitation with the near vital model regarding the constraints then makes usage about solely the close to frequent discipline procreation algorithms(a subset regarding this historic by way of Simonis).Unlike Simonis,we umbilical point on the interactive factors related to the game,and undergo designed a‘hint' functionality on according to desire use constraint technology mechanisms inregard to increasing complexity afterward guide the human game enthusiasts since educating in conformity with to them among enjoying the game.Sudoku is a famous puzzle on according to hope appears repeatedly into a range regarding newspapers,books,and befuddle magazines worldwide.Although constructed of the United States of the advanced 1970 s,such ancient according to remain without a doubt in Japan within the Eighties,therefore,a great deal the beat obtained mainstream popularity.It was once as soon as additionally appropriate right here where certain used to be devoted the fame “Sudoku",who utter remain loosely translated on European particularly “solitary number”.In its simplest type,Sudoku will be outlined as follows.Given AN n2_n2 grid divided into n2 distinct n * n boxes(denoted by the daring lines in fig.1),the aim is to fill the grid so 3 separate criteria square measure met:1.Every row of cells contains the integers one through to n2 precisely once;2.Every column of cells contains the integers one through to n2 precisely once;3.Every n * n box contains the integers one through to n2 precisely once.This thesis in the introduction talked about Sudoku puzzle history and how Constraint Programming deal with its problems.The second part briefly explain about Constraint Satisfaction Problems(CSPs)that have been tackled by a dizzying array of methods,from automata theory to ant colony optimization algorithm,and are a topic of interest in many fields of computer science and beyond.These connections immeasurably enhance the richness of subject,but are largely beyond the scope of this chapter.Here we will focus on the basic methods involved in the establishment of constraint satisfaction as a branch of artificial intelligence.After that talked about Backtracking,backtrack is the fundamental ‘complete' search method for constraint satisfaction problems,in the sense that one is guaranteed to find a solution if one exists.Even in 1965,Golomb and Baumert,in a JACM paper simply entitled “Backtrack programming”,were able to observe that the method had already been independently ‘discovered' many times.Over the last ten years,Constraint Programming(CP)emerged as an interesting and viable approach to programming.In this approach,the programming process is limited to a generation of requirements("constraints")and a solution to these requirements by means of general and domain-specific methods.The techniques useful for finding solutions to sets of constraints were studied for some twenty years in the field of Constraint Satisfaction.Oneof the most important of them is constraint propagation,a process of reducing a constraint satisfaction problem to another one that is equivalent but "simpler".In the third part talking about Sudoku Problems as CSP,Sudoku is a puzzle played on a partially filled 9x9 grid.The task is to complete the assignment using numbers from1 to 9 such that the entries in each row,each column,and each major 3x3 block are pairwise different.Like for many logical puzzles,the challenge in Sudoku does not just lie in finding a solution.Well posed puzzles have a unique solution and the task is to find it without guessing,i.e.without search.In this search compare a number of propagation schemes on how many problem instances they can solve by constraint propagation alone.The basic Sudoku problem can stand modeled with constraint programming by way of a mixture about all different constraints.In the fourth part talking about an Interactive Solving Sudoku Problems using CP,the Sudoku Puzzle,at the beginning named Number Place,used to be manufactured by using Howard Garns within 1979,and originally appeared in the Dell Pencil Puzzles and Word Games magazine.Nikoli began publishing Sudoku Puzzles in 1986 and introduced the Sudoku name,trademarked in Japan.More recently,newspapers across the United States have begun publishing puzzles daily.The game has become immensely popular and many web sites are devoted to this puzzle.Several programs have been developed and released on the Internet that allows users to solve Sudoku puzzles.These implementations vary widely.Some programs provide no support to the player.Others offer suggestions using a set of rules loosely based on logic.Finally,others resort to backtrack search when their rules are not able to solve the puzzle.Those rules are often‘tricks' resulting from generalizing observations made while solving puzzles.Many variations of the Sudoku puzzle exist.While we plan to extend our interfaces to handle about 10 puzzle variations,our current implementation handles only the basic puzzle.This puzzle is a 9×9 grid,where some cells in the grid are filled with numbers in [1..9].The task is to complete the grid by placing a number from 1 to 9 in each of the empty cells while ensuring that a number appears exactly once in every column,row,or the nine3×3 ‘blocks' that form the grid.A well-posed Sudoku has exactly one solution(Simonis2005).In the fifth part create a Sudoku solver;the Program is intended to demonstrate how to use a backtracking algorithm to solve a Sudoku puzzle.It is not really a lesson on using Visual Basic.It's just that Visual Basic has chosen as a platform to use as it is quite straight forward to create a Windows application on.While knowledge of Visual Basic is not necessary.An understanding of object orientated programming is also advisable.The survey describes different consistency methods for the all different constraint.We combine them with some of the redundant constraints above to create the propagation schemes in the table.In the propagation schemes,it exist that in our evaluation we haven't found an example to differentiate the two schemes.We decided to test our programs on different sets of published puzzle instances.In the UK,several newspapers print their daily Sudoku puzzle and have published collections of these.We use sets from “The Times”,“The Daily Telegraph”,“The Guardian”,“The Independent”,“The Daily Mail”and “The Sun”.There are also magazines which specialize in Sudoku puzzles,of particular note is the Japanese puzzle publisher Nikoli,whose puzzles also appear in the UK.In addition,there are books of puzzle instances.Usually,each instance is given a problem difficulty by the puzzle designer.In discussion boards,people often complain about the arbitrary way this difficulty is assigned.In addition,we have found collections of 450 and 7611 puzzles which have only 17 presets,the currently smallest known number of presets for well-posed problems.These are not classified by difficulty.The collection contains mainly very hard problems.The programs seem to be working quite well in finding solutions without search,except for the “tough” and “diabolical” puzzles from 2 and those from 17.These puzzles require either more powerful reasoning,or some form of search.Testing values with a shaving step work very well on these examples.We can see that all problems can be solved by using shaving techniques combined with hyper arc-consistency,and nearly all by combining bound-consistency with shaving.Using only forward checking together with shaving works well as long as enough presets are given.On the minimal problems it nearly always fails to find solutions.We were also interested in the published puzzles were locally minimal,i.e.did not contain redundant hints.This paper shows the results on some tests.Most of the published puzzles are not locally minimal,they often contain more than 10 redundant hints which can be removed without losing the uniqueness of the solution.The instances 15,16 in the paper are an exception,they were collected to be locally minimal.Most of the hard puzzles from instance17 are also minimal.We computed this reduction with a simple,committed choice program.We search for a hint that can be eliminated;if one is found,we commit to this choice and try to find additional redundant hints.The method does not guarantee minimality of the reduction but leads to locally minimal instances.We have seen that with different variants of our model we can solve puzzle instances of varying difficulty.Can we use the same techniques to generate puzzles as well? This approach can either generate well posed locally minimal problems or can be used to find search-free puzzles of a given difficulty grade that cannot be further reduced without losing the search free property.This bottom-up problem generation has been used in “Generating satisfiable problem instances.In: AAAI-2000” to generate solvable problem instances of quasi-group completion for CSP or SAT solvers.In that case,one starts with a completed quasi-group,removes a number of values from the grid,and is left with a feasible quasi-group completion problem.The generated problem may have multiple solutions,but that is acceptable in the given context.As we are interested in well-posed problems,we have to make the removal steps one by one as long as the solution stays unique.
Keywords/Search Tags:Sudoku, CP, CSP, Backtracking, Sudoku Solver
PDF Full Text Request
Related items