Depth limited search calls its recursive
partner RECURSIVE-DLS to search the search tree using a depth limit.
RECURSIVE-DLS implements the TREE-SEARCH algorithm using depth first search
with a depth limit.
You can see the
effect of the depth limit in the
else if statement, the 4
th line in the RECURSIVE-DLS method() .
Here, if the depth limit is reached, a flag
cutoff
is returned to the caller (either DEPTH-LIMITED-SEARCH or RECURSIVE-DLS).
In the latter case, RECURSIVE-DLS backtracks
and has to try another successor if possible.
In the former (when
cutoff is returned to the calling function
DEPTH-LIMIT-SEARCH, the search tree (to depth
limit) has been entirely explored
and exhausted for goal states.
The depth limit
limit is propagated in each recursive call and does not
change (is invariant).
The Depth[node]
call in line 4 retrieves the node’s depth and checks it with the limit.