Recursive best-first search
Runs recursive best-first search (RBFS) on a graph one step at a time: the recursion path with each call’s f_limit and the backed-up f values, the state space, the pseudocode line, and node counts next to A* on the same problem.
- Lecture reference: Informed Search · slide 4
- Lecture reference: Informed Search · slides 16–22
The Informed Search slides only name RBFS Lecture reference: Informed Search · slide 4. The algorithm, the pseudocode, and the Romania example follow Russell & Norvig, Artificial Intelligence: A Modern Approach, 3rd ed., Section 3.5.3, Figures 3.26–3.27.
Problem 20 states · 23 edges
- Start
- Arad
- Goal
- Bucharest
- h(n)
- Straight-line distance to Bucharest
Admissible h(n) ≤ h*(n) for every state, so RBFS returns a cheapest path.
Romania: Arad to Bucharest. Straight-line distance to Bucharest, as in Russell & Norvig’s Figure 3.27: Rimnicu Vilcea is expanded with f_limit 415 and backs up 417, Fagaras backs up 450, then Rimnicu Vilcea is expanded again and Bucharest is reached through Pitesti (cost 418).
Lecture reference: Informed Search · slide 6Edit graph
Tree search can go around a cycle forever when no goal is reachable; the run stops after this many expansions.
Recursive best-first search
- A best-first search in linear space: it follows the path with the lowest f(n) = g(n) + h(n) depth first and keeps only the nodes of the open calls and their successors.
- Each call has an f_limit: the f value of the best alternative path available from any ancestor of the node. When the best successor’s f exceeds it, the call returns failure and its subtree is forgotten.
- The returned value, the best f in the forgotten subtree, replaces the node’s f (a backed-up value). The search can then tell whether that subtree is worth expanding again later.
- A regenerated successor gets f = max(g + h, f of its parent), so a backed-up value carries over to the nodes below it.
Recursion tree open calls and their successors
Pseudocode RBFS
Open calls
- RBFS(Arad, f_limit = ∞) f = 366
Russell & Norvig, Figure 3.26. A call whose best successor has f = ∞ returns failure, ∞ even when f_limit = ∞; as printed, the loop would call that successor again forever. Ties go to the first successor in alphabetical order.
State space with h(n)
Counts up to this step
- Expansions
- 1
- Nodes generated
- 4
- Nodes stored
- 4 most 4
- Call depth
- 0 deepest 0
Stored: the root plus the successors of every open call, O(bd). A node generated again after its subtree was forgotten counts as regenerated.
With focus in the tool: ← → previous and next step, Home End first and last step, Space play or pause.
RBFS and A* whole run, same problem
Solution Solution: Arad → Sibiu → Rimnicu Vilcea → Pitesti → Bucharest (cost 418). 6 expansions (1 repeated), 19 nodes generated (3 regenerated), deepest call at depth 4, at most 14 nodes stored.
Cheapest path No path from Arad to a goal costs less.
| RBFS | A* tree search | |
|---|---|---|
| Expansions 1 repeated | 6 | 5 |
| Nodes generated 3 regenerated | 19 | 16 |
| Memory RBFS: most nodes stored · A*: largest frontier | 14 | 11 |
| Solution cost | 418 | 418 |
A* (Informed Search, slides 16–22) keeps every node it generates and never generates one twice; RBFS keeps the current path and its siblings and regenerates forgotten subtrees. Lecture reference: Informed Search · slide 31
Notes
Properties
- Optimal if h(n) is admissible, like A* tree search.
- Space: O(bd), linear in the depth of the deepest path it follows.
- Time: hard to characterize. It depends on how accurate h is and how often the best path changes as nodes are expanded; RBFS can regenerate the same nodes many times.
- Tree search: it has no explored set, so a state can appear on the path more than once (Sibiu → Arad).
Compared with A* and IDA*
- A* keeps every node it generates, so its memory grows exponentially, but it never generates a node twice. RBFS keeps O(bd) nodes and pays for it with regenerated nodes.
- IDA* (iterative deepening A*) also runs in linear space: it repeats depth-first searches with an f cutoff, raising the cutoff each time to the smallest f that exceeded it, without RBFS’s backed-up values.