您有一张方形瓷砖地图,您可以在其中向 8 个方向中的任何一个方向移动。假设你调用了一个函数cost(tile1, tile2)
,它告诉你从一个相邻的瓦片移动到另一个瓦片的成本,你如何找到一个既可接受又一致的启发式函数 h(y,goal)?给定这个设置,寻找启发式的方法是否可以概括,或者它会根据cost
功能而有所不同?
3 回答
Amit 的教程是我在 A* (Amit's page)上看到的最好的教程之一。您应该在此页面上找到一些关于启发式的非常有用的提示。
这是关于您的问题的报价:
在允许 8 个移动方向的方形网格上,使用对角线距离 (L∞)。
Yes, the heuristic is dependent on the cost function, in a couple of ways. First, it must be in the same units. Second, you can't have a lower-cost path through actual nodes than the cost of the heuristic.
In the real world, used for things like navigation on a road network, your heuristic might be "the time a car would take on a direct path at 1.5x the speed limit." The cost for each road segment would use the actual speed limit, which will give a higher cost.
So, what is your cost function between tiles? Is it based on physical properties, or defined outside of your graph?