written 6.2 years ago by |
In order to avoid the infinite loop condition arising in DFS, in depth limited search technique, depth-first search is carried out with a predetermined depth limit.
As in case of DFS in DLS we can use the same fringe implemented as queue.
Additionally the level of each node needs to be calculated to check whether it is within the specified depth limit.
Depth-limited search can terminate with two conditions:
If the solution is found.
If there is no solution within given depth limit.
Process: If depth is fixed to 2, DLS carries out depth first search till second level in the search tree.
Algorithm:
Determine the start node and the search depth.
Check if the current node is the goal node.
If not: Do nothing
If yes:return
- Check if the current node is within the specified search depth
If not: Do nothing
If yes:Expand the node and save all of its successors in a stack.
- Call DLS recursively for all nodes of the stack and go back to step 2.
Performance evaluation:
Completeness: Its complete if shallowest goal is beyond the depth limit.
Optimality: Non optimal, as the depth chosen can be greater than d.
Time complexity: Same as DFS, O(b1), where 1 is the specified depth limit.
Space Complexity: Same as DFS, O(b1), where 1 is specified depth limit.