首页 | 本学科首页   官方微博 | 高级检索  
     检索      


A comparison of several enumerative algorithms for Sudoku
Authors:Leandro C Coelho  Gilbert Laporte
Institution:1.CIRRELT—Interuniversity Research Center on Enterprise Networks, Logistics and Transportation,Québec,Canada;2.Université Laval,Québec,Canada;3.HEC Montréal,Montréal,Canada
Abstract:Sudoku is a puzzle played of an n × n grid Open image in new window /></a> </span> where <em class=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 Open image in new window /></a> </span> as well as in each subgrid. A grid is provided with some numbers already in place, called <em class=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.
Keywords:
本文献已被 SpringerLink 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号