Skip to main content
Log in

Landscape analysis and efficient metaheuristics for solving the n-queens problem

  • Published:
Computational Optimization and Applications Aims and scope Submit manuscript

Abstract

The n-queens problem is a classical combinatorial optimization problem which has been proved to be NP-hard. The goal is to place n non-attacking queens on an n×n chessboard. In this paper, two single-solution-based (Local Search (LS) and Tuned Simulated Annealing (SA)) and two population-based metaheuristics (two versions of Scatter Search (SS)) are presented for solving the problem. Since parameters of heuristic and metaheuristic algorithms have great influence on their performance, a TOPSIS-Taguchi based parameter tuning method is proposed, which not only considers the number of fitness function evaluations, but also aims to minimize the runtime of the presented metaheuristics. The performance of the suggested approaches was investigated through computational analyses, which showed that the Local Search method outperformed the other two algorithms in terms of average runtimes and average number of fitness function evaluations. The LS was also compared to the Cooperative PSO (CPSO) and SA algorithms, which are currently the best algorithms in the literature for finding the first solution to the n-queens problem, and the results showed that the average fitness function evaluation of the LS is approximately 21 and 8 times less than that of SA and CPSO, respectively. Also, a fitness analysis of landscape for the n-queens problem was conducted which indicated that the distribution of local optima is uniformly random and scattered over the search space. The landscape is rugged and there is no significant correlation between fitness and distance of solutions, and so a local search heuristic can search a rugged plain landscape effectively and find a solution quickly. As a result, it was statistically and analytically proved that single-solution-based metaheuristics outperform population-based metaheuristics in finding the first solution of the n-queens problem.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11

Similar content being viewed by others

