On the Properties of All-Pair Heuristics

Shahaf S. Shperberg, Ariel Felner, Lior Siag, Nathan R. Sturtevant

While we usually think of heuristics as being "consistent" if they obey a version of the triangle inequality, this paper reveals a surprising gap: a heuristic can be consistent without actually obeying the triangle inequality itself. Presented at SoCS 2024, the authors introduce $\Delta$-consistency to bridge this gap and propose a new method (HDH) to "repair" weak heuristics, potentially saving A* from unnecessary work.

What Problem Does This Paper Address?

In pathfinding and combinatorial search, we use heuristics ($h$) to estimate the distance to a goal. Most research focuses on goal-specific heuristics (e.g., "how far is it from here to the exit?"). However, many modern systems use all-pair heuristics (e.g., "how far is it between any two points?"), such as airline distance on a map or Pattern Databases (PDBs).

The gold standard for a "good" heuristic is consistency. Formally, a heuristic is consistent if the estimated distance between two points is never greater than the actual cost of a step plus the estimated distance from that next step.

The authors noticed a subtle but important nuance: in the all-pairs case, a heuristic can be "consistent" by the standard definition but still violate the triangle inequality (where the direct estimate $h(u,v)$ is somehow larger than the sum of two intermediate estimates $h(u,p) + h(p,v)$). This mathematical "glitch" means A* might expand more nodes than it theoretically needs to.

Methods

The paper introduces two major contributions:

  1. $\Delta$-consistency: A new, stronger property for all-pair heuristics. A heuristic is $\Delta$-consistent if it is both admissible (never overestimates) and satisfies the triangle inequality ($h(u,v) \le h(u,p) + h(p,v)$) for all triplets of states.
  2. Heuristic-Differential Heuristic (HDH): A novel algorithm to transform a standard consistent heuristic into a $\Delta$-consistent one. It works by using "pivots"—intermediate nodes—to find better lower bounds. If you have a pivot $v$, you can refine your estimate between $u$ and $p$ by looking at the difference between their respective heuristic distances to $v$.
The hierarchy of heuristic properties, showing $\Delta$-consistency as the strongest requirement.

The authors provide a hierarchy of heuristic properties, showing that $\Delta$-consistency is the "top tier" of the pyramid, sitting above standard consistency and admissibility.

Key Insights and Ideas

  • The "Mixed" Property Trap: Standard consistency is a "mixed" property because it compares the heuristic ($h$) to the true graph distance ($d$). $\Delta$-consistency is an "internal" property because it only looks at $h$.
  • A* is Not Always Optimal: A famous 1985 proof states that A is optimally efficient when given a consistent heuristic. However, the authors point out this proof assumes a goal-specific heuristic. If you give A an all-pair heuristic that isn't $\Delta$-consistent, A* might be "tricked" into expanding nodes it could have skipped if it had leveraged the full pairwise information.
  • Natural $\Delta$-consistency: In a bit of a "good news/bad news" twist, the authors proved that almost all common heuristic techniques (PDBs, Merge-and-shrink, etc.) are already $\Delta$-consistent. This means the HDH method won't improve them, but it also explains why they perform so well in practice.

Key Results

  • Lemma 1: Proves that $\Delta$-consistency is a strictly stronger property; every $\Delta$-consistent heuristic is guaranteed to be consistent, but the reverse is not true.
  • Lemma 3: Proves that all abstraction-based heuristics (a massive category in AI search) inherently obey the triangle inequality.
  • Search Efficiency: In their synthetic example, using the HDH-enhanced heuristic allowed A* to skip an expansion that the "standard" consistent heuristic would have required.
A synthetic search graph where a $\Delta$-consistent heuristic allows A* to skip unnecessary node expansions.

This demonstrates that $\Delta$-consistency is not just a mathematical curiosity—it has real implications for search speed.

Limitations and Future Work

The biggest limitation acknowledged by the authors is the "Search for the White Whale." Despite their best efforts, they could not find a single "natural" (non-synthetic) heuristic used in the field today that is consistent but not $\Delta$-consistent.

Future Work includes: * Investigating if there are natural mechanisms (like specific types of machine-learned heuristics) that produce consistent but non-$\Delta$-consistent values. * Formally re-evaluating the optimality of A* when equipped with all-pair heuristics. * Exploring the computational trade-off of HDH: calculating the "max" over many pivots can be expensive, so finding the right balance between heuristic strength and computation time is key.

Summary updated

Abstract

While most work in heuristic search concentrates on goal-specific heuristics, which estimate the shortest path cost from any state to the goal, we explore all-pair heuristics that estimate distances between all pairs of states. We examine the relationship between these heuristic functions and the shortest distance function they estimate, revealing that all-pair consistent heuristics may violate the triangle inequality. Thus, we introduce a new property for heuristics called Δ-consistency, requiring adherence to the triangle inequality. Additionally, we present a method for transforming standard consistent heuristics to be Δ-consistent, showcasing its benefits through a synthetic example. We then show that common heuristic families inherently exhibit Δ-consistency. This positive finding encourages the use of all-pair consistent heuristics, and prompts further investigation into the optimality of A*, when given an all-pair heuristic instead of a goal-specific heuristic.
BibTeX
@inproceedings{shperberg2024properties,
  author = {Shahaf S. Shperberg and Ariel Felner and Lior Siag and Nathan R. Sturtevant},
  title = {{On the Properties of All-Pair Heuristics}},
  booktitle = {SOCS},
  year = {2024},
  doi = {10.1609/socs.v17i1.31550},
}
Figure