# 随时A*

随时A*（Anytime A*）是一种启发式搜索方案，它将A*转换为随时算法：它先用加权启发式搜索快速找到一个近似解，然后在计算时间允许的情况下不断改进该解，最终收敛到最优解。<sup>[1](https://www.jair.org/index.php/jair/article/view/10489)</sup> 该方案在规划中很重要，因为随时算法能非常快地找到第一个解——它可能高度次优——然后持续改进它，直到分配的时间用完；这使机器人或规划器能够立即按照可行计划行动，并在后台细化它。<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 原始算法 | 随时A*，由E. A. 汉森（E. A. Hansen）和R. 周（R. Zhou）在《人工智能研究杂志》（Journal of Artificial Intelligence Research）2007年<sup>[3](https://doi.org/10.1613/jair.2096)</sup>描述 |
| 核心机制 | 带膨胀启发式的加权A*返回快速的有界次优解；随后降低膨胀并修复搜索<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup> |
| 次优性保证 | 加权A*解的代价不超过最优代价的ε倍，其中ε是膨胀因子<sup>[4](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)</sup> |
| 著名变体 | ARA*（Anytime Repairing A*，随时修复A*），它在各次膨胀之间复用搜索工作，并保证每个状态在其第一次搜索期间至多被检查一次<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup> |
| 实测加速 | ARA*在11.7秒内达到4.5的次优性界，而重复A*搜索需要27.4分钟，加速140倍<sup>[4](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)</sup> |
| 动态扩展 | 随时D*（AD*）兼具随时与增量特性，在世界模型变化时改进解并重规划<sup>[4](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)</sup> |

## 工作原理

其原理建立在加权A*搜索之上。A*按 \( f(s) = g(s) + h(s) \) 对状态排序，其中 \( g(s) \) 是从起点出发的代价，\( h(s) \) 是到目标的启发式估计。加权A*将启发式乘以一个大于1的膨胀因子，这使搜索偏向目标，在许多领域中速度很快，并且它返回的解的代价不大于最优解代价的ε倍，其中ε是膨胀因子。<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup> ARA*用一个定理形式化了这一点：每当其ImprovePath函数退出时，对任何相关状态都有 \( g^{*}(s) \leq g(s) \leq \varepsilon \cdot g^{*}(s) \)，因此每个解都在最优解的ε倍以内，而ε在迭代之间递减。<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup>

原始随时A*的工作方式不同。它为第一个解用很大的因子膨胀启发式，然后继续处理那些用未膨胀的 \( h(s) \) 计算出的 \( f \) 值小于或等于目前找到的最好解代价的状态。<sup>[4](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)</sup> 它维护最优解代价的下界 \( f_{L} \) 和由当前解给出的上界，因此它随时间既改进解，也改进当前解次优性的界。<sup>[1](https://www.jair.org/index.php/jair/article/view/10489)</sup> 然而，它的所有搜索工作都使用为第一次搜索选定的膨胀因子，因此尽管持续搜索会改进当前解和当前解次优性的界，它不能降低该膨胀因子。<sup>[1](https://www.jair.org/index.php/jair/article/view/10489)</sup><sup> • </sup><sup>[14](https://mlanthology.org/jair/2007/hansen2007jair-anytime/)</sup> ARA*的设计目标是在保持第一次膨胀搜索速度的同时消除这一限制。<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup>

## 实现方式

采用ARA*风格随时搜索的实践者遵循以下循环：

1. 选择大于1的初始膨胀ε，并用该膨胀运行加权A*。第一个解立即发布，并保证其代价至多为最优的ε倍。<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup>
2. 将ε减少一个固定步长，再次调用ImprovePath。g值发生变化的状态，即所谓INCONS列表，被重新插入开放列表，从而复用而非丢弃先前的搜索工作。<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup>
3. 每次ImprovePath退出后检查界：当前解是ε次优的，且随着ε下降界会收紧。当时间到期，或当ε达到1且开放列表耗尽时终止；此时解可证明为最优。<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup>

文献中有两个实现细节不同。ARA*在递减权重时使用递减后的权重与计算出的下界中的最小值，而汉森和周（2007）的评估只考虑递减后的权重。<sup>[5](https://ojs.aaai.org/index.php/SOCS/article/download/18181/17972)</sup> 诸如ARA*的修复式搜索也与原始随时A*这类持续搜索不同，区别在于它们可以忽略哪些节点；在持续搜索中忽略某些节点会妨碍收敛到最优解。<sup>[5](https://ojs.aaai.org/index.php/SOCS/article/download/18181/17972)</sup>

## 起源

随时A*由E. A. 汉森和R. 周在《随时启发式搜索》（Anytime Heuristic Search）中提出，该文于2007年发表在《人工智能研究杂志》上。<sup>[3](https://doi.org/10.1613/jair.2096)</sup> 最著名的变体ARA*（Anytime Repairing A*，随时修复A*）由马克西姆·利哈乔夫（Maxim Likhachev）、杰弗里·J. 戈登（Geoffrey J. Gordon）和[塞巴斯蒂安·特龙](https://www.edgepedia.org/zh/sebastian-thrun)（Sebastian Thrun）于2003年报告，其明确目标是根据可用搜索时间调节性能界。<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup> 其作者指出，原始随时A*是他们所知的唯一另一种随时启发式搜索，并指出它除了选择第一次搜索的膨胀因子外，无法控制其次优性界。<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup> AWA*（Anytime Weighted A*，随时加权A*）这一谱系建立在汉森和周的工作之上，反过来又催生了包括ARA*等在内的相关算法。<sup>[6](https://ojs.aaai.org/index.php/SOCS/article/download/18558/18347/22077)</sup> 增量重规划算法D*和LPA*在世界模型变化时修复先前的解，构成了另一条前身路线，随时D*将这条路线与ARA*相结合。<sup>[4](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)</sup>

## 变体

若干变体从不同方向扩展了基本方案：

- **ARA*** 运行一系列启发式权重递减的加权A*搜索，复用搜索工作，使次优性界始终得到满足，并保证每个状态在其第一次搜索期间至多被检查一次。<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup>
- **随时D*（AD*）** 结合了随时搜索与增量搜索：它复用旧搜索工作，像ARA*那样改进先前的解，并像D*/LPA*那样重规划；其作者称它是第一个兼具随时与增量特性的搜索算法，并为其返回的每个解提供次优性界。<sup>[4](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)</sup>
- **A-MHA*** 通过借鉴ARA*的概念，将多启发式A*扩展为随时版本，使用N+1个优先级队列，优先级为 \( key(s, i) = g(s) + w_{1} \cdot h_{i}(s) \)，并使用锚定封闭列表、不可采纳封闭列表以及类似ARA*的INCONS列表。<sup>[7](https://arxiv.org/html/2508.21637)</sup> 多启发式A*本身由桑迪普·艾内（Sandip Aine）及其同事于2015年在《国际机器人研究杂志》（The International Journal of Robotics Research）上提出。<sup>[8](https://doi.org/10.1177/0278364915594029)</sup>
- **A-ePA*SE** 针对边评估缓慢的领域（例如仿真器在环规划）并行化随时搜索，建立在PA*SE、ePA*SE和GePA*SE谱系之上，并在计算初始解和将其改进到最优解两方面都相对ARA*取得显著加速。<sup>[9](https://ar5iv.labs.arxiv.org/html/2305.04408)</sup> ePA*SE由肖欣·穆克吉（Shohin Mukherjee）、桑迪普·艾内和马克西姆·利哈乔夫于2022年报告，<sup>[10](https://doi.org/10.48550/arxiv.2203.01369)</sup> GePA*SE由肖欣·穆克吉和马克西姆·利哈乔夫于2023年报告。<sup>[11](https://doi.org/10.48550/arxiv.2301.10347)</sup>
- **AWA*** 是一种基于四项设计原则的随时启发式搜索算法：它使用不可采纳启发式寻找次优解，在得到每个次优解后继续搜索，在被中断时给出次优解的误差界，并保证一旦开放列表为空就得到最优解。<sup>[6](https://ojs.aaai.org/index.php/SOCS/article/download/18558/18347/22077)</sup>

## 应用

随时A*最初在滑块拼图、STRIPS规划和多序列比对中得到分析，该方法也被用于将递归最佳优先搜索转换为随时算法。<sup>[1](https://www.jair.org/index.php/jair/article/view/10489)</sup> ARA*在仿真机器人运动学机械臂和户外漫游车的动态路径规划问题上得到演示，<sup>[2](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)</sup> 此后被应用于自动驾驶汽车、移动操作、足步规划和无人机。<sup>[7](https://arxiv.org/html/2508.21637)</sup> AD*的动机是为在动态户外环境中运行的陆基移动机器人进行路径规划，其搜索的状态空间包括位置、朝向和速度。<sup>[12](https://www.cs.cmu.edu/~ggordon/likhachev-etal.anytime-dstar.pdf)</sup>

定量比较主要来自一个非均匀代价机械臂实验，该实验运行30分钟，初始 \( \varepsilon = 10 \)。ARA*最终解代价为200，而连续多次A*搜索为220，随时A*为223；其次优性界为3.92，而两种替代方案均为4.46。<sup>[4](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)</sup> 为达到4.5的次优性界，ARA*需要约59,000次扩展和11.7秒，而连续多次A*搜索需要1250万次扩展和27.4分钟，加速140倍；随时A*需要超过400万次扩展和8.8分钟，加速44倍。<sup>[4](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)</sup>

## 局限与替代方案

有文献记载的主要代价是重复扩展。加权A*在找到解之前可能反复扩展状态；在机械臂比较中，某些状态在找到初始解之前被扩展多达七次，这就是为什么ARA*保证每个状态在其第一次搜索期间至多被检查一次是一个优势。<sup>[4](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)</sup> 随时A*使用加权启发式搜索快速找到近似解，然后继续搜索以改进当前解并收紧其次优性界，同时保留初始膨胀因子。<sup>[1](https://www.jair.org/index.php/jair/article/view/10489)</sup> 其他随时启发式搜索，如深度优先分支定界、完全随时束搜索、束栈搜索和ABULB，不能提供非平凡的次优性界，且可能多次处理状态，尽管有些通过限制内存扩展到更大的领域。<sup>[4](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)</sup>

与增量重规划器相比，权衡不同：当世界模型变化时，D*和LPA*可能比从头重规划高效几个数量级，但它们缺乏随时性质，因为一旦找到解就停止，即使有更多规划时间也不改进。<sup>[4](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)</sup> AD*弥合了两者。<sup>[12](https://www.cs.cmu.edu/~ggordon/likhachev-etal.anytime-dstar.pdf)</sup> 与基于采样的规划器相比，RRT算法收敛到最优解的概率为零，而RRT*是一种基于采样的算法，具有几乎必然的渐近收敛到最优解的性质；随时RRT*为实时使用增加了承诺轨迹和分支定界树自适应。<sup>[13](https://ttic.edu/ripl/assets/publications/karaman11.pdf)</sup>

## References

1. [Anytime Heuristic Search (JAIR, Hansen & Zhou)](https://www.jair.org/index.php/jair/article/view/10489)
2. [ARA*: Anytime A* with Provable Bounds on Sub-Optimality (NeurIPS 2003)](https://proceedings.neurips.cc/paper/2003/file/ee8fe9093fbbb687bef15a38facc44d2-Paper.pdf)
3. [E. A. Hansen, R. Zhou (2007). Anytime Heuristic Search. Journal of Artificial Intelligence Research.](https://doi.org/10.1613/jair.2096)
4. [Anytime Search in Dynamic Graphs (Artificial Intelligence journal preprint, Likhachev et al.)](https://www.cs.cmu.edu/~maxim/files/ad_aij08_preprint.pdf)
5. [Anytime Heuristic Search: Frameworks and Algorithms (SoCS)](https://ojs.aaai.org/index.php/SOCS/article/download/18181/17972)
6. [On the Benefits of Randomly Adjusting Anytime Weighted A* (SoCS)](https://ojs.aaai.org/index.php/SOCS/article/download/18558/18347/22077)
7. [A-MHA*: Anytime Multi-Heuristic A* (arXiv 2025 posting of SoCS 2019 paper)](https://arxiv.org/html/2508.21637)
8. [Sandip Aine and colleagues (2015). Multi-Heuristic A*. The International Journal of Robotics Research.](https://doi.org/10.1177/0278364915594029)
9. [A-ePA*SE: Anytime Edge-Based Parallel A* for Slow Evaluations (arXiv preprint)](https://ar5iv.labs.arxiv.org/html/2305.04408)
10. [Mukherjee, Shohin, Aine, Sandip, Likhachev, Maxim (2022). ePA*SE: Edge-based Parallel A* for Slow Evaluations. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2203.01369)
11. [Mukherjee, Shohin, Likhachev, Maxim (2023). GePA*SE: Generalized Edge-Based Parallel A* for Slow Evaluations. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2301.10347)
12. [Anytime Dynamic A*: An Anytime, Replanning Algorithm (ICAPS 2005)](https://www.cs.cmu.edu/~ggordon/likhachev-etal.anytime-dstar.pdf)
13. [Anytime Motion Planning using the RRT*](https://ttic.edu/ripl/assets/publications/karaman11.pdf)
14. [Anytime Heuristic Search](https://mlanthology.org/jair/2007/hansen2007jair-anytime/)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Oct 15, 2026; Oct 25, 2026 · Last review: Sep 30, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods › Graph and network algorithms › Shortest paths

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/anytime-a

English original: https://www.edgepedia.org/anytime-a
