CS 371: Introduction to Artificial Intelligence
 Recursive Best-First Search

A*
 Recall: Best-First Search with f(n) = g(n) + h(n) is A* A* finds optimal solution if h(n) never overestimates A*’s serious limitation: memory requirement (often exponential) A*’s second limitation: keeping candidate nodes sorted (O(log N) per node, N number of nodes)

Iterative Deepening A*
 A series of depth-first searches bounded by iteratively increasing f limit. If f is monotonic (f(child) >= f(parent)), then IDA* expands nodes in best-first order. IDA* space requirement – O(bd) IDA* node generation- O(1)

IDA*
 IDASTAR (node : N, bound : B) IF N is a goal, EXIT algorithm IF N has no children, RETURN infinity FN = infinity FOR each child Ni of N, F[i] := f(Ni) IF f(Ni) <= B, FN := MIN(FN, IDASTAR(Ni,B)) ELSE FN := MIN(FN, f(Ni)) RETURN FN

IDA* Outer Loop
 IDASTARSEARCH (node : N) B := f(N); WHILE (TRUE) B := IDASTAR(N, B)

IDA* Limitations
 If f is not monotonic, IDA* no longer expands nodes in best-first order When searching nodes with f-values less than current threshold, search procedes depth-first. f-values of such nodes are ignored in search ordering Example: Fig. 2 tree fragment Other major limitation: many distinctive f-values à much re-expansion

Recursive Best-First Search
 Recursive best-first search (RBFS): O(bd)-space algorithm Expands best-first even without monotonic cost function Generates fewer nodes than iterative deepening with a monotonic cost function

SRBFS
 Simple RBFS (SRBFS) Local cost threshold for each recursive call Has inefficiencies to be addressed in RBFS, but good intro for teaching purposes Work the following algorithms with binary tree where f(n) = depth(n)

SRBFS
 SRBFS (node : N, bound : B) IF f(N)>B, RETURN f(N) IF N is a goal, EXIT algorithm IF N has no children, RETURN infinity FOR each child Ni of N, F[i] := f(Ni) sort Ni and F[i] in increasing order of F[i] IF only one child, F[2] := infinity WHILE (F[1] <= B and F[1] < infinity) F[1] := SRBFS(N1, MIN(B, F[2])) Insert N1 and F[1] in sorted order RETURN F[1]

RBFS
 RBFS (node : N, value: F(N), bound : B) IF f(N)>B, RETURN f(N) IF N is a goal, EXIT algorithm IF N has no children, RETURN infinity FOR each child Ni of N IF f(N)