Chasing First Queens by Integer Programming
The n-queens puzzle is a well-known combinatorial problem that requires to place n queens on an \(n\times n\) chessboard so that no two queens can attack each other. Since the 19th century, this problem was studied by many mathematicians and computer scientists. While finding any solution to the n-queens puzzle is rather straightforward, it is very challenging to find the lexicographically first (or smallest) feasible solution. Solutions for this type are known in the literature for \(n\le 55\), while for some larger chessboards only partial solutions are known. The present paper was motivated by the question of whether Integer Linear Programming (ILP) can be used to compute solutions for some open instances. We describe alternative ILP-based solution approaches, and show that they are indeed able to compute (sometimes in unexpectedly-short computing times) many new lexicographically optimal solutions for n ranging from 56 to 115.
Keywordsn-Queens problem Mixed-integer programming Lexicographic simplex
This research was partially supported by MiUR, Italy, through project PRIN2015 “Nonlinear and Combinatorial Aspects of Complex Networks”. We thank Donald E. Knuth for having pointed out the problem to us, and for inspiring discussions on the role of Integer Linear Programming in solving combinatorial problems arising in digital tomography.
- 1.Achterberg, T.: Constraint integer programming. Ph.D. thesis, Technische Universität Berlin (2007)Google Scholar
- 5.Bezzel, M.: Proposal of 8-Queens problem. Berl. Schachzeitung 3, 363 (1848)Google Scholar
- 7.Caprara, A., Fischetti, M.: Odd cut-sets, odd cycles, and 0–1/2 Chvatal-Gomory cuts. Ricerca Operativa 26, 51–80 (1996)Google Scholar
- 9.Gecode Team. Gecode: Generic constraint development environment (2017). http://www.gecode.org
- 12.Gomory, R.E.: An algorithm for the mixed integer problem. Technical report RM-2597, The RAND Cooperation (1960)Google Scholar
- 15.IBM. ILOG CPLEX 12.7 User’s Manual (2017)Google Scholar
- 16.Knuth, D.E.: Private communication, November 2017Google Scholar
- 17.Lionnet, F.J.E.: Question 963. Nouvelles Annales de Mathématiques 8, 560 (1869)Google Scholar
- 18.Régin, J.-C.: A filtering algorithm for constraints of difference in CSPs. In: Artificial Intelligence, vol. 1, pp. 362–367 (1994)Google Scholar
- 19.Schubert, W.: Wolfram Schubert’s N-Queens page. http://m29s20.vlinux.de/~wschub/nqueen.html. Accessed Dec 2017
- 20.Sloane, N.J.A.: The on-line encyclopedia of integer sequences (2017)Google Scholar
- 21.van Hoeve, W.F.: The alldifferent constraint: a survey. CoRR (2001)Google Scholar