Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Greedy best-first search

Also known as GBFS, symbolic greedy best-first search

search decoupled-searchsymbolic-searchminiplanheuristic-search

Greedy best-first search always expands the open state with the lowest heuristic value h, the estimated cost to the goal. It ignores the cost g of the path so far, and it does not reopen a state when it finds a cheaper path to it. It stops at the first goal it finds, so the solution is valid but not necessarily cheapest (it is satisficing, not optimal). With duplicate detection on a finite state space it always finds a solution if one exists (it is complete). Use it when a fast solution matters more than its cost; with a good heuristic such as hFF it often expands far fewer states than A*.

See it run

1/21

The start state is the only open state.

Greedy best-first search on a small example.Open states are expanded by their estimated distance to the goal alone, h. openclosedexpandingpathwallcostly cell

Pseudocode

algorithm GBFS(s₀, goal, h)input: start state s₀, goal test goal, heuristic houtput: a path to a goal state, or failureOPEN ← {s₀}                              ▷ ordered by h aloneSEEN ← {s₀}while OPEN ≠ ∅ dos ← extract-min(OPEN)if goal(s) thenreturn path-to(s)for each (s′, c) in successors(s) doif s′ ∉ SEEN then                    ▷ a known state is never reopenedSEEN ← SEEN ∪ {s′}parent[s′] ← sinsert(OPEN, s′, h(s′))return failure

In the crates

  • decoupled-search

    Satisficing greedy best-first search over decoupled states, optionally with reachability-only leaves.

    gbfs

  • symbolic-search

    Symbolic greedy best-first search with heuristics stored as one BDD per h value.

    greedy

  • miniplan

    Greedy best-first search over the grounded task (fast, non-optimal).

    Gbfs

  • heuristic-search

    Greedy best-first search ordered by the heuristic alone.

    gbfs