|
|
|
|
|
|
|
|
Solving Sudoku Using Combinatorica`Backtrack
|
|
|
|
|
|
Organization: | Physicist at Large Consulting |
|
|
|
|
|
|
2010-10-26
|
|
|
|
|
|
A Sudoku can be regarded as a Constraint Satisfaction Problem with 27 All-Different constraints. Two methods of solving Sudoku are described. Both start by generating the possibilities for each row which satisfy the constraints, consistent with the given values. The first method then uses the "Backtrack" function in the Combinatorica package to build the solution row by row using the constraints. The second method also builds the solution row by row, using "Outer" to find all possibilities for the partial solution and selecting out those which satisfy the constraints. One notebook (Solving ...) explains the two methods in detail. The other notebook compares the two for several test cases.
|
|
|
|
|
|
|
|
|
|
|
|
Sudoku, Combinatorica, Backtrack, Constraint Satisfaction Programming
|
|
|
|
|
|
| SolvingSudokuUsingCombinatoricaBacktrack.nb (62.8 KB) - Mathematica Notebook [for Mathematica 7.0] | | SudokuSolverFunctions.nb (37.9 KB) - Mathematica Notebook [for Mathematica 7.0] |
|
|