You are on page 1of 16

Artificial Intelligence

Uninformed Search Strategies


Contents
 Blind Search
 BFS
 DFS
 UCS
Blind Search
 have no additional information about states beyond that
provided in the problem definition
 All they can do is generate successors and distinguish a goal
state from a non-goal state.
 All search strategies are distinguished by the order in which
nodes are expanded.
Breadth-first search
 is an instance of the general graph-search algorithm
 shallowest unexpanded node is chosen for expansion
 uses a FIFO queue for the frontier
 A simple strategy
 the root node is expanded first, then
 all the successors of the root node are expanded next,
 then their successors, and so on.
 always has the shallowest path to every node on the frontier
BFS

Level 0

Level 1

Level 2

Level 3

5
Breadth-first search - Analysis
 Complete - if the shallowest goal node is at some finite depth
d, breadth-first search will eventually find it
 optimal - shallowest goal node is not necessarily the optimal
one - the same cost
 Time Complexity - O(bd)
 every state has b successors,
 Space Complexity – O(bd)
 O(bd−1) nodes in the explored set and O(bd) nodes in the
frontier
 the memory requirements are a bigger problem for breadth-
first search than is the execution time
Depth-first search
 expands the deepest node in the current frontier of the search
tree
 uses a LIFO queue
 most recently generated node is chosen for expansion
Depth-first search - Analysis
 Complete - not complete
 loop forever (or) fail if an infinite non-goal path is encountered
 optimal - not optimal
 Time Complexity - O(bm)
 m itself can be much larger than d (the depth of the shallowest solution)
 is infinite if the tree is unbounded
 Space Complexity – O(bm)
 to store only a single path from the root to a leaf node
 remaining unexpanded sibling nodes for each node on the path
Depth-first search
Uniform-cost search
 When all step costs are equal, breadth-first search is optimal
 algorithm that is optimal with any step-cost function
 Instead of expanding the shallowest node, expands the node n
with the lowest path cost.
 uses a Priority queue
 does not care about the number of steps a path has, but only
about their total cost
 goal test is applied to a
node when it is selected
for expansion
Uniform-cost search - Analysis
 Complete – yes, if, step cost is non-zero, positive
 infinite - if there is a path with an infinite sequence of zero-cost actions
 optimal - Yes, expands nodes in order of their optimal path cost
 Time Complexity – O(b1+[C∗/ϵ])
 Space Complexity –
 C∗ be the cost of the optimal solution, and assume that every
action costs at least ϵ
 When all step costs are equal, b1+C∗/ When all step costs are
equal, b1+[C∗/ϵ] is just bd+1
Depth-limited search
 The failure of depth-first search in infinite state spaces can be
alleviated by a predetermined depth limit l.
 nodes at depth l are treated as if they have no successors.
 The depth limit solves the infinite-path problem.
 In-completeness, if we choose l < d, the shallowest goal is
beyond the depth limit.
 Non-optimal, if we choose l > d
 Its time complexity is O(bl) and space complexity is O(bl).
 Depth-first search can be viewed as a special case of depth-
limited search with l=∞.
 depth limits can be based on knowledge of the problem
Iterative deepening DFS
 depth-first tree search that finds the best depth limit.
 gradually increase the limit — first 0, then 1, then 2, and so
on—until a goal is found.
 This will occur when the depth limit reaches d, the depth of the
shallowest goal node
 IDS combines the benefits of depth-first and breadth-first
search
 Like DFS, its memory requirements are modest: O(bd)
 Like BFS,
 complete when the branching factor is finite and
 optimal when the path cost is a non-decreasing function of the depth
of the node.
 number of nodes generated in the worst case
Iterative deepening DFS

In general, iterative deepening


is the preferred uninformed
search method when the search
space is large and the depth of
the solution is not known
Comparing uninformed search strategies

 b is the branching factor


 d is the depth of the shallowest solution
 m is the maximum depth of the search tree

a complete if b is finite


b complete if step costs ≥ for positive


c optimal if step costs are all identical
The End…

16

You might also like