References

  1. Aarts, E.H.L., Lenstra, J.K.: Local Search in Combinatorial Optimization. Wiley, New York (1997)

    MATH  Google Scholar 

  2. Abramson, B., Yung, M.: Divide and conquer under global constraints: a solution to the N-queens problem. J. Parallel Distrib. Comput. 6(3), 649–662 (1989)

    Article  Google Scholar 

  3. Amooshahi, A., Joudaki, M., Imani, M., Mazhari, N.: Presenting a new method based on cooperative PSO to solve permutation problems: a case study of n-queen problem. In: 3rd International Conference on Electronics Computer Technology (2011)

    Google Scholar 

  4. Bell, J., Stevens, B.: A survey of known results and research areas for n-queens. Discrete Math. 309, 1–31 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  5. Bezzel, M.: Proposal of 8-queens problem, Berliner Schachzeitung 3, 363 (1848)

  6. Campos, V., Laguna, M., Mart, R.: Context-independent scatter search and tabu search for permutation problems. INFORMS J. Comput. 17, 111–122 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  7. Dirakkhunakon, S., Suansook, Y.: Simulated annealing with iterative improvement. In: International Conference on Signal Processing Systems (2009). doi:10.1109/ICSPS.2009.61

    Google Scholar 

  8. Draa, A., Talbi, H., Batouche, M.: A quantum inspired genetic algorithm for solving the N-queens problem. In: Proceedings of the 7th International Symposium on Programming and Systems, Algiers, pp. 145–152 (2005)

    Google Scholar 

  9. Draa, A., Meshoul, S., Talbi, H., Batouche, M.: A quantum-inspired differential evolution algorithm for solving the N-queens problem. Int. Arab J. Inf. Technol. 7, 21–27 (2010)

    Google Scholar 

  10. Erbas, C., Sarkeshik, S., Tanik, M.M.: Different perspectives of the n-queens problem. In: Proceedings of the 1992 ACM Annual Conference on Communications, pp. 99–108. ACM Press, New York (1992)

    Chapter  Google Scholar 

  11. Geman, S., Geman, D.: Stochastic relaxation, Gibbs distributions, and the Bayesian restoration of images. IEEE Trans. Pattern Anal. Mach. Intell. 6, 721–741 (1984)

    Article  MATH  Google Scholar 

  12. Glover, F.: A template for scatter search and path relinking. In: Hao, J.K., Lutton, E., Ronald, E., Schoenauer, D., Snyers, D. (eds.) Lecture Notes in Computer Science, vol. 1363, pp. 13–54 (1997)

    Google Scholar 

  13. Glover, F.: Heuristics for integer programming using surrogate constraints. Decis. Sci. 8, 156–166 (1977)

    Article  Google Scholar 

  14. Homaifar, A., Turner, J., Ali, S.: The n-queens problem and genetic algorithms. In: Proceedings IEEE Southeast Conference, vol. 1, pp. 262–267 (1992)

    Chapter  Google Scholar 

  15. Hwang, C.L., Yoon, K.: Multiple Attribute Decision Making-Method and Applications, a State-of-the-Art Survey. Springer, New York (1981)

    Book  Google Scholar 

  16. Jagota, A.: Optimization by reduction to maximum clique. In: IEEE International Conference on Neural Networks (1993)

    Google Scholar 

  17. Jones, T., Forrest, S.: Fitness distance correlation as a measure of problem difficulty for genetic algorithms. In: Proceedings of the 6th International Conference on GeneticAlgorithms, pp. 184–192. Morgan Kaufmann, San Francisco (1995)

    Google Scholar 

  18. Jones, T.: Evolutionary algorithms, fitness landscapes and search. PhD thesis, University of New Mexico, Albuquerque, NM (1995)

  19. Kale, L.V.: An almost perfect heuristic for the n non-attacking queens problem. Inf. Process. Lett. 34, 173–178 (1990)

    Article  MathSciNet  MATH  Google Scholar 

  20. Khan, S., Bilal, M., Sharif, M., Sajid, M., Baig, R.: Solution of n-queen problem using ACO. In: IEEE 13th International Multitopic Conference, Art. No. 5383157 (2009).

    Google Scholar 

  21. Kirkpatrick, S., Gelet, C.D., Vecchi, M.P.: Optimization by simulated annealing. Science 220, 621–630 (1983)

    Article  Google Scholar 

  22. Kosters, W.: n-queens bibliography. Retrieved May 4 (2012). http://www.liacs.nl/~kosters/nqueens/

  23. Laguna, M., Marti, R.: Scatter Search: Methodology and Implementations in C. Kluwer Academic, Boston (2003)

    Book  Google Scholar 

  24. Lionnet, F.J.E.: Question 963. Nouv. Ann. Math., Ser. 2 8, 560 (1869)

    Google Scholar 

  25. Martí, R., Laguna, M., Campos, V.: Scatter search vs. genetic algorithms: an experimental evaluation with permutation problems. In: Rego, C., Alidaee, B. (eds.) Adaptive Memory and Evolution: Tabu Search and Scatter Search. Kluwer Academic, Dordrecht (2004)

    Google Scholar 

  26. Martinjak, I., Golub, M.: Comparison of heuristic algorithms for the N-queen problem. In: Proceedings of the ITI 2007 29th Int. Conf. on Information Technology Interfaces, Cavtat, Croatia, pp. 25–28 (2007)

    Google Scholar 

  27. Nouraniy, Y., Andresenz, B.: A comparison of simulated annealing cooling strategies. J. Phys. A, Math. Gen. 31, 8373–8385 (1998)

    Article  Google Scholar 

  28. Pauls, E.: Das Maximalproblem der Damen auf dem Schachbrete, II, Deutsche Schachzeitung. Organ fur das Gesammte Schachleben 29(9), 257–267 (1874)

    Google Scholar 

  29. Rego, C., Leão, P.: A scatter search tutorial for graph-based permutation problems. Research Paper HCES-10-00, Hearin Center for Enterprise Science, University of Mississippi, MS 38677, USA (2009)

  30. Rivin, I., Zabih, R.: A dynamic programming solution to the n-queens problem. Inf. Process. Lett. 41, 253–256 (1992)

    Article  MathSciNet  MATH  Google Scholar 

  31. Russell, S.J., Norvig, P.: Artificial Intelligence a Modern Approach Prentice-Hall, Englewood Cliffs (1995)

    MATH  Google Scholar 

  32. Segundo, P.S.: New decision rules for exact search in N-queens. J. Glob. Optim. 51, 497–514 (2011). doi:10.1007/s10898-011-9653-x

    Article  MATH  Google Scholar 

  33. Sloane, N.J.A.: The On-Line Encyclopedia of Integer Sequences (2012). http://oeis.org/A000170

  34. Sosic, R., Gu, J.: Efficient local search with conflict minimization. IEEE Trans. Knowl. Data Eng. 6E, 661–668 (1994)

    Article  Google Scholar 

  35. Taguchi, G., Yokoyama, Y.: Taguchi Methods: Design of Experiments. Am. Supplier Inst. Press, Millersburg (1993)

    Google Scholar 

  36. Talbi, E.-G.: Metaheuristics from Design to Implementation. Wiley, Hoboken (2009)

    MATH  Google Scholar 

  37. Tambouratzis, T.: A simulated annealing artificial neural network implementation of the n-queens problem. Int. J. Intell. Syst. 12, 739–752 (1997)

    Article  Google Scholar 

  38. Tong, L.I., Wang, Ch.H., Chen, H.C.: Optimization of multiple responses using principal component analysis and technique for order preference by similarity to ideal solution. Int. J. Adv. Manuf. Technol. 27, 407–414 (2005)

    Article  Google Scholar 

  39. Wolpert, D.W., Macready, W.G.: No free lunch theorems for optimization. IEEE Trans. Evol. Comput. 1(1), 67–82 (1997)

    Article  Google Scholar 

  40. Xinchao, Z.: Simulated annealing algorithm with adaptive neighborhood. Appl. Soft Comput. 11, 1827–1836 (2011)

    Article  Google Scholar 

  41. Yang, X.-S.: Nature-Inspired Metaheuristic Algorithms. Luniver Press (2010)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ellips Masehian.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Masehian, E., Akbaripour, H. & Mohabbati-Kalejahi, N. Landscape analysis and efficient metaheuristics for solving the n-queens problem. Comput Optim Appl 56, 735–764 (2013). https://doi.org/10.1007/s10589-013-9578-z

Download citation

  • Received:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10589-013-9578-z

Keywords

Navigation