n-queens_N-Queens问题-人工智能中的一种约束满意问题

N-Queens问题是一个典型的约束满意问题,涉及在一个NxN棋盘上放置N个皇后,使得每行、每列和每个对角线上都恰好有一个皇后。本文探讨了4-Queens和8-Queens问题的解决方案,说明了问题的非唯一性和解决策略。
摘要由CSDN通过智能技术生成

n-queens

N-Queens problem is a well-known Constraint Satisfactory Problem of Artificial Intelligence. In this problem, we have an NxN square grid board and we have N queens which need to be placed on them. The queens should be placed on the board in such a way so that it satisfies the below-mentioned constraints:

N皇后问题是众所周知的人工智能约束满意问题 。 在这个问题中,我们有一个NxN的正方形网格板,并且我们有N个皇后需要放置在它们上面。 将皇后区放置在板上的方式应使其满足以下提到的限制:

  1. No row should contain more than one queen placed in it

    行中最多只能包含一个女王

  2. No column should contain more than one queen placed in it.

    列中最多只能包含一个皇后。

  3. Not more than one queen should be placed in the single diagonal.

    单条对角线上最多可以放置一个女王。

  4. No row or column should be left without any queen placed in it.

    没有任何女王/王后的任何行或列都不应留下。

On summing up all the constraints, we can conclude that each row and each column should contain exactly one queen in them, neither more nor less than that.

总结所有约束后,我们可以得出结论,每一行和每一列中应恰好包含一个皇后,不得多于或少于此。

In this series of problems, mostly there are grids whose size is even in number, like 4, 6, 8 and so on. It should be noted that the minimum number of the grid that we can have in this problem is 4, not less than that.

在这一系列问题中,大多数情况下存在大小为偶数的网格,例如4、6、8等。 应该注意的是,我们在这个问题上可以拥有的最小网格数是4,而不是少于4。

Here the 4-Queen problem and the 8-Queen problem are the most popular in the N-Queen problem series. There can exist many solutions for solving this problem, which mean that the solution to these problems is not unique. Yet, one of those solutions to both these types are given below:

在此, 四皇后和八皇后问题是N皇后系列中最流行的问题。 可以存在许多解决此问题的解决方案,这意味着这些问题的解决方案不是唯一的。 但是,下面给出了这两种类型的解决方案之一:

四皇后问题 (4-Queens problem)

In the 4-Queens problem, we have a 4x4 grid and we have 4 queens to place on it. The layout for the 4-Queens problem while satisfying all the constraints is as follows:

4皇后问题 ,我们有一个4x4的网格 ,我们有4个皇后区的地方就可以了。 满足所有约束的四皇后问题的布局如下:

4-queens problem in AI

8皇后问题 (8-Queens problem)

In the 8-Queens problem, we have an 8x8 grid and we have 8-queens to place on it. The layout for the 8-Queens problem while satisfying all the constraints is as follows:

8皇后问题中 ,我们有8x8网格,并在其上放置了8个皇后 。 满足所有约束的8皇后问题的布局如下:

8-queens problem in AI

翻译自: https://www.includehelp.com/ml-ai/n-queens-problem-a-type-of-constraint-satisfactory-problem-in-artificial-intelligence.aspx

n-queens

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值