---
title: 'HGS-PRM: Heuristic Greedy Search for PRMs'
url: https://www.emergentmind.com/topics/heuristic-greedy-search-algorithm-hgs-prm
type: topic
---

# HGS-PRM: Heuristic Greedy Search for PRMs

The Heuristic Greedy Search algorithm on a Probabilistic Roadmap (HGS-PRM) is a technique for efficiently answering multiple shortest-path queries on a fixed roadmap by augmenting classical PRM motion planning with a landmark-based admissible heuristic. By paying a one-time preprocessing cost to compute landmark-rooted shortest-path trees, HGS-PRM dramatically reduces per-query search effort, making it effective for multi-query scenarios commonly found in robotic motion planning. The method computes, stores, and exploits distance profiles from selected landmarks to produce a highly informative heuristic for use with the A* search procedure, resulting in query phase speed-ups and efficient search space pruning, particularly in cluttered or complex environments [1704.01886].

## 1. Preprocessing and Landmark Construction

The preprocessing phase selects a small set $L \subset V$ of $k$ landmarks from the PRM graph $G = (V, E)$, where typically $k \ll |V|$ (for example, $k = O(\log |V|)$ or a small constant such as $50$). Landmarks may be chosen uniformly at random from $V$ or via a farthest-point strategy, wherein each new landmark maximizes the graph distance to already selected landmarks. For each landmark $\ell \in L$, Dijkstra’s algorithm (or an equivalent single-source shortest-path algorithm) builds a shortest-path tree $T_\ell$ rooted at $\ell$ and computes an array $dist_\ell(v)$, the cost from $\ell$ to every $v \in V$. This preprocessing requires $O(k \cdot (E + V \log V))$ time and $O(k \cdot |V|)$ memory to store the distance arrays.

## 2. Heuristic Computation

HGS-PRM defines the landmark heuristic for any two vertices $v, w \in V$ as
$$
h(v,w) := \max_{\ell \in L} |dist_\ell(v) - dist_\ell(w)|.
$$
For the canonical query from source $s$ to target $t$, the per-node heuristic is $h(v) := h(v, t)$. By construction, the heuristic is admissible due to the triangle inequality: for each $\ell$, $|dist_\ell(v) - dist_\ell(t)| \leq d(v, t)$, where $d(v,t)$ is the actual shortest-path cost, and $\max$ preserves this upper bound. The heuristic is also consistent (monotone): for every edge $(u, v) \in E$, $h(u) \leq cost(u, v) + h(v)$, which ensures optimality in A* search. This property follows from the respective triangle inequality and the nonnegative edge weights.

## 3. Query Evaluation via A* Search

To answer a shortest-path query from $s$ to $t$, HGS-PRM uses A* search with the landmark-based heuristic $h(v)$. The algorithm maintains for each vertex $v$ a $g[v]$ value (cost from $s$ to $v$ found so far), parent pointers for path reconstruction, and $f[v] := g[v] + h(v)$. The search proceeds by expanding the node $v$ in $V$ with minimum $f[v]$ (using a priority queue), terminating upon expansion of $t$. For every neighbor $w$ of $v$, it updates $g[w]$ and parent pointers if a shorter path is found, adjusting $f[w]$ and the queue accordingly. Because the heuristic is consistent, the value $g[t]$ upon expansion is guaranteed optimal.

**Illustrative Example:**  
A 6-node PRM graph with nodes A–F and landmark set $L = \{\mathrm{B}, \mathrm{E}\}$ yields landmark distance arrays, and for a query $A \rightarrow F$, the computed heuristics demonstrate that A* search expands only 4 nodes, compared to the potential of 6 for exhaustive search, showing significant pruning power [1704.01886].

## 4. Complexity, Trade-offs, and Empirical Observations

HGS-PRM's one-time preprocessing cost is $O(k \cdot (E + V \log V))$ in time and $O(k \cdot |V|)$ in space. Per-query cost is $O(E + V \log V)$ in the worst case, matching A*, but is generally much smaller in practice if the heuristic is informative—per node expansion involves $O(\deg(v))$ edge checks and $O(k)$ work to evaluate $h(v)$. In contrast:

| Algorithm             | Preprocessing | Query Time      | Node Expansions          |
|-----------------------|---------------|-----------------|--------------------------|
| Dijkstra              | None          | $O(E + V \log V)$ | $\approx |V|$            |
| A* (Euclidean $h_E$)  | None          | $O(E + V \log V)$ | Up to $g + h_E \leq d(s,t)$ |
| HGS-PRM               | $O(k V \log V)$ | $O(E + V \log V)$ | $\ll |V|$ if $h$ is sharp |

Empirically, HGS-PRM achieves $5\times$–$20\times$ speed-ups in cluttered settings once $k \approx 50$–$100$, as the heuristic eliminates a significant fraction $\alpha$ of the search space. For $N = |V|$ and fraction $\alpha$ eliminated by $h$, A* explores $(1-\alpha)N$ nodes; Dijkstra explores $N$.

The break-even point depends on the number of queries $Q$: the total run-time is
$$
T_{\text{total}} = k \cdot (E + V \log V) + Q \cdot T_{\text{query}}.
$$
For $Q \gg k$, the amortized per-query cost becomes substantially less than running Dijkstra or A* with standard heuristics.

## 5. Multi-Query Applicability and Example Scenario

HGS-PRM is well suited for multi-query environments where the PRM graph remains static but many shortest-path queries must be answered between arbitrary pairs $s, t \in V$. Practical robotics tasks, including dynamic replanning in static environments (with moving obstacles or shifting start/goal positions), benefit significantly, as preprocessing investment is amortized over many queries.

In a representative 6-node example with edge weights and chosen landmarks, precomputed landmark distances enable the heuristic to sharply reduce the number of node expansions required for shortest-path queries. Only those nodes with optimal or near-optimal $f$-values are explored, in contrast to exhaustive methods.

## 6. Relationship to Classical Methods

Compared with Dijkstra's algorithm, which performs no preprocessing and typically expands all reachable nodes, and A* with naive Euclidean heuristics, which may provide weak guidance in cluttered graphs, HGS-PRM offers an advantageous balance in multi-query settings. Its heuristic is tailored to the topology and geometry of the actual roadmap, and consistently tight due to the triangle inequality’s application to multiple, strategically selected landmarks. The method does, however, require $O(k \cdot |V|)$ additional memory and preprocessing time, representing an explicit trade-off against per-query efficiency [1704.01886].

## 7. Limitations and Applicability Scope

The efficiency gains of HGS-PRM arise principally in scenarios dominated by many queries over the same PRM structure, with per-query cost decreasing as the number $Q$ of queries increases. In environments where the roadmap $G$ is frequently reconstructed or landmark distances become obsolete, or where the effective search space is already small, the amortization advantage diminishes. This suggests that HGS-PRM is most beneficial when $(Q \gg k)$ and the roadmap topology is sufficiently complex to justify a richer heuristic. A plausible implication is that environments with high clustering or labyrinthine connectivity stand to benefit most markedly from this approach [1704.01886].

Source: https://www.emergentmind.com/topics/heuristic-greedy-search-algorithm-hgs-prm