Skip to content

Latest commit

 

History

History
20 lines (17 loc) · 1.16 KB

Depth-Limited-Search.md

File metadata and controls

20 lines (17 loc) · 1.16 KB

DEPTH-LIMITED-SEARCH

AIMA3e

function DEPTH-LIMITED-SEARCH(problem,limit) returns a solution, or failure/cutoff
return RECURSIVE-DLS(MAKE-NODE(problem.INTIAL-STATE),problem,limit)

function RECURSIVE-DLS(node,problem,limit) returns a solution, or failure/cutoff
 if problem.GOAL-TEST(node.STATE) then return SOLUTION(node)
else if limit = 0 then return cutoff
else
   cutoff_occurred? ← false
   for each action in problem.ACTIONS(node.STATE) do
      child ← CHILD-NODE(problem,node,action)
      result ← RECURSIVE-DLS(child,problem,limit-1)
      if result = cutoff then cutoff_occurred? ← true
      else if resultfailure then return result
   if cutoff_occurred? then return cutoff else return failure


Figure ?? A recursive implementation of depth-limited tree search.