A* Search with Inconsistent Heuristics

Zhifu Zhang, Nathan R. Sturtevant, Robert C. Holte, Jonathan Schaeffer, Ariel Felner

Abstract

For decades, the use of inconsistent heuristics in A search was discouraged due to theoretical worst-case exponential complexity. This paper challenges that convention by demonstrating that such "pathological" cases are rare in practice and providing new polynomial complexity bounds for common graph structures like square grids. Furthermore, we adapt the Bidirectional Pathmax (BPMX) technique to A, showing that it effectively mitigates re-expansions and significantly improves search performance across various domains, including commercial game maps.

Introduction

In pathfinding, the A algorithm is the standard for finding optimal paths, typically relying on consistent heuristics that satisfy the triangle inequality. Historically, researchers avoided inconsistent heuristics because early theoretical work by Martelli (1977) proved they could force A to re-expand the same nodes an exponential number of times ($O(2^N)$). This led to the development of complex variants like B, C, and B' designed to cap re-expansions at $O(N^2)$. However, modern memory-based and randomized heuristics often produce inconsistent values. This research investigates whether the $O(2^N)$ threat is relevant in practice and proposes methods to handle inconsistent heuristics more efficiently.

Complexity Analysis: The Myth of Exponential Doom

The authors re-examined the worst-case scenarios that lead to exponential growth. They proved that for A* to hit $O(2^N)$ expansions, the edge weights and heuristic values must grow exponentially relative to the graph size—a structure rarely found in real-world applications.

Figure 1: A pathological graph structure designed to force exponential re-expansions in A* search, requiring specific, unnatural cost and heuristic distributions.

For most practical problems, such as grids with fixed costs, the authors proved that A* is actually $O(N^2)$ or better. Specifically, for square grids, the worst-case complexity is shown to be $O(N^{1.5})$, far more manageable than previously feared.

Algorithmic Improvements: BPMX in A*

A key contribution of this work is the adaptation of Bidirectional Pathmax (BPMX) to the A framework. While standard A primarily looks "forward," BPMX allows the search to propagate high heuristic values discovered deep in the tree back to parents and across to siblings.

Figure 2: BPMX propagation allows high heuristic values to spread from children to parents and siblings, effectively pruning the search space.

As shown in the figure above, if a child node $v_1$ has a high (but admissible) heuristic value, BPMX updates the parent $u$ and subsequently the sibling $v_2$. This "spreading" of information allows A* to prune large sections of the search tree that it would otherwise have to explore or re-expand.

Experimental Evaluation

The authors evaluated A with BPMX against standard A and older variants (B, C, B') using three primary setups:

  1. Game Maps: 116 maps from commercial video games using differential heuristics.
  2. Degraded Perfect Heuristics: 1000x1000 grids where nodes have perfect distance values with probability $p$, and 0 otherwise.
  3. Checkerboard Heuristics: Grids with locally consistent but globally inconsistent heuristic regions.

Key Results and Discussion

  • Reduction in Re-expansions: In "Perfect Heuristic" experiments, standard A* performed over 676,000 expansions. Adding BPMX reduced this to just 991 expansions—a massive improvement in efficiency.
  • Wall-Clock Speedups: On game maps, A with BPMX was approximately 5x faster than standard A. It also outperformed variants like A Max; while A Max expands fewer nodes, the overhead of calculating multiple heuristics at every node makes it slower in practice than the BPMX approach.
  • Tie-Breaking Logic: The study found that older variants like Algorithm B' often performed worse than standard B because their heuristic update mechanisms interfered with efficient tie-breaking logic.

Conclusion

This research demonstrates that inconsistent heuristics are not the "monsters" they were once considered. By using BPMX, A* can handle inconsistent values with high efficiency, often outperforming specialized algorithms designed specifically for inconsistency. Future work remains to explore the trade-offs in massive state spaces where memory is the primary bottleneck and to refine these techniques for strictly directed graphs.

Summary updated

BibTeX
@inproceedings{zhang2009search,
  author = {Zhifu Zhang and Nathan R. Sturtevant and Robert C. Holte and Jonathan Schaeffer and Ariel Felner},
  title = {{A* Search with Inconsistent Heuristics}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2009},
}
Figure