简体   繁体   English

寻找启发式传教士和食人族

[英]Finding a heuristic missionary and cannibals

I am trying to build aa* algorithm that will solve a missionary and cannibals problem. 我正在尝试建立一个可以解决传教士和食人族问题的aa *算法。 I am unsure of the heuristic I should use and what I should possibly look for to try and end up solving this. 我不确定应该使用的启发式方法以及可能试图寻找的最终解决方案。

This is the requirements and the way that you can move. 这是您的要求和移动方式。

Four missionaries and four cannibals are on West bank (W) of a river, along with a boat that can hold up to three people: 0 < capacity of boat ≤ 3. Find a way to get everyone to East bank (E) without ever leaving a group of missionaries in one place outnumbered by the cannibals in that place. 四名传教士和四名食人族在一条河的西岸(W)上,以及一艘最多可容纳三人的船:0 <船的容量≤3。将一群宣教士留在一个地方,人数超过了那个地方的食人者。 This problem is famous in AI because it was the subject of the 1st paper that approached problem formulation from an analytical viewpoint (Amerel, 1968). 这个问题在AI中是著名的,因为它是第一篇论文的主题,从分析的角度着手解决问题(Amerel,1968年)。

This particular state space is small enough that you can explore it with breadth first search. 这个特定的状态空间足够小,您可以使用广度优先搜索来探索它。

In general, however, one fruitful source of heuristics is to drop one or more of the constraints that make the problem difficult, thereby "relaxing" the problem (that's a technical term). 但是,总的来说,启发式方法的一个富有成果的来源是消除使问题变得困难的一个或多个约束,从而“放松”问题(这是一个技术术语)。 Figuring out which ones is an art, unfortunately. 不幸的是,弄清楚哪些是一门艺术。 For this particular problem, you could drop the constraint that the cannibals not outnumber the missionaries, thereby making the heuristic value a simple function of where the boat is and how many people are on each side of the river. 对于这个特定问题,您可以取消食人族人数不超过传教士的约束,从而使启发式值成为船在何处以及河两岸有多少人的简单函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM