Mathematica 9 is now available

Wolfram Library Archive


All Collections Articles Books Conference Proceedings
Courseware Demos MathSource Technical Notes
Title Downloads

Solving Sudoku Using Combinatorica`Backtrack
Author

Frank Kampas
Organization: Physicist at Large Consulting
Revision date

2010-10-26
Description

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.
Subjects

*Applied Mathematics > Computer Science
*Mathematica Technology > Programming > Equation Solving
*Mathematics > Discrete Mathematics > Combinatorics
Keywords

Sudoku, Combinatorica, Backtrack, Constraint Satisfaction Programming
Downloads Download Wolfram CDF Player

Download
SolvingSudokuUsingCombinatoricaBacktrack.nb (62.8 KB) - Mathematica Notebook [for Mathematica 7.0]
Download
SudokuSolverFunctions.nb (37.9 KB) - Mathematica Notebook [for Mathematica 7.0]