Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

A*

Also known as A star

search heuristic-searchconnector-routingdecoupled-searchminiplan

A* finds a cheapest path from a start state to a goal. It always expands the open state with the lowest f = g + h: g is the cost of the best path found to the state, and h estimates the remaining cost to the goal. If h never overestimates (it is admissible), the first path to a goal that A* expands is optimal. A better estimate means fewer expansions; with h = 0, A* is Dijkstra's algorithm.

See it run

1/61

The start state is the only open state.

A* on a small example.Open states are expanded by f = g + h, with h the Manhattan distance to the goal. openclosedexpandingpathwallcostly cell

Pseudocode

algorithm A*(s₀, goal, h)input: start state s₀, goal test goal, heuristic houtput: a cheapest path to a goal state, or failureg[s₀] ← 0OPEN ← {s₀}                                  ▷ ordered by f = g + hwhile OPEN ≠ ∅ dos ← extract-min(OPEN)if goal(s) thenreturn path-to(s)for each (s′, c) in successors(s) doif g[s] + c < g[s′] then                 ▷ g of an unseen state is ∞g[s′] ← g[s] + cparent[s′] ← sinsert-or-update(OPEN, s′, g[s′] + h(s′))   ▷ reopens a closed statereturn failure

In the crates

  • heuristic-search

    Best-first search ordered by g + h, optimal with an admissible heuristic.

    a_star

  • connector-routing

    Single-connector routing by A* over (vertex, heading) with an exact free-space bend estimate and weighted or lexicographic length/bend objectives.

    route

  • decoupled-search

    Cost-optimal A* over decoupled states, guided by a decoupled heuristic.

    astar

  • miniplan

    A* with pluggable heuristics over the grounded task (optimal).

    Astar

Lineage

Comes from

generalizes Dijkstra's algorithm

Led to

1-bend visibility graph builds on it

Anytime A* builds on it

BDDA* builds on it

BOA* builds on it

EPEA* builds on it

Focal search generalizes it

Incremental poly-line routing builds on it

Jump Point Search builds on it

LazySP builds on it

LPA* builds on it

LSS-LRTA* combines it

M* builds on it

NAMOA* generalizes it

PathFinder builds on it

Reachability-guided A* builds on it

SMA* builds on it

Space-Time A* builds on it

Theta* builds on it

Weighted A* generalizes it

Papers

  1. A Formal Basis for the Heuristic Determination of Minimum Cost Paths Peter E. Hart, Nils J. Nilsson, Bertram Raphael · 1968· IEEE Transactions on Systems Science and Cybernetics introduces doi 10.1109/TSSC.1968.300136