IDEAS home Printed from https://ideas.repec.org/a/pal/jorsoc/v65y2014i10p1602-1610.html
   My bibliography  Save this article

A comparison of several enumerative algorithms for Sudoku

Author

Listed:
  • Leandro C Coelho

    (1] CIRRELT—Interuniversity Research Center on Enterprise Networks, Logistics and Transportation, Québec, Canada[2] Université Laval, Québec, Canada)

  • Gilbert Laporte

    (1] CIRRELT—Interuniversity Research Center on Enterprise Networks, Logistics and Transportation, Québec, Canada[2] HEC Montréal, Montréal, Canada)

Abstract

Sudoku is a puzzle played of an n × n grid where n is the square of a positive integer m. The most common size is n=9. The grid is partitioned into n subgrids of size m × m. The player must place exactly one number from the set N={1, …, n} in each row and each column of as well as in each subgrid. A grid is provided with some numbers already in place, called givens. In this paper, some relationships between Sudoku and several operations research problems are presented. We model the problem by means of two mathematical programming formulations. The first one consists of an integer linear programming model, while the second one is a tighter non-linear integer programming formulation. We then describe several enumerative algorithms to solve the puzzle and compare their relative efficiencies. Two basic backtracking algorithms are first described for the general Sudoku. We then solve both formulations by means of constraint programming. Computational experiments are performed to compare the efficiency and effectiveness of the proposed algorithms. Our implementation of a backtracking algorithm can solve most benchmark instances of size 9 within 0.02 s, while no such instance was solved within that time by any other method. Our implementation is also much faster than an existing alternative algorithm.

Suggested Citation

  • Leandro C Coelho & Gilbert Laporte, 2014. "A comparison of several enumerative algorithms for Sudoku," Journal of the Operational Research Society, Palgrave Macmillan;The OR Society, vol. 65(10), pages 1602-1610, October.
  • Handle: RePEc:pal:jorsoc:v:65:y:2014:i:10:p:1602-1610
    as

    Download full text from publisher

    File URL: http://www.palgrave-journals.com/jors/journal/v65/n10/pdf/jors2013114a.pdf
    File Function: Link to full text PDF
    Download Restriction: Access to full text is restricted to subscribers.

    File URL: http://www.palgrave-journals.com/jors/journal/v65/n10/full/jors2013114a.html
    File Function: Link to full text HTML
    Download Restriction: Access to full text is restricted to subscribers.
    ---><---

    As the access to this document is restricted, you may want to search for a different version of it.

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:pal:jorsoc:v:65:y:2014:i:10:p:1602-1610. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Sonal Shukla or Springer Nature Abstracting and Indexing (email available below). General contact details of provider: http://www.palgrave-journals.com/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.