Journal of Heuristics

, Volume 13, Issue 4, pp 387–401 | Cite as

Metaheuristics can solve sudoku puzzles

  • Rhyd Lewis


In this paper we present, to our knowledge, the first application of a metaheuristic technique to the very popular and NP-complete puzzle known as ‘sudoku’. We see that this stochastic search-based algorithm, which uses simulated annealing, is able to complete logic-solvable puzzle-instances that feature daily in many of the UK’s national newspapers. We also introduce a new method for producing sudoku problem instances (that are not necessarily logic-solvable) and use this together with the proposed SA algorithm to try and discover for what types of instances this algorithm is best suited. Consequently we notice the presence of an ‘easy-hard-easy’ style phase-transition similar to other problems encountered in operational research.


Metaheuristics Sudoku Puzzles Phase-transition 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. Abramson, D., Krishnamoorthy, H., Dang, H.: Simulated annealing cooling schedules for the school timetabling problem. Asia-Pac. J. Oper. Res. 16, 1–22 (1996) Google Scholar
  2. Armstrong, S.: X-wing and Swordfish. Online resource. (accessed July 2005)
  3. Cheeseman, P., Kanefsky, B., Taylor, W.: Where the really hard problems are. In: Mylopoulos, J., Reiter, R. (eds.) Proceedings of IJCAI-91, pp. 331–337. Morgan Kaufmann, San Mateo (1991) Google Scholar
  4. Colbourn, C.J., Colbourn, M.J., Stinson, D.R.: The computational complexity of recognising critical sets. In: Graph Theory. Lecture Notes in Mathematics, vol. 1073, pp. 248–253. Springer, New York (1984) Google Scholar
  5. Eiben, A.E., van der Hauw, J., van Hemert, J.: Graph coloring with adaptive evolutionary algorithms. J. Heuristics 4(1), 25–46 (1998) zbMATHCrossRefGoogle Scholar
  6. Garey, M.R., Johnson, D.S.: Computers and Intractability. Freeman, San Francisco (1979) zbMATHGoogle Scholar
  7. Glover, F., Laguna, M.: Tabu search. In: Pardalos, P.M., Resende, M.G.C. (eds.) Handbook of Applied Optimization, pp. 194–208. Oxford University Press, Oxford (2002) Google Scholar
  8. Huckvale, M.: Mark huckvale—sudoku puzzles. Online resource. (accessed July 2005)
  9. Kirkpatrick, S., Gelatt, C., Vecchi, M.: Optimization by simulated annealing. Science 4598, 671–680 (1983) CrossRefGoogle Scholar
  10. Lourenco, H.R., Martin, O., Stützle, T.: Iterated local search. In: Glover, F., Kochenberger, G. (eds.) Handbook of Metaheuristics, pp. 321–353. Kluwer Academic, Norwel (2002) Google Scholar
  11. Lynce, I., Ouaknine, J.: Sudoku as a SAT problem. In: Proceedings of the 9th Symposium on Artificial Intelligence and Mathematics (2006) Google Scholar
  12. Pendlebury, P.: Can you sudoku. In: The Mail on Sunday, London, 8th May 2005. An online version is also available at (accessed July 2005)
  13. Ross, P., Corne, D., Fang, H.-L.: Improving evolutionary timetabling with delta evaluation and directed mutation. In: Davidor, Y., Schwefel, H., Reinhard, M. (eds.) Parallel Problem Solving from Nature III (PPSN). Lecture Notes in Computer Science, vol. 866, pp. 556–565. Springer, Berlin (1994) Google Scholar
  14. Ross, P., Corne, D., Terashima-Marin, H.: The phase-transition niche for evolutionary algorithms in timetabling. In: Burke, E., Ross, P. (eds.) The Practice and Theory of Automated Timetabling (PATAT). Lecture Notes in Computer Science, vol. 1153, pp. 309–325. Springer, Berlin (1996) Google Scholar
  15. Simonis, H.: Sudoku as a constraint problem. In: Hnich, B., Prosser, P., Smith, B. (eds.) Proceedings of the 4th International Workshop on Modelling and Reformulating Constraint Satisfaction Problems. pp. 13–27 (2005) Google Scholar
  16. Smith, B.: Phase transitions and the mushy region in constraint satisfaction problems. In: Cohn, A. (ed.) Proceedings of the 11th European Conference on Artificial Intelligence, pp. 100–104. Wiley, New York (1994) Google Scholar
  17. Turner, J.S.: Almost all k-colorable graphs are easy to color. J. Algorithms 9, 63–82 (1988) zbMATHCrossRefGoogle Scholar
  18. van Laarhoven, P., Aarts, E.: Simulated Annealing: Theory and Applications. Reidel, Dordrecht (1987) zbMATHGoogle Scholar
  19. Yato, T., Seta, T.: Complexity and completeness of finding another solution and its application to puzzles. IEICE Trans. Fundam. E 86-A(5), 1052–1060 (2003) Google Scholar

Copyright information

© Springer Science+Business Media, LLC 2007

Authors and Affiliations

  1. 1.Centre for Emergent Computing, School of ComputingNapier UniversityEdinburghUK

Personalised recommendations