Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 1.3 KB

Recursive-Best-First-Search.md

File metadata and controls

23 lines (20 loc) · 1.3 KB

RECURSIVE-BEST-FIRST-SEARCH

AIMA3e

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)
successors ← []
for each action in problem.ACTIONS(node.STATE) do
   add CHILD-NODE(problem,node,action) into successors
if successors is empty then return failure,∞
for each s in successors do /* update f with value from previous search, if any */
   s.f ← max(s.g + s.h, node.f)
loop do
   best ← 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 resultfailure then return result


Figure ?? The algorithm for recursive best-first search.