heuristic search - college of computer and information … search chris amato northeastern...
TRANSCRIPT
![Page 1: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/1.jpg)
Heuristic Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA
![Page 2: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/2.jpg)
Recap: What is graph search?
Graph search: find a path from start to goal
– what are the states?
– what are the actions (transitions)?
– how is this a graph?
Start state Goal state
![Page 3: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/3.jpg)
Recap: What is graph search?
Graph search: find a path from start to goal
– what are the states?
– what are the actions (transitions)?
– how is this a graph?
Start state
Goal state
![Page 4: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/4.jpg)
Recap: BFS/UCS
It's like this
Notice that we search equally far in all directions...
Start Goal
![Page 5: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/5.jpg)
UCS in Pacman Small Maze
![Page 6: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/6.jpg)
Idea
Is it possible to use additional information to decide which direction to search in?
![Page 7: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/7.jpg)
Idea
Is it possible to use additional information to decide which direction to search in?
Yes!
Instead of searching in all directions, let's bias search in the direction of the goal.
![Page 8: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/8.jpg)
Aheuris)cis:• Afunc)onthates)mateshowcloseastateistoagoal• Designedforapar)cularsearchproblem• Examples:Manha<andistance,Euclideandistanceforpathfinding
10
5
11.2
Search heuristics
![Page 9: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/9.jpg)
Example
Stright-line distances to Bucharest
![Page 10: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/10.jpg)
Example
Expand states in order of their distance to the goal – for each state that you put on the fringe: calculate
straight-line distance to the goal – expand the state on the fringe closest to the goal
![Page 11: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/11.jpg)
Example
Expand states in order of their distance to the goal – for each state that you put on the fringe: calculate
straight-line distance to the goal – expand the state on the fringe closest to the goal
Greedy search
Heuristic:
![Page 12: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/12.jpg)
Greedy Search
![Page 13: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/13.jpg)
Greedy Search
Each time you expand a state, calculate the heuristic for each of the states that you add to the fringe. – heuristic: – on each step, choose to expand the state with the lowest heuristic value.
i.e. distance to Bucharest
![Page 14: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/14.jpg)
Greedy Search
Each time you expand a state, calculate the heuristic for each of the states that you add to the fringe. – heuristic: – on each step, choose to expand the state with the lowest heuristic value.
i.e. distance to Bucharest
This is like a guess about how far the state is from the goal
![Page 15: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/15.jpg)
Example: Greedy Search Greedy search example
Arad
366
Chapter 4, Sections 1–2 7
![Page 16: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/16.jpg)
Example: Greedy Search Greedy search example
Zerind
Arad
Sibiu Timisoara
253 329 374
Chapter 4, Sections 1–2 8
![Page 17: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/17.jpg)
Example: Greedy Search Greedy search example
Rimnicu Vilcea
Zerind
Arad
Sibiu
Arad Fagaras Oradea
Timisoara
329 374
366 176 380 193
Chapter 4, Sections 1–2 9
![Page 18: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/18.jpg)
Example: Greedy Search Greedy search example
Rimnicu Vilcea
Zerind
Arad
Sibiu
Arad Fagaras Oradea
Timisoara
Sibiu Bucharest
329 374
366 380 193
253 0
Chapter 4, Sections 1–2 10
![Page 19: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/19.jpg)
Example: Greedy Search Greedy search example
Rimnicu Vilcea
Zerind
Arad
Sibiu
Arad Fagaras Oradea
Timisoara
Sibiu Bucharest
329 374
366 380 193
253 0
Chapter 4, Sections 1–2 10
Path: A-S-F-B
![Page 20: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/20.jpg)
Example: Greedy Search
Notice that this is not the optimal path!
Path: A-S-F-B
![Page 21: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/21.jpg)
Example: Greedy Search
Notice that this is not the optimal path!
Path: A-S-F-B
Greedy Search: – Not optimal – Not complete – But, it can be very fast
![Page 22: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/22.jpg)
Strategy: expand a node that you think is closest to a goal state - Heuristic: estimate of distance to
nearest goal for each state A common case:
- Takes you straight to the (wrong) goal
Worst-case: like a badly-guided DFS
…b
…b
Greedy search
![Page 23: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/23.jpg)
Greedy in Pacman Small Maze
![Page 24: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/24.jpg)
Greedy vs UCS
Greedy Search: – Not optimal – Not complete – But, it can be very fast
UCS: – Optimal – Complete – Usually very slow
![Page 25: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/25.jpg)
Greedy vs UCS
Greedy Search: – Not optimal – Not complete – But, it can be very fast
UCS: – Optimal – Complete – Usually very slow
Can we combine greedy and UCS???
![Page 26: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/26.jpg)
Greedy vs UCS
Greedy Search: – Not optimal – Not complete – But, it can be very fast
UCS: – Optimal – Complete – Usually very slow
Can we combine greedy and UCS???
YES: A*
![Page 27: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/27.jpg)
Greedy vs UCS
UCS
![Page 28: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/28.jpg)
Greedy vs UCS
UCS Greedy
![Page 29: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/29.jpg)
Greedy vs UCS
UCS Greedy
A*
![Page 30: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/30.jpg)
A*
![Page 31: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/31.jpg)
A*
: a state
: minimum cost from start to
: heuristic at (i.e. an estimate of remaining cost-to-go)
UCS: expand states in order of Greedy: expand states in order of A*: expand states in order of
![Page 32: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/32.jpg)
A*
: a state
: minimum cost from start to
: heuristic at (i.e. an estimate of remaining cost-to-go)
UCS: expand states in order of Greedy: expand states in order of A*: expand states in order of
What is “cost-to-go”?
![Page 33: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/33.jpg)
A*
: a state
: minimum cost from start to
: heuristic at (i.e. an estimate of remaining cost-to-go)
UCS: expand states in order of Greedy: expand states in order of A*: expand states in order of
What is “cost-to-go”? – minimum cost required to reach a goal state
![Page 34: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/34.jpg)
Uniform-costordersbypathcost,orbackwardcostg(s) Greedyordersbygoalproximity,orforwardcosth(s)
A*Searchordersbythesum:f(s) = g(s) + h(s)
A*
S a d
b
Gh=5
h=6
h=2
1
8
11
2
h=6 h=0c
h=7
3
e h=11
Example:TegGrenager
S
a
b
c
ed
dG
G
g=0h=6
g=1h=5
g=2h=6
g=3h=7
g=4h=2
g=6h=0
g=9h=1
g=10h=2
g=12h=0
![Page 35: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/35.jpg)
When should A* terminate?
Shouldwestopwhenweenqueueagoal?
No:onlystopwhenwedequeueagoal
S
B
A
G
2
3
2
2h=1
h=2
h=0h=3
![Page 36: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/36.jpg)
Is A* optimal?
Whatwentwrong?Actualcost-to-go<heuris)cTheheuris)cmustbelessthantheactualcost-to-go!
A
GS
1 3h=6
h=0h=7
5
![Page 37: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/37.jpg)
When is A* optimal?
It depends on whether we are using the tree search or the graph search version of the algorithm. Recall:
– in tree search, we do not track the explored set – in graph search, we do
![Page 38: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/38.jpg)
Recall: Breadth first search (BFS)
What is the purpose of the explored set?
![Page 39: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/39.jpg)
When is A* optimal?
It depends on whether we are using the tree search or the graph search version of the algorithm.
Optimal if h is admissible
Optimal if h is consistent
![Page 40: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/40.jpg)
When is A* optimal?
It depends on whether we are using the tree search or the graph search version of the algorithm.
Optimal if h is admissible – h(s) is an underestimate of the true cost-to-go.
Optimal if h is consistent – h(s) is an underestimate of the cost of each arc.
![Page 41: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/41.jpg)
When is A* optimal?
It depends on whether we are using the tree search or the graph search version of the algorithm.
Optimal if h is admissible – h(s) is an underestimate of the true cost-to-go.
Optimal if h is consistent – h(s) is an underestimate of the cost of each arc.
What is “cost-to-go”? – minimum cost required to reach a goal state
![Page 42: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/42.jpg)
When is A* optimal?
It depends on whether we are using the tree search or the graph search version of the algorithm.
Optimal if h is admissible – h(s) is an underestimate of the true cost-to-go.
Optimal if h is consistent – h(s) is an underestimate of the cost of each arc.
More on this later...
![Page 43: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/43.jpg)
A heuristic h is admissible (optimistic) if:
where is the true cost to a nearest goal
Example: Coming up with admissible heuristics is most of
what’s involved in using A* in practice.
15
Admissible heuristics
![Page 44: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/44.jpg)
Admissibility: Example
Stright-line distances to Bucharest
h(s) = straight-line distance to goal state (Bucharest)
![Page 45: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/45.jpg)
Admissibility
Stright-line distances to Bucharest
h(s) = straight-line distance to goal state (Bucharest)
Is this heuristic admissible???
![Page 46: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/46.jpg)
Admissibility
Stright-line distances to Bucharest
h(s) = straight-line distance to goal state (Bucharest)
Is this heuristic admissible??? YES! Why?
![Page 47: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/47.jpg)
Admissibility: Example
h(s) = ?
Start state Goal state
Can you think of an admissible heuristic for this problem?
![Page 48: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/48.jpg)
Admissibility
Why isn't this heuristic admissible?
A
GS
1 3h=6
h=0h=7
5
![Page 49: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/49.jpg)
Consistency
What went wrong?
S
A
B
C
G
1
1
1
23
h=2
h=1
h=4
h=1
h=0
S(0+2)
A(1+4) B(1+1)
C(2+1)
G(5+0)
C(3+1)
G(6+0)
Statespacegraph Searchtree
![Page 50: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/50.jpg)
Mainidea:es)matedheuris)ccosts≤actualcosts
• Admissibility:heuris)ccost≤actualcosttogoal
h(A)≤actualcostfromAtoG
• Consistency:heuris)c“arc”cost≤actualcostforeacharc
h(A)–h(C)≤cost(AtoC)
Consequencesofconsistency:
• Thefvaluealongapathneverdecreases
h(A)≤cost(AtoC)+h(C)
• A*graphsearchisop)mal
3
AC
G
h=4 h=11h=2
Consistency
![Page 51: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/51.jpg)
Consistency
Cost of going from s to s'
s s'
![Page 52: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/52.jpg)
Consistency
Rearrange terms
![Page 53: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/53.jpg)
Consistency
Cost of going from s to s' implied by heuristic
Actual cost of going from s to s'
![Page 54: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/54.jpg)
Consistency
Consistency implies that the “f-cost” never decreases along any path to a goal state. – the optimal path gives a goal state its lowest f-cost. A* expands states in order of their f-cost. Given any goal state, A* expands states that reach the goal state optimally before expanding states the reach the goal state suboptimally.
![Page 55: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/55.jpg)
Consistency implies admissibility
Suppose:
Then:
![Page 56: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/56.jpg)
Consistency implies admissibility
Suppose:
Then:
![Page 57: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/57.jpg)
Consistency implies admissibility
Suppose:
Then: admissible
![Page 58: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/58.jpg)
Consistency implies admissibility
Suppose:
Then:
![Page 59: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/59.jpg)
Consistency implies admissibility
Suppose:
Then:
admissible
![Page 60: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/60.jpg)
Consistency implies admissibility
Suppose:
Then:
admissible admissible
![Page 61: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/61.jpg)
Consistency implies admissibility
Suppose:
Then:
![Page 62: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/62.jpg)
Uniform-costexpandsequallyinall“direc)ons”
A*expandsmainlytowardthegoal,butdoeshedgeitsbetstoensureop)mality
Start Goal
Start Goal
A* vs UCS
![Page 63: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/63.jpg)
A* in Pacman Small Maze
![Page 64: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/64.jpg)
A* vs UCS
Greedy UCS A*
![Page 65: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/65.jpg)
Choosing a heuristic
The right heuristic is often problem-specific. But it is very important to select a good heuristic!
![Page 66: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/66.jpg)
Choosing a heuristic
How much better is ?
Consider the 8-puzzle:
: number of misplaced tiles : sum of manhattan distances between each tile and its goal.
![Page 67: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/67.jpg)
Choosing a heuristic
Consider the 8-puzzle:
: number of misplaced tiles : sum of manhattan distances between each tile and its goal.
Average # states expanded on a random depth-24 puzzle:
(by depth 12)
![Page 68: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/68.jpg)
Choosing a heuristic
Consider the 8-puzzle:
: number of misplaced tiles : sum of manhattan distances between each tile and its goal.
Average # states expanded on a random depth-24 puzzle:
(by depth 12)
So, getting the heuristic right can speed things up by multiple orders of magnitude!
![Page 69: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/69.jpg)
Choosing a heuristic
Consider the 8-puzzle:
: number of misplaced tiles : sum of manhattan distances between each tile and its goal.
Why not use the actual cost to goal as a heuristic?
![Page 70: Heuristic Search - College of Computer and Information … Search Chris Amato Northeastern University Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA](https://reader033.vdocuments.us/reader033/viewer/2022051722/5aa1e13c7f8b9a84398c4852/html5/thumbnails/70.jpg)
How to choose a heuristic?
Nobody has an answer that always works. A couple of best-practices: – solve a relaxed version of the problem – solve a subproblem