简体   繁体   English

线性冲突启发式导致比A-Star for 15-Puzzle的曼哈顿启发式创建和探索更多节点吗?

[英]Can linear conflict heuristic cause more nodes to be created and explored than Manhattan heuristic with A-Star for 15-Puzzle?

I have coded A-star Algorithm for 15-puzzle using just Manhattan Heuristic and Manhattan and linear conflict heuristic. 我使用曼哈顿启发式和曼哈顿以及线性冲突启发式编码了15-puzzle的A-star算法。

My question is, can for some specific puzzle instances linear conflict cause more nodes to be created and explored than Manhattan heuristic alone using a-Star? 我的问题是,对于某些特定的拼图实例,线性冲突会导致比单独使用a-Star的曼哈顿启发式创建和探索更多节点吗?

Since most of the puzzle instances I tried solving through my program which require <50 Moves solve in decent time with the given memory using just Manhattan and solve faster combining it with linear conflict as heuristic, instances which require >50 Moves causes the program to run indefinitely and hang up my machine, but for a specific problem which takes 42 moves is solved by my program in ~8 seconds using Manhattan but using linear conflict on the same causes the program to run indefinitely and hang up my machine. 由于我尝试通过我的程序解决的大多数拼图实例需要<50 Moves使用曼哈顿的给定内存解决得体,并且解决更快将其与线性冲突组合作为启发式,需要> 50 Moves的实例导致程序运行无限期地挂断我的机器,但是对于一个需要42次移动的特定问题,我的程序在大约8秒内使用曼哈顿解决了但是使用线性冲突导致程序无限期地运行并挂断我的机器。

I have gone through my code over and over and I can't find an error in my linear conflict or Manhattan heuristic code.Thus, this general question to make sure. 我一遍又一遍地浏览了我的代码,我在线性冲突或曼哈顿启发式代码中找不到错误。因此,这个一般性的问题要确保。

The following instance causes the problem as stated above. 以下实例导致上述问题。

2,8,7,11                 //Takes 42 Moves to solve
5,0,4,15
13,9,14,3
1,10,6,12

Both Manhattan Heuristic and Manhattan with linear conflict are admissible heuristics , ie they never overestimate the effort to reach the goal. 曼哈顿启发式和具有线性冲突的曼哈顿都是可接受的启发式算法 ,即他们永远不会过高估计达到目标的努力。 In addition, Manhattan with linear conflict is more informed than simple Manhattan. 此外,线性冲突的曼哈顿比简单的曼哈顿更有见地。

We say a heuristic h2 dominates, or is more informed than a heuristic h1 if h2(n) >= h1(n) for every node n . 我们说如果每个节点n的h2(n)> = h1(n),则启发式h2占主导地位,或者比启发式h1更明智 In this case, A* using h2 as heuristic will always expand a subset of the nodes expanded by h1 . 在这种情况下, 使用h2作为启发式的A *将始终扩展由h1扩展的节点的子集 Answering your question, A* with the Manhattan and linear conflict heuristic can not expand more nodes , in fact, can not expand any node that was not expanded by A* with the simple Manhattan heuristic , ie the set of nodes expanded by A* with Manhattan-linear-conflict is a subset of the nodes expanded by A* with plain Manhattan. 回答你的问题,A *与曼哈顿和线性冲突启发式无法扩展更多的节点 ,事实上, 无法扩展任何未被A *扩展的节点,简单的曼哈顿启发式 ,即由A *扩展的节点集曼哈顿线性冲突是由普通曼哈顿A *扩展的节点的子集

Try to review your code with the debugger and find this scenario, this will probably help you finding the bug in the implementation. 尝试使用调试器检查您的代码并找到这种情况,这可能会帮助您找到实现中的错误。

For a more formal answer I encourage you to read carefully this post . 如果有更正式的答案,我建议您仔细阅读这篇文章

Regarding your issue with your machine hanged up in difficult problems, A* must store all closed and open nodes, incurring in exponential waste of memory. 关于您的机器问题在困难问题中遇到困难,A *必须存储所有已关闭和打开的节点,从而导致内存的指数浪费。 To solve 15-puzzle problems go for iterative deepening (IDA*) where the execution time and memory consumption are better. 要解决15-puzzle问题,需要进行迭代深化(IDA *),其中执行时间和内存消耗更好。

While, as stated by FrankS101, it is not possible that using the Manhattan distance heuristic with linear conflict will expand more nodes than simply using manhttan distance, it IS possible that it will take more time. 然而,正如FrankS101所述,使用具有线性冲突的曼哈顿距离启发式不可能扩展比仅仅使用manhttan距离更多的节点,它可能需要更多时间。 This is due to the fact that calculating manhattan distance with linear conflict will make the algorithm "spend" more time at each node, as it takes more time to calculate this heuristic. 这是因为计算具有线性冲突的曼哈顿距离将使算法在每个节点“花费”更多时间,因为计算该启发式需要更多时间。

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

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