algorithm - 为什么这个曼哈顿启发式是可以接受的?

标签 algorithm a-star heuristics

this解释 A* 算法的文章说,对于给定的问题(找到有墙作为障碍物的两点之间的最短距离),曼哈顿距离是 Not Acceptable 。参见 this
这是为什么?在任何情况下它都会高估距离吗?如果是,什么时候?

最佳答案

这是来自 aStarLibrary.bb 的一个 block (从您的链接中获取链接)

;算出它的G成本 如果 Abs(a-parentXval) = 1 并且 Abs(b-parentYVal) = 1 那么 addedGCost = 14 ;去对角线正方形的成本
否则
addedGCost = 10 ;去非对角正方形的成本
万一 Gcost(a,b) = Gcost(parentXval,parentYVal)+addedGCost

    ;Figure out its H and F costs and parent
    Hcost(openList(m)) = 10*(Abs(a - targetx) + Abs(b - targety)) ; record the H cost of the new square

从 (0, 0) 到 (1,1) 的移动的启发式 (Hcost) 将为 10 * (1 + 1) = 20。GCost(移动成本)将此视为单个对角线移动成本 14。所以是的,这是一个高估。

关于algorithm - 为什么这个曼哈顿启发式是可以接受的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18683975/

相关文章:

javascript - 碰撞检测不应该使物体传送

python - 这种广度优先搜索可以做得更快吗?

java - 修改 A Star 算法以连接逻辑方案中的门

c - 在 C 中快速/高效地识别两个二维数组的相同性

algorithm - s-t min 切割交点

c - 带分页的排序算法

java - A* (A Star) 算法输出所有可能的解决方案

algorithm - A-Star算法(重构路径)

algorithm - 具有近似值且无重复的数字总和

java - 为人工智能创建新的启发式方法