Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Agenda

Objectives:
• Uninformed Search Strategies
– Breadth-first Search
– Uniform-cost search
– Depth-first search
– Depth-limited search
– Iterative deepening depth-first search
– Bidirectional search
UNINFORMED SEARCH STRATEGIES:

Depth-first search:
• Always expands the deepest node in the current frontier of the
search tree.

• The search proceeds immediately to the deepest level of the search


tree, where the nodes have no successors

• Uses a LIFO Stack- the most recently generated (deepest


unexpanded) node is chosen for expansion

• Implementation:

• A recursive function that calls itself on each of its children in turn.

• fringe = LIFO Stack, i.e., put successors at front


UNINFORMED SEARCH STRATEGIES:

Depth-first search:
UNINFORMED SEARCH STRATEGIES:

Depth-first search:
UNINFORMED SEARCH STRATEGIES:
Properties of Depth-first search:
• Complete??
• No: fails in infinite-depth spaces, spaces with loops
• Modify to avoid repeated states along path complete infinite spaces
• Time??
• It is bounded by the size of the state space
• O(bm): where m is the maximum depth of any node and it is terrible
if m is much larger than d
• but if solutions are dense, may be much faster than breadth-first
• Space??
• O(bm), i.e., linear space!
• Optimal??
• Depth first search will explore the entire left subtree even if node C
is a goal node, which would be a better solution; hence, depth-first
search is not optimal
UNINFORMED SEARCH STRATEGIES:
Depth-limited search:
• It is a depth-first search with a predetermined depth limit l to solves the infinite-
path problem
• Nodes at depth l are treated as if they have no successors.
UNINFORMED SEARCH STRATEGIES:
Depth-limited search:
• DEPTH-LIMITED-SEARCH: This function initializes the depth-limited
search process by creating a root node from the initial state of the
problem and then calls the recursive DLS function.
• RECURSIVE-DLS: This function recursively explores the search space
up to a specified depth limit. It takes three parameters: the current node,
the problem instance, and the depth limit.
• If the current node satisfies the goal test, it returns a solution.
• If the depth limit is reached (limit = 0), it returns a cutoff.
• Otherwise, it iterates over all possible actions from the current state,
generates child nodes for each action, and recursively calls itself with
the child nodes and a reduced depth limit.
• If the recursive call returns a cutoff, it marks that a cutoff occurred.
• If the recursive call returns a non-failure result, it returns that result.
• If a cutoff occurred during any of the recursive calls, it returns a
cutoff.
• If none of the above conditions are met, it returns failure, indicating
that no solution was found within the depth limit.
UNINFORMED SEARCH STRATEGIES:
Depth-limited search:
• Unfortunately,
– It introduces an additional source of incompleteness if we
choose l < d, that is, the shallowest goal is beyond the
depth limit.

– It is nonoptimal if we choose l > d. Its time complexity is


O(bl) and its space complexity is O(bl).
UNINFORMED SEARCH STRATEGIES:
Iterative deepening depth-first search:
• A general strategy, used with depth-first tree search, that finds
the best depth limit.
• It does this by gradually increasing the limit—first 0, then 1,
then 2, and so on—until a goal is found.
• Iterative deepening combines the benefits of depth-first and
breadth-first search.
UNINFORMED SEARCH STRATEGIES:
Iterative deepening depth-first search:
Four iterations of iterative deepening search on a binary tree:
UNINFORMED SEARCH STRATEGIES:
Iterative deepening depth-first search:
Four iterations of iterative deepening search on a binary tree:
UNINFORMED SEARCH STRATEGIES:
Iterative deepening depth-first search:
Four iterations of iterative deepening search on a binary tree:
UNINFORMED SEARCH STRATEGIES:
Iterative deepening depth-first search:
Properties of iterative deepening search:
• Complete?? It is complete when the branching factor is finite
and optimal when the path cost is a nondecreasing function of
the depth of the node
• Time?? (d + 1)b0 + db1 + (d - 1)b2 + : : : + bd = O(bd)
– asymptotically same as breadth-first search.
• Space?? O(bd)
• Optimal?? Yes, if step cost = 1
• Can be modified to explore uniform-cost tree
UNINFORMED SEARCH STRATEGIES:
Bidirectional search:
 The idea behind bidirectional search is to run two simultaneous
searches—one forward from the initial state and the other backward
from the goal—hoping that the two searches meet in the middle

 Replace the goal test with a check to see whether the frontiers of the
two searches intersect; if they do, a solution has been found.
UNINFORMED SEARCH STRATEGIES:
Comparing uninformed search strategies:

You might also like