Informed search

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 6
Edit 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.
Step 1 of 15
RBFS(Arad, f_limit = ∞): Arad is not a goal; expand it: Sibiu (f = 393), Timisoara (f = 447), Zerind (f = 449).

Recursion tree open calls and their successors

f_limit ∞Arad366Sibiu393Timisoara447Zerind449
  • Current call
  • Stored successor
  • f_limit of the call

Pseudocode RBFS

function RECURSIVE-BEST-FIRST-SEARCH(problem) returns a solution, or failure
return RBFS(problem, MAKE-NODE(problem.INITIAL-STATE), ∞)
function RBFS(problem, node, f_limit) returns a solution, or failure and a new f-cost limit
if problem.GOAL-TEST(node.STATE) then return SOLUTION(node)(run in this step)
successors ← [ ](run in this step)
for each action in problem.ACTIONS(node.STATE) do(run in this step)
add CHILD-NODE(problem, node, action) into successors(run in this step)
if successors is empty then return failure, ∞(run in this step)
for each s in successors do/* update f with value from previous search, if any */(run in this step)
s.f ← max(s.g + s.h, node.f)(current step)
loop do
best ← the lowest f-value node in successors
if best.f > f_limit then return failure, best.f
alternative ← the second-lowest f-value among successors
result, best.f ← RBFS(problem, best, min(f_limit, alternative))
if result ≠ failure then return result

Open calls

  1. 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)

  • Current call
  • Stored successor
  • Goal state
  • h(n) estimate

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.

RBFSA* tree search
Expansions 1 repeated65
Nodes generated 3 regenerated1916
Memory RBFS: most nodes stored · A*: largest frontier1411
Solution cost 418418

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.
Lecture reference: Informed Search · slide 31