l6.ppt

State space
representations and
search strategies
(revisited)
State spaces
<S,P,I,G,W>
- state space
S
P= {(x,y)|x,yS}
IS
GS
W: PR+
- set of states
- set of production rules
- initial state
- set of goal states
- weight function
State spaces
<S,P,I,G,W>
- state space
The problem
• find a goal state
• find a path from the initial state to a goal state
• find a shortest path from the initial state to a goal state
• find a path with minimal weight from the initial state
to a goal state
Design Issues
 The direction of the search
– Forward (from the initial state to a goal state)
– Backward (from a goal state to the initial state)
 How to select applicable rules (Matching)
– It is critical to be efficient (Rete Algorithm)
 How to represent each node during search
– The representation problem
– The frame problem
 Search a graph or a tree
Search strategies - BFS
BreadthFirstSearch(state space =<S,P,I,G,W>)
Open  {I}
Closed  
while Open   do
x  DeQueue(Open)
if Goal(x, ) then return x
Insert(x,Closed)
for y  Child(x ,) do
if yClosed and yOpen then
EnQueue(y,Open)
return fail
Open is implemented as queue (FIFO); Closed can be an
arbitrary data structure for sets
Search strategies - DFS
DepthFirstSearch(state space =<S,P,I,G,W>)
Open  {I}
Closed  
while Open   do
x  Pop(Open)
if Goal(x, ) then return x
Insert(x,Closed)
for y  Child(x ,) do
if yClosed and yOpen then
Push(y,Open)
return fail
Open is implemented as stack (LIFO); Closed can be an
arbitrary data structure for sets
Iterative Deepening
maximum search depth = 1
Iterative Deepening
maximum search depth = 2
Iterative Deepening
maximum search depth = 3
Iterative Deepening
maximum search depth = 4
Properties of DFS
b = branching factor, d = goal depth, m = maximum depth

Completeness?
–

Time complexity?
–

O(bm), can do well if lots of goals
Space complexity?
–

Yes, assuming state space finite
O(m)
Optimality?
–
No 
Properties of BFS
b = branching factor, d = goal depth
 Completeness?
–Yes
 Time complexity?
–O(bd)
 Space complexity?
–O(bd) 
 Optimality?
–yes
B
Iterative Deepening
DFS cutoff
depth
1
2
3
4
…
d
Total
Space
Time
O(1)
O(2)
O(3)
O(4)
…
O(d)
O(b)
O(b2)
O(b3)
O(b4)
…
O(bd)
Sum =
O(bd+1)
Max = O(d)
Properties of IDDFS
b = branching factor, d = goal depth
 Completeness?
– Yes. 
 Time complexity?
– O(bd+1), even with repeated work! 
 Space complexity?
– O(d) 
 Optimality?
– Yes 
Heuristic Search
 Generate and Test
 Hill Climbing
– Simple Hill Climbing
– Steepest Ascend Hill Climbing
– Simulated Annealing
 Best First Search
–
–
–
–
A*
AO*
Beam Search
IDA*
Generated and Test

Algorithm
1. Generate a (potential goal) state:
– Particular point in the problem space, or
– A path from a start state
2. Test if it is a goal state
– Stop if positive
– go to step 1 otherwise

Systematic or Heuristic?
–
It depends on “Generate”
Hill Climbing
 Similar to Generate and Test
 Feedback from “Test” to “Generate”
 Need a heuristic function to evaluate space
states
Hill Climbing
 expand node
 sort children according to
Heuristic Evaluation Function
1 B
 choose best value
X
A
2
C
3
E
D
F
C
D
G
A
B
4
E
3
F
X
G
0
2
Hill Climbing
 Problems:
– local maxima problem
– plateau problem
– Ridge
goal
Ridge
goal
plateau