Lec05 Uninformed Search
Lec05 Uninformed Search
strategies
A search strategy is defined by
picking the order of node expansion
Uninformed search strategies use
only the information available in the
problem definition
Breadth-first search
Depth-first search
Iterative deepening search
Uniform-cost search
Breadth-first search
Expand shallowest unexpanded node
Implementation: frontier is a FIFO queue
Example state
space graph for a
tiny search
problem
Breadth-first search
Expansion order:
(S,d,e,p,b,c,e,h,r,
q,a,a,
h,r,p,q,f,p,q,f,q,c,
G)
Depth-first search
Expand deepest unexpanded node
Implementation: frontier is a LIFO queue
Depth-first search
Expansion
order:
(d,b,a,c,a,e,h,p,
q,q, r,f,c,a,G)
http://xkcd.com/761/
Properties of breadth-first
search
Complete?
Yes (if branching factor b is finite)
Optimal?
Yes if cost = 1 per step
Time?
Number of nodes in a b-ary tree of depth d: O(bd)
(d is the depth of the optimal solution)
Space?
O(bd)
Optimal?
No returns the first solution it finds
Time?
Could be the time to reach a solution at maximum depth m:
O(bm)
Terrible if m is much larger than d
But if there are lots of solutions, may be much faster than BFS
Space?
O(bm), i.e., linear space!
Optimal?
Yes, if step cost = 1
Time?
(d+1)b0 + d b1 + (d-1)b2 + + bd = O(bd)
Space?
O(bd)
Uniform-cost search
For each frontier node, save the total cost
of the path from the initial state to that
node
Expand the frontier node with the lowest
path cost
Implementation: frontier is a priority queue
ordered by path cost
Equivalent to breadth-first if step costs all
equal
Equivalent to Dijkstras algorithm in general
Uniform-cost search
example
Uniform-cost search
example
Expansion order:
(S,p,d,b,e,a,r,f,e,G)
Source: Wikipedia
Properties of uniform-cost
search
Complete?
Yes, if step cost is greater than some positive
constant (we dont want infinite sequences of
steps that have a finite total cost)
Optimal?
Yes
Optimality of uniform-cost
search
Properties of uniform-cost
search
Complete?
Yes, if step cost is greater than some positive constant
(we dont want infinite sequences of steps that have a
finite total cost)
Optimal?
Yes nodes expanded in increasing order of path cost
Time?
Number of nodes with path cost cost of optimal
solution (C*), O(bC*/ )
This can be greater than O(bd): the search can explore
long paths consisting of small steps before exploring
shorter paths consisting of larger steps
Space?
O(bC*/ )