Lirong Xia
Informed search
Spring, 2017
Informed search Lirong Xia Spring, 2017 Last class Search - - PowerPoint PPT Presentation
Informed search Lirong Xia Spring, 2017 Last class Search problems state space graph: modeling the problem search tree: scratch paper for solving the problem Uninformed search BFS DFS 2 Todays schedule More on
Spring, 2017
2
3
5
S a b c d e G 1 5 1 1 3 2 1
7
S a b c d e G 1 1 5 1 1 3 2
8
pq.push(key, value) Inserts (key, value) into the queue. pq.pop() returns the key with the lowest value, and removes it from the queue
be found
the lowest cost
§ yes, for cases where all costs are positive
9
Start b GOAL c d e f g …
closer to the goal than others
12
13
each state
14
Start c d e GOAL 1 1 1 1 2 a 1 b f g 1 1 1 h(b) = h(c) = h(d) = h(e) = h(f) = h(g) =1 h(a) = 2
Ø Greedy will choose SbcdG Ø Optimal: SaG Ø Should we stop when the fringe is empty?
15
Start c d GOAL 1 1 1 1 2 a b h(b) = h(c) = h(d)=1 h(a) = 2 h(G) = 0 1
16
17
18
S a 2 h(a)=2 h(S)=7 c 2 h(b)=0 b 3 h(G)=0 2
Ø fringe := {node corresponding to initial state} Ø loop:
19
20
S a G 3 1 5 h(a)=6 h(S)=7 h(G)=0
21
22
S a G 5 1 5 h(a)=0 h(S)=7 h(G)=0
c 1 h(b)=6 b 1 h(c)=0
23
decreases
state corresponds to the shortest path
a G c 1 h(c)=1 h(a)=4
24
S a G 5 1 5 h(a)=0 h(S)=7 h(G)=0
c 1 h(b)=6 b 1 h(c)=0
25
§ for simplicity, assume it is unique
§ guaranteed by consistency
§ addimisbility: f(G) <= f(v) <= g(v) + h*(v)
26
27
12.4
28
Start State Goal State
29
Start State Goal State Average nodes expanded when
…4 steps …8 steps …12 steps UCS 112 6,300 3,600,000 TILES 13 39 227
30
Start State Goal State Average nodes expanded when
…4 steps …8 steps …12 steps TILES 13 39 227
Manhattan 12
25 73
31
Start State Goal State
32
33
34
Ø Data structure for fringe
35
36
37