Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

RBFS

Also known as Recursive best-first search

search heuristic-search

RBFS (Recursive Best-First Search) finds a cheapest path in memory linear in the search depth. It keeps only the current path and the siblings of its nodes. It goes down into the child with the smallest backed-up value F (the smallest f found below it so far), while that value stays within a bound: the smaller of the parent's bound and the second-best sibling's F. When a subtree exceeds its bound, it returns its smallest leaf value to the parent, which then switches to the best sibling. With an admissible heuristic (one that never overestimates) the path is optimal; the cost is that it regenerates subtrees when it comes back to them.

Pseudocode

algorithm RBFS(s₀, goal, h)input: start state s₀, goal test goal, admissible heuristic houtput: a cheapest path to a goal, or failureg[s₀] ← 0result, F ← search(s₀, h(s₀), ∞)return resultfunction search(s, F-s, bound)if goal(s) thenreturn path-to(s), F-sC ← successors of s that are not on the current pathif C = ∅ thenreturn failure, ∞for each child c in C dof ← g[c] + h(c)if F-s > g[s] + h(s) then                  ▷ s was searched before: pass its value downF[c] ← max(F-s, f)elseF[c] ← frepeatb ← the child in C with the smallest F[b]if F[b] > bound or F[b] = ∞ thenreturn failure, F[b]                     ▷ the parent remembers this backed-up valuea ← the second-smallest F in C, or ∞result, F[b] ← search(b, F[b], min(bound, a))if result ≠ failure thenreturn result, F[b]until false

In the crates

  • heuristic-search

    Recursive best-first search, optimal with an admissible heuristic in memory linear in the depth, iterative so deep paths cannot overflow the stack.

    rbfs

Papers

  1. Linear-space best-first search Richard E. Korf · 1993· Artificial Intelligence introduces doi 10.1016/0004-3702(93)90045-D