The chaos within Sudoku - PubMed (original) (raw)
The chaos within Sudoku
Mária Ercsey-Ravasz et al. Sci Rep. 2012.
Abstract
The mathematical structure of Sudoku puzzles is akin to hard constraint satisfaction problems lying at the basis of many applications, including protein folding and the ground-state problem of glassy spin systems. Via an exact mapping of Sudoku into a deterministic, continuous-time dynamical system, here we show that the difficulty of Sudoku translates into transient chaotic behavior exhibited by this system. We also show that the escape rate κ, an invariant of transient chaos, provides a scalar measure of the puzzle's hardness that correlates well with human difficulty ratings. Accordingly, η = -log₁₀κ can be used to define a "Richter"-type scale for puzzle hardness, with easy puzzles having 0 < η ≤ 1, medium ones 1 < η ≤ 2, hard with 2 < η ≤ 3 and ultra-hard with η > 3. To our best knowledge, there are no known puzzles with η > 4.
Figures
Figure 1. Sudoku and its boolean representation.
(a) a typical puzzle with bold digits as clues (givens). (b) Setup of the boolean representation in a 9 × 9 × 9 grid. (c) Layer _L_4 of the puzzle (the one containing the digit 4) with 1-s in the location of the clues and the regions blocked out for digit 4 by the presence of the clues (shaded area).
Figure 2. Solving Sudoku puzzles with the deterministic continuous-time solver (2–3).
(a) presents an easy puzzle with the evolution of the continuous-time dynamics shown within a 3 × 3 grid (rows 4–6, columns 7–9). (b) shows the same, but for a known, ultra-hard puzzle called “Platinum Blonde”. The trajectories in the right panels show the evolution of the analog variables
colored by the corresponding digit a. Thus for each cell (i, j) we have 9 such running trajectories, but they cannot always be discerned as many of them are running on top of each other, close to -1, as seen in (a).
Figure 3. Puzzle hardness as chaotic dynamics.
We color the points of a 103 × 103 grid in an arbitrary plane (_s_1, _s_2) at time instant t according to the digit Dpq the solver is considering in an arbitrary but fixed cell (p, q) at that instant, given that we started the trajectory of the CTDS from those grid-points. For these initial conditions only the points in the (_s_1, _s_2) plane were varied, all other spin values were kept fixed at the same randomly chosen values. For the same easy problem as in Fig. 2, and for (p, q) = (1, 1) (top row of panels) almost all initial conditions in this plane involve only two digits, and after t = 20 the corresponding trajectories have converged to the solution digit (9, light blue), except for a thin line, which, however, will also become light blue. The bottom row of panels shows the same for the hard problem of Fig. 2 based on what happens in the cell (p, q) = (6, 8). The strong sensitivity to initial conditions appears as fractal structures of increasing complexity as time goes on, before eventually everything converges to the same color/digit (dark blue, corresponding to digit 4, not shown).
Figure 4. Escape rate as hardness indicator.
(a) shows the distribution in log-linear scale of the fraction p(t) of 104 randomly started trajectories of (2–3) that have not yet found a solution by analog time t for a number of Sudoku puzzles taken from the literature (see legend and text) with a wide range of human difficulty ratings. The escape rate is obtained from the best fit to the tail of the distributions. (b) is a magnification of (a) for hard puzzles. (c) and (d) show the escape rate κ in semilog scale vs the number of clues d and constraint density α indicating good correlations with human ratings (color bands). (e) shows the relationship between the number of clues d and α for the puzzles considered.
References
- Rosenhouse J. & Taalman L. Taking Sudoku Seriously: The Math Behind the World's most Popular Pencil Puzzle (Oxford University Press, New York, 2011).
- Garey M. R. & Johnson D. S. Computers and Intractability: A Guide to the Theory of NP-Completeness (W. H. Freeman & Co., New York, NY, USA, 1990).
- Karp R. M. Reducibility among combinatorial problems. In Complexity of Computer Computations., R.E. Miller and J.W. Thatcher (editors). Proc. of a Symp. on the Complexity of Computer Computations. (New York: Plenum. pp. 85–103, 1972).
- Yato T. & Seta T. Complexity and completeness of finding another solution and its application to puzzles. IEICE Trans. Fundamentals E86-A(5), 1052–1060 (2003).
- Fortnow L. The status of the P versus NP problem. Commun. ACM 52, 78–86 (2009).
Publication types
MeSH terms
LinkOut - more resources
Full Text Sources
Research Materials
Miscellaneous