计算机与现代化 ›› 2013, Vol. 1 ›› Issue (1): 19-21.doi:

• 算法设计与分析 • 上一篇    下一篇

基于对称性计算N皇后问题的非递归算法

孙国伟1 ,买阿丽2
  

  1. 1.运城学院应用数学系,山西运城044000; 2.广州大学数学与信息科学学院,广东广州510006
  • 收稿日期:2012-09-04 修回日期:1900-01-01 出版日期:2013-02-06 发布日期:2013-02-06

A Nonrecursive Algorithm of Solving NQueens Problem Using Symmetry 

SUN Guowei1, MAI Ali2   

  1. 1. Department of Applied Mathematics, Yuncheng University, Yuncheng 044000, China;2. School of Mathematics and Information Science, Guangzhou University, Guangzhou 510006, China
  • Received:2012-09-04 Revised:1900-01-01 Online:2013-02-06 Published:2013-02-06

摘要:

利用回溯法,采用栈和队列实现计算N皇后解的一个新的非递归算法,并提出N皇后解的4个对称性质,重点分析5皇后的10个解之间的对称关系。然后利用对称性将搜索空间缩小为解空间的一半,给出计算N皇后问题的优化算法。理论分析和实验表明对称性可以明显提高N皇后问题的计算效率。

关键词: 关键词:栈, 队列, 非递归算法, N皇后问题, 回溯法

Abstract: A new nonrecursive algorithm of solving NQueens problem is achieved by using backtracking, which is based on stack and queue. This paper presents four properties of NQueens solutions, and analyses the symmetry between 10 solutions of 5Queens problem. Then using the symmetry, searching space is shortened a half of the solution space. The optimization algorithm to calculate the NQueens problem is obtained. Through theoretical analysis and experimental verification, the symmetry can significantly improve the efficiency of solving NQueens problem.

Key words: