Professional Documents
Culture Documents
Search1 Uninformed
Search1 Uninformed
Solving Problems by
Searching
How do you formulate a problem?
Given a problem formulation, how
do you solve it?
Formulating Problems
State: relevant information about the world
Goal: what are you trying to accomplish?
Goal State
8-Puzzle
Initial State
Goal State
Actions:
Goal Test:
Path cost:
Search Algorithms
Systematically explore the state space
to find the goal
High-level idea for TREE-SEARCH:
state
Search Algorithms
Data structure: FRONTIER
Search Tree
down action
GRAPH-SEARCH
Introduce EXPLORED data
structure (set) to avoid adding
explored nodes to the FRONTIER
(Obviously, also dont add a node
to FRONTIER which is already
there)
Uninformed Search
Strategies
Breadth First Search
Uniform Cost Search
Depth First Search
Iterative Deepening Depth First
Search
Time Complexity
Space Complexity
Optimality
FRONTIER
Expanded
EXPLORED
Level 1
Level 2
Level 3
I
8
K,
A
L
F,
G,
G,
H,
H
I,LK,
J,
C,
D
D,
B,C
C
E,
F
J, J,
K,
L
JI,LK,
H,
I,K,
J,
Queue
I,
F,
G,
H
Queue :: E,
E,
D
F
H,
J L
Queuing: FIFO
Completeness:
Yes (if b branching factor is finite)
Time Complexity: how long does it take to find a
solution?
1 + b + b2 + b3 + .. + bd = O(bd), i.e.,
exponential in d (d is depth of solution)
Space Complexity: how much memory does it take to
perform the search?
O(bd), because it keeps every node in
memory
Optimality: does the method find the best (highest
quality) solution when there is more than one
solution?
Yes, if cost = 1 per step, but not in general
FRONTIER
Expanded
Uniform-cost Search
EXPLORED
A
A
10
B
PC: 10 + 1 = 11
PC: 11 + 3 = 14
PC: 5 + 7 = 12
D
3
9
PC: 11 + 9 = 20
PC: 12 + 4 = 16
B,
A G,
E,
F
Queue
Queue :: E,
C,
E,
G,
B
F,
D,
G,
F, F,
H
I, H
B
F
J,
I,HH
2
10PC: 5 + 10 = 15
F
5
1
PC: 12 + 1 = 13
Uniform-cost Search
Only concerned about the total path
cost.
Can it get into an infinite loop?
Is it complete?
How does the worst case time and
space complexity compare to
breadth-first search?
Is it optimal?
Properties of Uniform-cost
search
Completeness: is the strategy guaranteed to find a solution if
one exists?
No (if step cost = 0, will keep exploring forever);
Yes if step cost > 0
Time Complexity: how long does it take to find a solution?
# of nodes with cost cost of optimal solution
Space Complexity: how much memory does it take to perform
the search?
# of nodes with cost cost of optimal solution
Optimality: does the method find the best (highest quality)
solution when there is more than one solution?
Yes.
Like BFS, both time and space complexity too large
for practical solutions
FRONTIER
Expanded
EXPLORED
Level 1
Level 2
Start node
C
11
G
Level 3
Queue :: G,
F
J,
I, F
J,F
A
D,
CF C
Queue
B,C
H,
E,
H,
C
Queuing: LIFO
Depth-first Search
What is a problem with this
method?
What are the space requirements?
Properties of Depth-first
search
Completeness
No: fails if infinite depth spaces, may also fail in
state spaces with loops (not a problem with
GRAPH-SEARCH); complete in finite spaces
Time Complexity:
O(bm), where m is maximum depth
Space Complexity:
O(bm), linear space requirements for TREESEARCH
Optimality:
No
FRONTIER
Expanded
Depth-Limited Search
EXPLORED
Let l = 3
B
Level 1
Level 2
Start node
C
11
G
Level 3
Queue :: G,
F
J,
I, F
J,F
A
D,
CF C
Queue
B,C
H,
E,
H,
C
What changes if l = 2?
Depth-limited Search
Does this algorithm solve the infinite path
problem?
What happens if the goal is at a node below
the depth limit?
FRONTIER
Expanded
EXPLORED
14
3 612
7 13
5 11
15
18
Queue
B,
C
H,F C
Queue :: G,
A
C
F
D,
E,
J,
H,
I, F
J,F
9 17
4 8 16
10
Iterative Deepening
Search
Combines the best of breadth-first
and depth-first searches.
What is the time complexity?
Is iterative deepening faster than
breadth-first?
When is it best to apply this
algorithm?
Properties of Iterative
deepening search
Completeness:
Yes
Time Complexity:
O(bd), i.e., exponential in d
Space Complexity:
O(bd)
Optimality:
Yes, if cost = 1 per step,
Conceptual Issues
True at the kth iteration, the root node will already have been
generated k times.
False: it does not have a significant effect on complexity of the
search.
Uninformed Search
Each of the algorithms discussed are
considered uninformed search
algorithms.
Why?
Is it possible to improve the search
process if it was more intelligent?
Assigned Reading
Chapter 3, 4.1