双向A*搜索 | 双向启发式搜索

原始双向A*

如https://blog.csdn.net/jz_terry/article/details/77487905 中描述的
分别从起点和目标点开始各自的A*搜索

思考

还有一些问题

  1. 搜索顺序。是一边一次轮着来?还是并行搜索?又或者选择两个优先队列里优先级最高的两个元素中优先级更高的那个?
  2. 如何促使两个搜索相遇?
  • 上述链接的文章下的评论里weixin_44831818提问:

我也想知道双向A*算法会不会出现不相交情况?因为起点和终点的地图环境是不一样的,会不会一个向上跑,一个向下跑?

  • https://stackoverflow.com/questions/3641741/bidirectional-a-a-star-search 中Michael Clerx的高赞回答提到

In the best possible case it’d run in O(b(n/2)) instead of O(bn), but that’s only if you’re lucky 😃
(where b is your branching factor and n is the number of nodes a unidirectional A* would consider)
It all depends on how easily the two searches meet, if they find each other at a good halfway point early in the search you’ve done away with a lot of search time, but if they branch into wildly different directions you may end up with something slower than simple A* (because of all the extra bookkeeping)

如果处理不当,双向A*可能反而比单向A*更差劲

变种

这时候回顾双向A*这个说法,其实很可能未必真的要A*,只是取A*中启发式搜索的这个特点。
我们把从起点开始的搜索称作正向(forward)搜索,从目标点开始的搜索称作反向(backward)搜索。
这部分参考了斯坦福大学的相关页面 http://theory.stanford.edu/~amitp/GameProgramming/Variations.html#bidirectional-search

front-to-front

考虑单向A*,我们把优先队列OPEN中keyValue非无穷大的这些节点的集合成为front(前沿),把起点称为end。

front-to-end中正向搜索从自己的front往反向搜索的end(也就是目标点)搜索,反向搜索从自己的front往正向搜索的end(也就是起点)搜索。如果不加其它改动,这就是原始双向A*。

front-to-front中正向搜索和反向搜索分别从自己的front往对方的front搜索。并且优先队列中维护的是元素是一组点对(x,y)以及这个元素的keyValue。 f ( x , y ) = g ( s t a r t , x ) + h ( x , y ) + g ( y , g o a l ) f(x,y) = g(start,x) + h(x,y) + g(y,goal) f(x,y)=g(start,x)+h(x,y)+g(y,goal) f ( x , y ) f(x,y) f(x,y)是点对(x,y)的keyValue,keyValue越小,该点对优先级越高。 g ( s t a r t , x ) g(start,x) g(start,x)是从起点到节点x的正向搜索的已付代价, h ( x , y ) h(x,y) h(x,y)是从节点x到节点y的代价的启发式值, g ( y , g o a l ) g(y,goal) g(y,goal)是从目标点到节点y的反向搜索的已付代价。

分析:
优先队列维护的是一组点对,不用分离正向搜索和反向搜索,这解决了思考中的第1个问题。
该方法在元素keyValue当中加入了 h ( x , y ) h(x,y) h(x,y)项,起到了引导正向搜索和反向搜索相遇的效果,这解决了思考中的第2个问题。

缺陷:
在 https://escholarship.org/uc/item/5j34j5bj (2015年UCLA的一篇学位论文)中提到

A front-to-front heuristic evaluation is more accurate than a front-to-end heuris-tic evaluation, but comes at the cost of a much more expensive heuristic evaluation.The overhead of calculating heuristic values to each node on the opposing frontieris quite high and as such the technique has not seen much use.

大致意思经常计算 h ( x , y ) h(x,y) h(x,y)是比较花时间的,所以该方法并不常用。

这个观点在A Brief History and Recent Achievements in Bidirectional Search(AAAI2018, https://webdocs.cs.ualberta.ca/~nathanst/papers/Sturtevant18smt.pdf)论文里得到印证,原话是

Estimating paths between all pairs of states in the frontier of a search is expensive, and thus front-to-front searches are not usually practical.

目标重定(retargeting)

在形式上是正向搜索和反向搜索轮着来,一边搜一小段时间就换对方搜索。
正向搜索往目标点搜索一小段时间,得到一个最好的正向候选者(best forward candidate)。反向搜索往正向候选者搜索一小段时间,得到一个反向候选者(best backward candidate)。正向搜索往反向候选者搜索一小段时间,得到一个最好的正向候选者…如此往复直到两个候选者是同一个节点。

分析:
一边搜索一小段时间,解决了思考中的第1个问题。
往对方的候选者搜索,解决了思考中的第2个问题。

参考资料

在文中其实链接都放了。最主要的参考资料是http://theory.stanford.edu/~amitp/GameProgramming/Variations.html#bidirectional-search

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值