{"type":"ScholarlyArticle","title":"Complexity of n-Queens Completion (Extended Abstract)","authors":[{"name":"Ian P. Gent","slug":"ian-p-gent","given":"Ian P.","family":"Gent","affiliation":"School of Computer Science , University of St Andrews , Fife KY16 9SX , UK"},{"name":"Christopher Jefferson","slug":"christopher-jefferson","given":"Christopher","family":"Jefferson","affiliation":"School of Computer Science , University of St Andrews , Fife KY16 9SX , UK"},{"name":"Peter Nightingale","slug":"peter-nightingale","given":"Peter","family":"Nightingale","affiliation":"School of Computer Science , University of St Andrews , Fife KY16 9SX , UK"}],"abstract":"The n-Queens problem is to place n chess queens on an n by n chessboard so that no two queens are on the same row, column or diagonal. The n-Queens Completion problem is a variant, dating to 1850, in which some queens are already placed and the solver is asked to place the rest, if possible. We  show that n-Queens Completion is both NP-Complete and #P-Complete. A corollary is that any non-attacking arrangement of queens can be included as a part of a solution to a larger n-Queens problem. We introduce generators of random instances for n-Queens Completion and the closely related Blocked n-Queens and Excluded Diagonals Problem. We describe three solvers for these problems, and empirically analyse the hardness of randomly generated instances. For Blocked n-Queens and the Excluded Diagonals Problem, we show the existence of a phase transition associated with hard instances as has been seen in other NP-Complete problems, but a natural generator for  n-Queens Completion did not generate consistently hard instances. The significance of this work is that the n-Queens problem has been very widely used as a benchmark in Artificial Intelligence, but conclusions on it are often disputable  because of the simple complexity of the decision problem. Our results give alternative benchmarks which are hard theoretically and empirically, but for which solving techniques designed for n-Queens need minimal or no change.","doi":"10.24963/ijcai.2018/794","url":"https://ijcai.org/proceedings/2018/794","pdf":"https://ijcai.org/proceedings/2018/0794.pdf","markdown":"https://ijcai.org/proceedings/2018/794.md","bibtex":"https://ijcai.org/proceedings/2018/bibtex/794","volume":{"slug":"2018","title":"Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence","short_title":"IJCAI 2018","url":"https://ijcai.org/proceedings/2018/","year":2018,"location":"Stockholm","dates":"13-19 July 2018","editors":"Jérôme Lang","isbn":"978-0-9992411-2-7","publisher":"International Joint Conferences on Artificial Intelligence Organization","doi_prefix":"10.24963/ijcai.2018"},"section":"Journal track","track":"Journal track","number":794,"pages":{"first":5608,"last":5611},"keywords":["Constraints and SAT: SAT","Constraints and SAT: Constraint Satisfaction"],"videos":[],"references":[{"position":1,"raw":"[Bell and Stevens, 2009] Jordan Bell and Brett Stevens. A survey of known results and research areas for n-queens. Discrete Mathematics, 309(1):1 -31, 2009.","title":"Jordan Bell and Brett Stevens. A survey of known results and research areas for n-queens","authors":"Stevens Bell","year":"2009","venue":"Discrete Mathematics","doi":null,"url":null,"internal_url":null},{"position":2,"raw":"[Bernhardsson, 1991] Bo Bernhardsson. Explicit solutions to the n-queens problem for all n. SIGART Bulletin, 2(2):7, 1991.","title":"Explicit solutions to the n-queens problem for all n","authors":"Bo Bernhardsson","year":"1991","venue":"SIGART Bulletin","doi":null,"url":null,"internal_url":null},{"position":3,"raw":"[Bezzel, 1848] Max Bezzel. Schachfreund. Berliner Schachzeitung, 3:363, 1848. Cited in [Campbell, 1977].","title":"Max Bezzel. Schachfreund","authors":"Bezzel","year":"1848","venue":"Berliner Schachzeitung","doi":null,"url":null,"internal_url":null},{"position":4,"raw":"[Bitner and Reingold, 1975] James R. Bitner and Edward M. Reingold. Backtrack programming techniques. Communi- cations of the ACM, 18(11):651-656, 1975.","title":"Backtrack programming techniques","authors":"James R Bitner, Edward M Reingold","year":"1975","venue":"Communications of the ACM","doi":null,"url":null,"internal_url":null},{"position":5,"raw":"[Cadoli and Schaerf, 2006] Marco Cadoli and Marco Schaerf. Partial solutions with unique completion. In Oliviero Stock and Marco Schaerf, editors, Reasoning, Action and Interaction in AI Theories and Systems, Essays Dedicated to Luigia Carlucci Aiello, volume 4155 of Lecture Notes in Computer Science, pages 101-115. Springer, 2006.","title":"Marco Cadoli and Marco Schaerf. Partial solutions with unique completion","authors":"Schaerf Cadoli","year":"2006","venue":"Reasoning, Action and Interaction in AI Theories and Systems, Essays Dedicated to Luigia Carlucci Aiello","doi":null,"url":null,"internal_url":null},{"position":6,"raw":"[Campbell, 1977] Paul J. Campbell. Gauss and the eight queens problem: A study in miniature of the propagation of historical error. Historia Mathematica, 4(4):397 -404, 1977.","title":"Gauss and the eight queens problem: A study in miniature of the propagation of historical error","authors":"J Paul, Campbell","year":"1977","venue":"Historia Mathematica","doi":null,"url":null,"internal_url":null},{"position":7,"raw":"[Chaiken et al., 2015] Seth Chaiken, ChristopherR.H. Hanusa, and Thomas Zaslavsky. A q-queens problem. ii. the square board. Journal of Algebraic Combinatorics, 41(3):619-642, 2015.","title":"A q-queens problem. ii. the square board","authors":"Christopherr H Seth Chaiken, Thomas Hanusa, Zaslavsky","year":"2015","venue":"Journal of Algebraic Combinatorics","doi":null,"url":null,"internal_url":null},{"position":8,"raw":"[Colbourn, 1984] Charles J. Colbourn. The complexity of completing partial latin squares. Discrete Applied Mathe- matics, 8:25-30, 1984.","title":"The complexity of completing partial latin squares","authors":"Charles J Colbourn","year":"1984","venue":"Discrete Applied Mathematics","doi":null,"url":null,"internal_url":null},{"position":9,"raw":"[Crawford et al., 1996] James M. Crawford, Matthew L. Ginsberg, Eugene M. Luks, and Amitabha Roy. Symmetry-breaking predicates for search problems. In Luigia Carlucci Aiello, Jon Doyle, and Stuart C. Shapiro, editors, Proceedings of the Fifth International Conference on Principles of Knowledge Representation and Reason- ing (KR'96), Cambridge, Massachusetts, USA, November 5-8, 1996., pages 148-159.","title":"Symmetry-breaking predicates for search problems","authors":"James M Crawford, Matthew L Ginsberg, Eugene M Luks, Amitabha Roy","year":"1996","venue":"Proceedings of the Fifth International Conference on Principles of Knowledge Representation and Reasoning (KR'96)","doi":null,"url":null,"internal_url":null},{"position":10,"raw":"Morgan Kaufmann, 1996.","title":null,"authors":"Morgan Kaufmann","year":"1996","venue":null,"doi":null,"url":null,"internal_url":null},{"position":11,"raw":"[Demaine and Hearn, 2009] Erik D Demaine and Robert A Hearn. Playing games with algorithms: algorithmic com- binatorial game theory. In Games of No Chance 3, pages 3-56. Cambridge University Press, 2009.","title":"Playing games with algorithms: algorithmic combinatorial game theory","authors":"Hearn ; ] Demaine, D Erik, Robert A Demaine, Hearn","year":"2009","venue":"Games of No Chance","doi":null,"url":null,"internal_url":null},{"position":12,"raw":"[Erickson, 2014] Jeff Erickson. Complexity of n-queens-completion? Theoretical Com- puter Science Stack Exchange, December 2014. URL:http://cstheory.stackexchange.com/q/28002 (ver- sion: 2014-12-29).","title":"Complexity of n-queens-completion? Theoretical Computer Science Stack Exchange","authors":"Jeff Erickson","year":"2014","venue":null,"doi":null,"url":"http://cstheory.stackexchange.com/q/28002(ver-sion:2014-12-29)","internal_url":null},{"position":13,"raw":"[Fraenkel and Lichtenstein, 1981] Aviezri S Fraenkel and David Lichtenstein. Computing a perfect strategy for n×n chess requires time exponential in n. Journal of Combina- torial Theory, Series A, 31(2):199 -214, 1981.","title":"Computing a perfect strategy for n×n chess requires time exponential in n","authors":"Lichtenstein ; Fraenkel, S Aviezri, David Fraenkel, Lichtenstein","year":"1981","venue":"Journal of Combinatorial Theory, Series A","doi":null,"url":null,"internal_url":null},{"position":14,"raw":"[Gent et al., 2007] Ian P. Gent, Christopher Jefferson, Tom Kelsey, Inês Lynce, Ian Miguel, Peter Nightingale, Bar- bara M. Smith, and Armagan Tarim. Search in the patience game 'Black Hole'. AI Communications, 20(3):211-226, 2007.","title":"Search in the patience game 'Black Hole","authors":"Ian P Gent, Christopher Jefferson, Tom Kelsey, Inês Lynce, Ian Miguel, Peter Nightingale, Barbara M Smith, Armagan Tarim","year":"2007","venue":"AI Communications","doi":null,"url":null,"internal_url":null},{"position":15,"raw":"[Gent et al., 2017] Ian P. Gent, Christopher Jefferson, and Peter Nightingale. Complexity of n-queens completion. Journal of Artificial Intelligence Research, 59:815-848, 2017.","title":"Complexity of n-queens completion","authors":"Ian P Gent, Christopher Jefferson, Peter Nightingale","year":"2017","venue":"Journal of Artificial Intelligence Research","doi":null,"url":null,"internal_url":null},{"position":16,"raw":"[Golomb and Baumert, 1965] Solomon W. Golomb and Leonard D. Baumert. Backtrack programming. Journal of the ACM, 12(4):516-524, 1965.","title":"Backtrack programming","authors":"Baumert ; ] Golomb, W Solomon, Leonard D Golomb, Baumert","year":"1965","venue":"Journal of the ACM","doi":null,"url":null,"internal_url":null},{"position":17,"raw":"[Gomes and Selman, 1997] Carla P. Gomes and Bart Sel- man. Problem structure in the presence of perturbations. In Proceedings of the Fourteenth National Conference on Artificial Intelligence (AAAI 97), pages 221-226, 1997.","title":"Problem structure in the presence of perturbations","authors":"Carla P Gomes, Bart Selman","year":"1997","venue":"Proceedings of the Fourteenth National Conference on Artificial Intelligence (AAAI 97)","doi":null,"url":null,"internal_url":null},{"position":18,"raw":"[Gu, 1991] Jun Gu. On a general framework for large-scale constraint-based optimization. SIGART Bulletin, 2(2):8, 1991.","title":"On a general framework for large-scale constraint-based optimization","authors":"Jun Gu","year":"1991","venue":"SIGART Bulletin","doi":null,"url":null,"internal_url":null},{"position":19,"raw":"[Guala et al., 2014] Luciano Guala, Stefano Leucci, and Emanuele Natale. Bejeweled, Candy Crush and other match-three games are (NP-) hard. In 2014 IEEE Con- ference on Computational Intelligence and Games, 2014.","title":"Bejeweled, Candy Crush and other match-three games are (NP-) hard","authors":"Luciano Guala, Stefano Leucci, Emanuele Natale","year":"2014","venue":"IEEE Conference on Computational Intelligence and Games","doi":null,"url":null,"internal_url":null},{"position":20,"raw":"[Helmert, 2003] Malte Helmert. Complexity results for stan- dard benchmark domains in planning. Artificial Intelli- gence, 143(2):219-262, 2003.","title":"Complexity results for standard benchmark domains in planning","authors":"Malte Helmert, Helmert","year":"2003","venue":"Artificial Intelligence","doi":null,"url":null,"internal_url":null},{"position":21,"raw":"[Hsiang et al., 2004] Jieh Hsiang, D.Frank Hsu, and Yuh- Pyng Shieh. On the hardness of counting problems of complete mappings. Discrete Mathematics, 277(1-3):87 -100, 2004.","title":"On the hardness of counting problems of complete mappings","authors":"Jieh Hsiang, D Frank Hsu, Yuh-Pyng Shieh","year":"2004","venue":"Discrete Mathematics","doi":null,"url":null,"internal_url":null},{"position":22,"raw":"[Johnson, 1991] W. Lewis Johnson. Letter from the editor. SIGART Bulletin, 2(2):1, 1991.","title":"Letter from the editor","authors":"W, Lewis Johnson","year":"1991","venue":"SIGART Bulletin","doi":null,"url":null,"internal_url":null},{"position":23,"raw":"[Kaye, 2000] Richard Kaye. Minesweeper is NP-complete. The Mathematical Intelligencer, 22(2):9-15, 2000.","title":"Minesweeper is NP-complete","authors":"Richard Kaye","year":"2000","venue":"The Mathematical Intelligencer","doi":null,"url":null,"internal_url":null},{"position":24,"raw":"[Kendall et al., 2008] Graham Kendall, Andrew J. Parkes, and Kristian Spoerer. A survey of NP-complete puzzles. ICGA Journal, 31(1):13-34, 2008.","title":"A survey of NP-complete puzzles","authors":"Graham Kendall, Andrew J Parkes, Kristian Spoerer","year":"2008","venue":"ICGA Journal","doi":null,"url":null,"internal_url":null},{"position":25,"raw":"[Longpré and McKenzie, 2009] Luc Longpré and Pierre McKenzie. The complexity of solitaire. Theoretical Com- puter Science, 410(50):5252-5260, November 2009.","title":"The complexity of solitaire","authors":"Mckenzie ; Longpré, Luc Longpré, Pierre Mckenzie","year":"2009","venue":"Theoretical Computer Science","doi":null,"url":null,"internal_url":null},{"position":26,"raw":"[Mackworth and Freuder, 1985] Alan K. Mackworth and Eugene C. Freuder. The complexity of some polynomial network consistency algorithms for constraint satisfaction problems. Artificial Intelligence, 25(1):65-74, 1985.","title":"The complexity of some polynomial network consistency algorithms for constraint satisfaction problems","authors":"Alan K Mackworth, Eugene C Freuder","year":"1985","venue":"Artificial Intelligence","doi":null,"url":null,"internal_url":null},{"position":27,"raw":"[Mandziuk, 1995] Jacek Mandziuk. Solving the n-queens problem with a binary Hopfield-type network. syn- chronous and asynchronous model. Biological Cybernet- ics, 72(5):439-446, 1995.","title":"Solving the n-queens problem with a binary Hopfield-type network. synchronous and asynchronous model","authors":"Jacek Mandziuk","year":"1995","venue":"Biological Cybernetics","doi":null,"url":null,"internal_url":null},{"position":28,"raw":"[Martin, 2007] Barnaby Martin. On the complexity of a derivative chess problem. CoRR, arXiv:cs/0701049 [cs.CC], 2007.","title":"On the complexity of a derivative chess problem","authors":"Barnaby Martin","year":"2007","venue":null,"doi":null,"url":null,"internal_url":null},{"position":29,"raw":"[Martinjak and Golub, 2007] I. Martinjak and M. Golub. Comparison of heuristic algorithms for the n-queen prob- lem. In 2007 29th International Conference on Informa- tion Technology Interfaces, pages 759-764, June 2007.","title":"Comparison of heuristic algorithms for the n-queen problem","authors":"Golub Martinjak, I Martinjak, M Golub","year":"2007","venue":"29th International Conference on Information Technology Interfaces","doi":null,"url":null,"internal_url":null},{"position":30,"raw":"[Minton et al., 1992] Steven Minton, Mark D. Johnston, An- drew B. Philips, and Philip Laird. Minimizing conflicts: A heuristic repair method for constraint satisfaction and scheduling problems. Artificial Intelligence, 58(1-3):161- 205, 1992.","title":"Minimizing conflicts: A heuristic repair method for constraint satisfaction and scheduling problems","authors":"Steven Minton, Mark D Johnston, Andrew B Philips, Philip Laird","year":"1992","venue":"Artificial Intelligence","doi":null,"url":null,"internal_url":null},{"position":31,"raw":"[Nakaguchi et al., 1999] Toshiya Nakaguchi, JIN'NO Kenya, and Mamoru Tanaka. Hysteresis neural networks for n-queens problems. IEICE TRANSACTIONS on Fun- damentals of Electronics, Communications and Computer Sciences, 82(9):1851-1859, 1999.","title":"Hysteresis neural networks for n-queens problems","authors":"Nakaguchi","year":"1999","venue":"IEICE TRANSACTIONS on Fundamentals of Electronics, Communications and Computer Sciences","doi":null,"url":null,"internal_url":null},{"position":32,"raw":"[Namasivayam and Truszczynski, 2009] Gayathri Na- masivayam and Miroslaw Truszczynski. Blocked n-queens. https://dtai.cs.kuleuven.be/ events/ASP-competition/Benchmarks/ BlockedQueens.shtml, 2009.","title":"Blocked n-queens","authors":"Gayathri Namasivayam, Miroslaw Truszczynski","year":"2009","venue":null,"doi":null,"url":"https://dtai.cs.kuleuven.be/events/ASP-competition/Benchmarks/BlockedQueens.shtml","internal_url":null},{"position":33,"raw":"[Nauck, 1850] Franz Nauck. Schach: Eine in das Gebiet der Mathematik fallende Aufgabe von Herrn Dr. Nauck in Schleusingen. Illustrirte Zeitung, 14(361):352, June 1850. Cited in [Campbell, 1977].","title":"Schach: Eine in das Gebiet der Mathematik fallende Aufgabe von Herrn Dr. Nauck in Schleusingen","authors":"Franz Nauck, Nauck","year":"1850","venue":"Illustrirte Zeitung","doi":null,"url":null,"internal_url":null},{"position":34,"raw":"[Preußer, 2016] Thomas B. Preußer. 27-queens puzzle: Massively parellel enumeration and solution counting. https://github.com/preusser/q27, Septem- ber 2016.","title":"27-queens puzzle: Massively parellel enumeration and solution counting","authors":"B Thomas, Preußer","year":null,"venue":null,"doi":null,"url":"https://github.com/preusser/q27,Septem-ber2016","internal_url":null},{"position":35,"raw":"[Selman et al., 1992] Bart Selman, Hector J. Levesque, and David G. Mitchell. A new method for solving hard satisfia- bility problems. In Proceedings of the 10th National Con- ference on Artificial Intelligence (AAAI-92), pages 440- 446, 1992.","title":"A new method for solving hard satisfiability problems","authors":"Bart Selman, Hector J Levesque, David G Mitchell","year":"1992","venue":"Proceedings of the 10th National Conference on Artificial Intelligence (AAAI-92)","doi":null,"url":null,"internal_url":null},{"position":36,"raw":"[Shah-Hosseini, 2009] Hamed Shah-Hosseini. The intelli- gent water drops algorithm: a nature-inspired swarm- based optimization algorithm. International Journal of Bio-Inspired Computation, 1(1-2):71-79, 2009.","title":"The intelligent water drops algorithm: a nature-inspired swarmbased optimization algorithm","authors":"Hamed Shah-Hosseini","year":"2009","venue":"International Journal of Bio-Inspired Computation","doi":null,"url":null,"internal_url":null},{"position":37,"raw":"[Sloane, 2016] N. J. A. Sloane. The on-line encyclopedia of integer sequences. https://oeis.org, 2016.","title":"The on-line encyclopedia of integer sequences","authors":"N J A Sloane","year":"2016","venue":null,"doi":null,"url":"https://oeis.org","internal_url":null},{"position":38,"raw":"[Smet, 2014] Geoffrey De Smet. Cheating on the n queens benchmark. http://www. optaplanner.org/blog/2014/05/12/ CheatingOnTheNQueensBenchmark.html, May 2014.","title":"Cheating on the n queens benchmark","authors":"Geoffrey De Smet, Smet","year":"2014","venue":null,"doi":null,"url":"http://www.optaplanner.org/blog/2014/05/12/CheatingOnTheNQueensBenchmark.html","internal_url":null},{"position":39,"raw":"[Sosic and Gu, 1990] Rok Sosic and Jun Gu. A polynomial time algorithm for the n-queens problem. SIGART Bul- letin, 1(3):7-11, 1990.","title":"Rok Sosic and Jun Gu. A polynomial time algorithm for the n-queens problem","authors":"Gu Sosic","year":"1990","venue":"SIGART Bulletin","doi":null,"url":null,"internal_url":null},{"position":40,"raw":"[Takayuki and Takahiro, 2003] YATO Takayuki and Seta Takahiro. Complexity and completeness of finding another solution and its application to puzzles. IEICE transactions on fundamentals of electronics, communications and com- puter sciences, 86(5):1052-1060, 2003.","title":"Complexity and completeness of finding another solution and its application to puzzles","authors":"Takahiro ; Yato Takayuki, Seta Takayuki, Takahiro","year":"2003","venue":"IEICE transactions on fundamentals of electronics, communications and computer sciences","doi":null,"url":null,"internal_url":null},{"position":41,"raw":"[Valtorta, 1991] Marco Valtorta. Response to \"explicit solu- tions to the n-queens problem for all n\". SIGART Bulletin, 2(4):7-5, February 1991.","title":"Marco Valtorta. Response to \"explicit solutions to the n-queens problem for all n","authors":"Valtorta","year":"1991","venue":"SIGART Bulletin","doi":null,"url":null,"internal_url":null},{"position":42,"raw":"[Viglietta, 2014] Giovanni Viglietta. Gaming is a hard job, but someone has to do it! Theory of Computing Systems, 54(4):595-621, 2014.","title":"Gaming is a hard job, but someone has to do it!","authors":"Giovanni Viglietta","year":"2014","venue":"Theory of Computing Systems","doi":null,"url":null,"internal_url":null},{"position":43,"raw":"[Walker, 1960] Robert J Walker. An enumerative tech- nique for a class of combinatorial problems. In Richard Bellmann and Marshall Hall Jr, editors, Combinatorial Analysis: Proceedings Of The Tenth Symposium In Ap- plied Mathematics Of The American Mathematical Soci- ety, pages 91-94. American Mathematical Society, 1960.","title":"An enumerative technique for a class of combinatorial problems","authors":"J Robert, Walker","year":"1960","venue":"Combinatorial Analysis: Proceedings Of The Tenth Symposium In Applied Mathematics Of The American Mathematical Society","doi":null,"url":null,"internal_url":null},{"position":44,"raw":"[Walsh, 2014] Toby Walsh. Candy Crush is NP-hard. CoRR, arXiv:1403.1911 [cs.CC], 2014.","title":"Candy Crush is NP-hard","authors":"Toby Walsh","year":"2014","venue":null,"doi":null,"url":null,"internal_url":null}],"license_note":"Copyright International Joint Conferences on Artificial Intelligence."}