类似筛法的N皇后问题求解算法
作者:

Sieve Algorithm to N Queens Problem
Author:
  • 摘要
  • | |
  • 访问统计
  • |
  • 参考文献 [10]
  • |
  • 相似文献 [20]
  • | | |
  • 文章评论
    摘要:

    迄今为止, 已有多种基于不同理论的八皇后问题算法. 本文提出一种类似筛法的新算法: 在棋盘某一格放上一个皇后的同时划去经过这一格的纵、横、及正负45度线上的所有格位, 或者说筛去这些格位;后来的皇后只能放在未被占据或划去的格位上;若所有的皇后都能放入一个格位, 则得到了一个布局或一个解. 依据这种思路容易制定一个N皇后问题的简洁算法. 实验结果表明, 筛法算法的效率大大高于经典的回溯法.

    Abstract:

    So far, there have been many different algorithm of eight queens problem. A similar sieve algorithm is presented in this paper: Using a algorithm similar to the sieve method in number theory: place the first queen in the first grid of the first row, and mark out the row, the column, the downward diagonal and the upward diagonal through the first queen;then place the second queen on the most left grid of the unmarked grid of the second row, and mark out the row, the column, the downward diagonal and the upward diagonal through the second queen;like this, queens are added, one by one. if all the queens can be placed on the board, a layout or a solution received. Traversing all grids of all row, we would get all solutions of N-queens problem. Based on the simple idea, we can develop a N-queens program easily. The experimental results show that the efficiency of the sieve program is much higher than the classic backtracking program.

    参考文献
    1 Dahl OJ, Dijkstra EW, Hoare CAR. Structured Programming, Academic Press, London,1972 ISBN 0-12-200550-3.
    2 张万军.N皇后问题回溯算法探讨.宜宾学院学报,2006,06: 64-66.
    3 刘寒冰,李福荣,叶茂功.N皇后问题的回溯算法改进.软件导刊,2010,(7):63-65.
    4 王振义.遗传算法求解N皇后问题的优化.山西大同大学学报(自然科学版),2010,26(2):13-14,17.
    5 刘娟,欧阳建权,陈良军.用混合遗传算法求解N皇后问题.湘潭大学自然科学学报,2007(10102):37-41.
    6 白艳萍,杨明.一类求解八皇后问题的神经网络模型.山西大学学报(自然科学版),2001,(1):22-25.
    7 周康,魏传佳,刘朔,卢军.八皇后问题所有解的模拟DNA算法.华中科技大学学报(自然科学版),2009,(6):24-27,39.
    8 熊金平,唐郑熠.基于位运算的N皇后问题的解法.计算机与数字工程,2011,39(1):42-44,82.
    9 王哲,栾英姿.N皇后问题的快速搜索算法.计算机技术与发展,2009,19(6):72-75.
    10 韩宇南,吕英华,黄小红.并行改进回溯算法实现N皇后问题的快速计数.计算机工程与应用,2006,36:1-3.
    引证文献
    网友评论
    网友评论
    分享到微博
    发 布
引用本文

程元斌.类似筛法的N皇后问题求解算法.计算机系统应用,2013,22(10):147-150

复制
分享
文章指标
  • 点击次数:1490
  • 下载次数: 2537
  • HTML阅读次数: 0
  • 引用次数: 0
历史
  • 收稿日期:2013-04-03
  • 最后修改日期:2013-05-13
  • 在线发布日期: 2013-10-18
文章二维码
您是第11307875位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京海淀区中关村南四街4号 中科院软件园区 7号楼305房间,邮政编码:100190
电话:010-62661041 传真: Email:csa (a) iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号