[Paper Review] Techniques for Solving Sudoku Puzzles
This paper evaluates three algorithms—backtracking, simulated annealing, and alternating projections—for solving Sudoku puzzles, demonstrating that backtracking is the most reliable and efficient for standard 9×9 puzzles, while alternating projections shows promise for harder problems due to faster convergence on difficult instances. The study highlights the trade-offs between exact and approximate methods in combinatorial optimization.
Solving Sudoku puzzles is one of the most popular pastimes in the world. Puzzles range in difficulty from easy to very challenging; the hardest puzzles tend to have the most empty cells. The current paper explains and compares three algorithms for solving Sudoku puzzles. Backtracking, simulated annealing, and alternating projections are generic methods for attacking combinatorial optimization problems. Our results favor backtracking. It infallibly solves a Sudoku puzzle or deduces that a unique solution does not exist. However, backtracking does not scale well in high-dimensional combinatorial optimization. Hence, it is useful to expose students in the mathematical sciences to the other two solution techniques in a concrete setting. Simulated annealing shares a common structure with MCMC (Markov chain Monte Carlo) and enjoys wide applicability. The method of alternating projections solves the feasibility problem in convex programming. Converting a discrete optimization problem into a continuous optimization problem opens up the possibility of handling combinatorial problems of much higher dimensionality.
Motivation & Objective
- To evaluate and compare three general-purpose algorithms—backtracking, simulated annealing, and alternating projections—for solving Sudoku puzzles.
- To assess the scalability and performance of exact versus approximate methods in combinatorial optimization using Sudoku as a test case.
- To demonstrate how these algorithms can serve as pedagogical tools for teaching computational problem-solving across mathematical sciences.
- To explore the potential of continuous optimization techniques like alternating projections for solving discrete combinatorial problems.
- To provide insights into algorithm selection based on problem difficulty and computational constraints.
Proposed method
- Backtracking systematically explores partial solutions by assigning digits to empty cells, pruning invalid branches early using constraint propagation and list cardinality ordering.
- Simulated annealing uses a stochastic search with a decreasing temperature schedule to escape local minima, modeling the process as a Markov chain Monte Carlo (MCMC) analog.
- Alternating projections reformulates the discrete Sudoku problem as a feasibility problem in convex sets, iteratively projecting onto row, column, and subgrid constraints to converge toward a solution.
- The algorithms are implemented in C (backtracking), Fortran 95 (simulated annealing and alternating projections), and tested on a diverse set of puzzles including standard and hard benchmark sets.
- Performance is evaluated using run time statistics and success rates across puzzles of varying difficulty, including the 'Top 95' hard benchmark set.
- Sudoku constraints are encoded as integer assignments with row, column, and 3×3 subgrid uniqueness requirements, forming an NP-complete satisfiability problem.
Experimental results
Research questions
- RQ1How do backtracking, simulated annealing, and alternating projections compare in solving standard and hard Sudoku puzzles in terms of success rate and runtime?
- RQ2Why does simulated annealing fail on the most challenging puzzles, and what role do local minima play in its performance degradation?
- RQ3Can the method of alternating projections outperform backtracking on very hard Sudoku instances despite being an approximate method?
- RQ4To what extent can continuous optimization techniques like alternating projections be applied to discrete combinatorial problems such as Sudoku?
- RQ5What insights can be drawn from algorithmic performance on Sudoku for broader applications in high-dimensional combinatorial optimization?
Key findings
- Backtracking successfully solved all 9×9 Sudoku puzzles tested, including the most difficult 'Top 95' benchmark set, with a mean runtime of 0.159 seconds and maximum of 0.525 seconds.
- Simulated annealing solved all but a few of the hardest pencil-and-paper puzzles, but exhibited high variance in runtime, with a maximum time of 7.204 seconds and a mean of 1.104 seconds.
- Alternating projections performed moderately on standard puzzles but showed superior performance on the hardest benchmarks, solving some instances faster than backtracking, as indicated by points below the dashed line in the scatterplot of solution times.
- A typical local minimum trapped simulated annealing in the 'Top 95' puzzles, where even one-step swaps increased constraint violations, explaining its failure on these cases.
- The alternating projection method found correct solutions to very hard puzzles more quickly than backtracking in some cases, suggesting potential for high-dimensional combinatorial problems.
- The study confirms that backtracking is the most reliable method for Sudoku, but approximate methods like alternating projections may be more scalable for larger or more complex instances.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.