Uninformed Search
Strategies
LECTURE 4
Search strategies
25
⚫ A search strategy is defined by picking the order of node
expansion
⚫ Strategies are evaluated along the following dimensions:
completeness: does it always find a solution if one exists?
time complexity: number of nodes generated
space complexity: maximum number of nodes in memory
optimality: does it always find a least-cost solution?
⚫ Time and space complexity are measured in terms of
b: maximum branching factor of the search tree
d: depth of the least-cost solution
m: maximum depth of the state space (may be ∞)
Uninformed search strategies
27
⚫ Uninformed search strategies use only the information
available in the problem definition
⚫ Uninformed search (blind search)
Breadth-first search
Depth-first search
Depth-limited search
Iterative deepening search
Uniformed cost search
Breadth-first search
28
⚫ Expand shallowest unexpanded node
⚫ Implementation:
is a FIFO queue, i.e., new successors go at end
Breadth-first search
29
⚫ Expand shallowest unexpanded node
⚫ Implementation:
is a FIFO queue, i.e., new successors go at end
Breadth-first search
30
⚫ Expand shallowest unexpanded node
⚫ Implementation:
is a FIFO queue, i.e., new successors go at end
Breadth-first search
31
⚫ Expand shallowest unexpanded node
Implementation:
is a FIFO queue, i.e., new successors go at end
Properties of breadth-first search
32
⚫ Complete? Time? Space? Optimal?
⚫ Complete? Yes (if b is finite)
⚫ Time? 1+b+b2+b3+… +bd + b(bd-1) = O(bd+1)
⚫ Space? O(bd+1) (keeps every node in memory)
⚫ Optimal? Yes (if cost = 1 per step)
⚫ Space is the bigger problem (more than time)
Depth-first search
33
⚫ Expand deepest unexpanded node
⚫ Implementation:
LIFO queue, i.e., put successors at front
Depth-first search
34
⚫ Expand deepest unexpanded node
⚫ Implementation:
LIFO queue, i.e., put successors at front
Depth-first search
35
⚫ Expand deepest unexpanded node
⚫ Implementation:
LIFO queue, i.e., put successors at front
Depth-first search
36
⚫ Expand deepest unexpanded node
⚫ Implementation:
frontier = LIFO queue, i.e., put successors at front
Depth-first search
37
⚫ Expand deepest unexpanded node
⚫ Implementation:
LIFO queue, i.e., put successors at front
Depth-first search
38
⚫ Expand deepest unexpanded node
⚫ Implementation:
LIFO queue, i.e., put successors at front
Depth-first search
39
⚫ Expand deepest unexpanded node
⚫ Implementation:
LIFO queue, i.e., put successors at front
Depth-first search
40
⚫ Expand deepest unexpanded node
⚫ Implementation:
LIFO queue, i.e., put successors at front
Depth-first search
41
⚫ Expand deepest unexpanded node
⚫ Implementation:
LIFO queue, i.e., put successors at front
Depth-first search
42
⚫ Expand deepest unexpanded node
⚫ Implementation:
LIFO queue, i.e., put successors at front
Depth-first search
43
⚫ Expand deepest unexpanded node
⚫ Implementation:
LIFO queue, i.e., put successors at front
Depth-first search
44
⚫ Expand deepest unexpanded node
⚫ Implementation:
LIFO queue, i.e., put successors at front
Properties of depth-first search
45
⚫ Complete? Time? Space? Optimal?
⚫ Complete? No: fails in infinite-depth spaces, spaces with loops
Modify to avoid repeated states along path (graph search)
□ complete in finite spaces
⚫ Time? O(bm): terrible if maximum depth m is much larger than solution
depth d
but if solutions are dense, may be much faster than breadth-first
⚫ Space? O(bm), i.e., linear space! Store single path with unexpanded
siblings.
Optimal? No.
Important for exploration (on-line search)
Depth-limited search
46
⚫ depth-first search with depth limit l,
i.e., nodes at depth l have no successors
Solves infinite loop problem
⚫ Common AI strategy: let user choose search/resource bound.
Complete? No if l < d:
⚫ Time? O(bl):
⚫ Space? O(bl), i.e., linear space!
⚫ Optimal? No if l > b
Iterative deepening search
47
Iterative deepening search l =0
48
Iterative deepening search l =1
49
Iterative deepening search l =2
50
Iterative deepening search l =3
51
Iterative deepening search
52
⚫ Number of nodes generated in a depth-limited search to depth d
with branching factor b:
NDLS = b0 + b1 + b2 + … + bd-2 + bd-1 + bd
⚫ Number of nodes generated in an iterative deepening search to
depth d with branching factor b:
NIDS = (d+1)b0 + d b1 + (d-1)b2 + … + 3bd-2 +2bd-1 + 1bd
⚫ For b = 10, d = 5,
NDLS = 1 + 10 + 100 + 1,000 + 10,000 + 100,000 = 111,111
NIDS = 6 + 50 + 400 + 3,000 + 20,000 + 100,000 = 123,456
⚫ Overhead = (123,456 - 111,111)/111,111 = 11%
Properties of iterative deepening
search 53
⚫ Complete? Yes
⚫ Time? (d+1)b0 + d b1 + (d-1)b2 + … + bd = O(bd)
⚫ Space? O(bd)
⚫ Optimal? Yes, if step cost = 1
32
⚫ Complete? Time? Space? Optimal?
⚫ Complete? Yes
⚫ Optimal? Yes
Graph search
55
• Simple solution: just keep track of which states you have visited.
• Usually easy to implement in modern computers.
The Separation Property of
Graph Search 56
• Black: expanded nodes.
• White: frontier nodes.
• Grey: unexplored nodes.
Summary
57
⚫ Problem formulation usually requires abstracting away
real-world details to define a state space that can feasibly be
explored
⚫ Variety of uninformed search strategies
⚫ Iterative deepening search uses only linear space and not
much more time than other uninformed algorithms
End