a* search, graph search, their completeness and optimality · a* search, graph search, their...
TRANSCRIPT
![Page 1: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/1.jpg)
A* Search, Graph Search, Their Completeness and Optimality
Instructor: Wei Xu
Ohio State University [These slides were adapted from CS188 Intro to AI at UC Berkeley]
CS 5522: Artificial Intelligence II
![Page 2: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/2.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
0
39
1
1
2
8
8 2
15
1
22
![Page 3: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/3.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
0
39
1
1
2
8
8 2
15
1
22
![Page 4: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/4.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
16
0
39
1
1
2
8
8 2
15
1
22
![Page 5: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/5.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
16411
5
0
39
1
1
2
8
8 2
15
1
22
![Page 6: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/6.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
16411
5
0
6
39
1
1
2
8
8 2
15
1
22
![Page 7: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/7.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
16411
5
713
0
6
39
1
1
2
8
8 2
15
1
22
![Page 8: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/8.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
16411
5
713
0
6
39
1
1
2
8
8 2
15
1
22
![Page 9: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/9.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
16411
5
713
8
0
6
39
1
1
2
8
8 2
15
1
22
![Page 10: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/10.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
16411
5
713
8
1011
0
6
39
1
1
2
8
8 2
15
1
22
![Page 11: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/11.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
16411
5
713
8
1011
17 11
0
6
39
1
1
2
8
8 2
15
1
22
![Page 12: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/12.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
16411
5
713
8
1011
17 11
0
6
39
1
1
2
8
8 2
15
1
22
![Page 13: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/13.jpg)
Uniform Cost Search (recap: uninformed search)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
16411
5
713
8
1011
17 11
0
6
39
1
1
2
8
8 2
15
1
2
Cost contours
2
![Page 14: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/14.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 15: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/15.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 16: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/16.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 17: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/17.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 18: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/18.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?▪ Processes all nodes with cost less than cheapest solution!
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 19: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/19.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?▪ Processes all nodes with cost less than cheapest solution!▪ If that solution costs C* and arcs cost at least ε , then the
“effective depth” is roughly C*/ε
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 20: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/20.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?▪ Processes all nodes with cost less than cheapest solution!▪ If that solution costs C* and arcs cost at least ε , then the
“effective depth” is roughly C*/ε▪ Takes time O(bC*/ε) (exponential in effective depth)
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 21: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/21.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?▪ Processes all nodes with cost less than cheapest solution!▪ If that solution costs C* and arcs cost at least ε , then the
“effective depth” is roughly C*/ε▪ Takes time O(bC*/ε) (exponential in effective depth)
▪ How much space does the fringe take?
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 22: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/22.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?▪ Processes all nodes with cost less than cheapest solution!▪ If that solution costs C* and arcs cost at least ε , then the
“effective depth” is roughly C*/ε▪ Takes time O(bC*/ε) (exponential in effective depth)
▪ How much space does the fringe take?▪ Has roughly the last tier, so O(bC*/ε)
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 23: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/23.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?▪ Processes all nodes with cost less than cheapest solution!▪ If that solution costs C* and arcs cost at least ε , then the
“effective depth” is roughly C*/ε▪ Takes time O(bC*/ε) (exponential in effective depth)
▪ How much space does the fringe take?▪ Has roughly the last tier, so O(bC*/ε)
▪ Is it complete?
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 24: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/24.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?▪ Processes all nodes with cost less than cheapest solution!▪ If that solution costs C* and arcs cost at least ε , then the
“effective depth” is roughly C*/ε▪ Takes time O(bC*/ε) (exponential in effective depth)
▪ How much space does the fringe take?▪ Has roughly the last tier, so O(bC*/ε)
▪ Is it complete?▪ Assuming best solution has a finite cost and minimum arc cost
is positive, yes!
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 25: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/25.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?▪ Processes all nodes with cost less than cheapest solution!▪ If that solution costs C* and arcs cost at least ε , then the
“effective depth” is roughly C*/ε▪ Takes time O(bC*/ε) (exponential in effective depth)
▪ How much space does the fringe take?▪ Has roughly the last tier, so O(bC*/ε)
▪ Is it complete?▪ Assuming best solution has a finite cost and minimum arc cost
is positive, yes!
▪ Is it optimal?
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 26: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/26.jpg)
…
Uniform Cost Search (UCS) Properties
▪ What nodes does UCS expand?▪ Processes all nodes with cost less than cheapest solution!▪ If that solution costs C* and arcs cost at least ε , then the
“effective depth” is roughly C*/ε▪ Takes time O(bC*/ε) (exponential in effective depth)
▪ How much space does the fringe take?▪ Has roughly the last tier, so O(bC*/ε)
▪ Is it complete?▪ Assuming best solution has a finite cost and minimum arc cost
is positive, yes!
▪ Is it optimal?▪ Yes! (Proof next lecture via A*)
b
C*/ε “tiers”c ≤ 3
c ≤ 2
c ≤ 1
![Page 27: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/27.jpg)
Infinite Search Tree
S G
b
a
Consider this 4-state graph:
▪ best solution may have an infinite cost (e.g ride a sightseeing train for as long as possible)
![Page 28: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/28.jpg)
Infinite Search Tree
S G
b
a
Consider this 4-state graph: How big is its search tree (from S)?
▪ best solution may have an infinite cost (e.g ride a sightseeing train for as long as possible)
![Page 29: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/29.jpg)
Infinite Search Tree
S G
b
a
Consider this 4-state graph: How big is its search tree (from S)?
▪ best solution may have an infinite cost (e.g ride a sightseeing train for as long as possible)
![Page 30: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/30.jpg)
Today
▪ Informed Search ▪Heuristics
▪Greedy Search
▪ A* Search
▪ Graph Search
![Page 31: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/31.jpg)
Recap: Search
![Page 32: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/32.jpg)
Example: Pancake Problem
![Page 33: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/33.jpg)
Example: Pancake Problem
![Page 34: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/34.jpg)
Example: Pancake Problem
![Page 35: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/35.jpg)
Example: Pancake Problem
![Page 36: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/36.jpg)
Example: Pancake Problem
Cost: Number of pancakes flipped
![Page 37: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/37.jpg)
Example: Pancake Problem
![Page 38: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/38.jpg)
Example: Pancake Problem
![Page 39: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/39.jpg)
Example: Pancake Problem
3
2
4
3
3
2
2
2
4
State space graph with costs as weights
34
3
4
2
![Page 40: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/40.jpg)
General Tree Search
![Page 41: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/41.jpg)
General Tree Search
![Page 42: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/42.jpg)
General Tree Search
![Page 43: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/43.jpg)
General Tree Search
Action: flip top two
Cost: 2
Action: flip all fourCost: 4
![Page 44: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/44.jpg)
General Tree Search
![Page 45: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/45.jpg)
General Tree Search
![Page 46: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/46.jpg)
General Tree Search
![Page 47: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/47.jpg)
General Tree Search
Path to reach goal: Flip four, flip three
Total cost: 7
![Page 48: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/48.jpg)
The One Queue
▪ All these search algorithms are the same except for fringe strategies ▪ Conceptually, all fringes are priority
queues (i.e. collections of nodes with attached priorities)
▪ Practically, for DFS and BFS, you can avoid the log(n) overhead from an actual priority queue, by using stacks and queues
▪ Can even code one implementation that takes a variable queuing object
![Page 49: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/49.jpg)
Uninformed Search
![Page 50: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/50.jpg)
Uniform Cost Search
▪ Strategy: expand lowest path cost
▪ The good: UCS is complete and optimal!
▪ The bad: ▪ Explores options in every “direction” ▪ No information about goal location
Start Goal
…
c ≤ 3
c ≤ 2
c ≤ 1
[Demo: contours UCS empty (L3D1)] [Demo: contours UCS pacman small maze (L3D3)]
![Page 51: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/51.jpg)
Video of Demo Contours UCS Empty
![Page 52: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/52.jpg)
Video of Demo Contours UCS Empty
![Page 53: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/53.jpg)
Video of Demo Contours UCS Empty
![Page 54: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/54.jpg)
Video of Demo Contours UCS Pacman Small Maze
![Page 55: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/55.jpg)
Video of Demo Contours UCS Pacman Small Maze
![Page 56: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/56.jpg)
Video of Demo Contours UCS Pacman Small Maze
![Page 57: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/57.jpg)
Informed Search
![Page 58: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/58.jpg)
Search Heuristics
![Page 59: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/59.jpg)
Search Heuristics
▪ A heuristic is:▪ A function that estimates how close a state is to a
goal▪ Designed for a particular search problem
![Page 60: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/60.jpg)
Search Heuristics
▪ A heuristic is:▪ A function that estimates how close a state is to a
goal▪ Designed for a particular search problem
![Page 61: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/61.jpg)
Search Heuristics
▪ A heuristic is:▪ A function that estimates how close a state is to a
goal▪ Designed for a particular search problem
![Page 62: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/62.jpg)
Search Heuristics
▪ A heuristic is:▪ A function that estimates how close a state is to a
goal▪ Designed for a particular search problem
![Page 63: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/63.jpg)
Search Heuristics
▪ A heuristic is:▪ A function that estimates how close a state is to a
goal▪ Designed for a particular search problem▪ Examples: Manhattan distance, Euclidean distance
for pathing
![Page 64: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/64.jpg)
Search Heuristics
▪ A heuristic is:▪ A function that estimates how close a state is to a
goal▪ Designed for a particular search problem▪ Examples: Manhattan distance, Euclidean distance
for pathing
10
5
![Page 65: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/65.jpg)
Search Heuristics
▪ A heuristic is:▪ A function that estimates how close a state is to a
goal▪ Designed for a particular search problem▪ Examples: Manhattan distance, Euclidean distance
for pathing
11.2
![Page 66: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/66.jpg)
Example: Heuristic Function
h(x)
![Page 67: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/67.jpg)
Example: Heuristic Function
![Page 68: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/68.jpg)
Example: Heuristic Function
Heuristic: (the size of) the largest pancake that is still out of place
![Page 69: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/69.jpg)
Example: Heuristic Function
Heuristic: (the size of) the largest pancake that is still out of place
43
0
2
3
3
3
4
4
3
4
4
4
h(x)
![Page 70: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/70.jpg)
Greedy Search
![Page 71: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/71.jpg)
Example: Heuristic Function
h(x)
![Page 72: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/72.jpg)
Greedy Search
![Page 73: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/73.jpg)
Greedy Search
![Page 74: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/74.jpg)
Greedy Search
![Page 75: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/75.jpg)
Greedy Search
![Page 76: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/76.jpg)
▪ Expand the node that seems closest…
Greedy Search
![Page 77: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/77.jpg)
Greedy Search
![Page 78: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/78.jpg)
Greedy Search
![Page 79: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/79.jpg)
Greedy Search
![Page 80: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/80.jpg)
Greedy Search
![Page 81: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/81.jpg)
Greedy Search
![Page 82: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/82.jpg)
Greedy Search
▪ Expand the node that seems closest…
▪ What can go wrong?
![Page 83: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/83.jpg)
Greedy Search
▪ Expand the node that seems closest…
▪ What can go wrong?
![Page 84: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/84.jpg)
Greedy Search
▪ Strategy: expand a node that you think is closest to a goal state▪ Heuristic: estimate of distance to nearest goal
for each state
…b
[Demo: contours greedy empty (L3D1)] [Demo: contours greedy pacman small maze (L3D4)]
![Page 85: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/85.jpg)
Greedy Search
▪ 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:▪ Best-first takes you straight to the (wrong) goal
…b
[Demo: contours greedy empty (L3D1)] [Demo: contours greedy pacman small maze (L3D4)]
![Page 86: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/86.jpg)
Greedy Search
▪ 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:▪ Best-first takes you straight to the (wrong) goal
▪ Worst-case: like a badly-guided DFS
…b
[Demo: contours greedy empty (L3D1)] [Demo: contours greedy pacman small maze (L3D4)]
![Page 87: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/87.jpg)
Greedy Search
▪ 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:▪ Best-first takes you straight to the (wrong) goal
▪ Worst-case: like a badly-guided DFS
…b
…b
[Demo: contours greedy empty (L3D1)] [Demo: contours greedy pacman small maze (L3D4)]
![Page 88: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/88.jpg)
Video of Demo Contours Greedy (Empty)
![Page 89: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/89.jpg)
Video of Demo Contours Greedy (Empty)
![Page 90: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/90.jpg)
Video of Demo Contours Greedy (Empty)
![Page 91: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/91.jpg)
Video of Demo Contours Greedy (Pacman Small Maze)
![Page 92: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/92.jpg)
Video of Demo Contours Greedy (Pacman Small Maze)
![Page 93: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/93.jpg)
Video of Demo Contours Greedy (Pacman Small Maze)
![Page 94: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/94.jpg)
A* Search
![Page 95: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/95.jpg)
A* Search
![Page 96: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/96.jpg)
A* Search
![Page 97: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/97.jpg)
A* Search
UCS
![Page 98: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/98.jpg)
A* Search
UCS Greedy
![Page 99: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/99.jpg)
A* Search
UCS Greedy
A*
![Page 100: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/100.jpg)
Combining UCS and Greedy
S a d
b
Gh=5
h=6
h=2
1
8
11
2
h=6 h=0
c
h=7
3
e h=11
Example: Teg Grenager
![Page 101: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/101.jpg)
Combining UCS and Greedy
▪ Uniform-cost orders by path cost, or backward cost g(n)
S a d
b
Gh=5
h=6
h=2
1
8
11
2
h=6 h=0
c
h=7
3
e h=11
Example: Teg Grenager
![Page 102: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/102.jpg)
Combining UCS and Greedy
▪ Uniform-cost orders by path cost, or backward cost g(n)
S a d
b
Gh=5
h=6
h=2
1
8
11
2
h=6 h=0
c
h=7
3
e h=11
Example: Teg Grenager
![Page 103: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/103.jpg)
Combining UCS and Greedy
▪ Uniform-cost orders by path cost, or backward cost g(n)
S a d
b
Gh=5
h=6
h=2
1
8
11
2
h=6 h=0
c
h=7
3
e h=11
Example: Teg Grenager
![Page 104: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/104.jpg)
Combining UCS and Greedy
▪ Uniform-cost orders by path cost, or backward cost g(n)▪ Greedy orders by goal proximity, or forward cost h(n)
S a d
b
Gh=5
h=6
h=2
1
8
11
2
h=6 h=0
c
h=7
3
e h=11
Example: Teg Grenager
![Page 105: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/105.jpg)
Combining UCS and Greedy
▪ Uniform-cost orders by path cost, or backward cost g(n)▪ Greedy orders by goal proximity, or forward cost h(n)
S a d
b
Gh=5
h=6
h=2
1
8
11
2
h=6 h=0
c
h=7
3
e h=11
Example: Teg Grenager
![Page 106: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/106.jpg)
Combining UCS and Greedy
▪ Uniform-cost orders by path cost, or backward cost g(n)▪ Greedy orders by goal proximity, or forward cost h(n)
S a d
b
Gh=5
h=6
h=2
1
8
11
2
h=6 h=0
c
h=7
3
e h=11
Example: Teg Grenager
![Page 107: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/107.jpg)
Combining UCS and Greedy
▪ Uniform-cost orders by path cost, or backward cost g(n)▪ Greedy orders by goal proximity, or forward cost h(n)
▪ A* Search orders by the sum: f(n) = g(n) + h(n)
S a d
b
Gh=5
h=6
h=2
1
8
11
2
h=6 h=0
c
h=7
3
e h=11
Example: Teg Grenager
![Page 108: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/108.jpg)
When should A* terminate?
S
B
A
G
2
3
2
2h = 1
h = 2
h = 0h = 3
![Page 109: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/109.jpg)
When should A* terminate?
▪ Should we stop when we enqueue a goal?
▪ No: only stop when we dequeue a goal
S
B
A
G
2
3
2
2h = 1
h = 2
h = 0h = 3
![Page 110: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/110.jpg)
Is A* Optimal?
▪ What went wrong?
A
GS
1 3h = 6
h = 05
h = 7
![Page 111: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/111.jpg)
Is A* Optimal?
▪ What went wrong?▪ Actual bad goal cost < estimated good goal cost
A
GS
1 3h = 6
h = 05
h = 7
![Page 112: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/112.jpg)
Is A* Optimal?
▪ What went wrong?▪ Actual bad goal cost < estimated good goal cost▪ We need estimates to be less than actual costs!
A
GS
1 3h = 6
h = 05
h = 7
![Page 113: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/113.jpg)
Admissible Heuristics
![Page 114: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/114.jpg)
Idea: Admissibility
Inadmissible (pessimistic) heuristics break optimality by trapping good plans on the
fringe
Admissible (optimistic) heuristics slow down bad plans but never outweigh true
costs
![Page 115: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/115.jpg)
Admissible Heuristics
▪ A heuristic h is admissible (optimistic) if:
where is the true cost to a nearest goal
![Page 116: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/116.jpg)
Admissible Heuristics
▪ A heuristic h is admissible (optimistic) if:
where is the true cost to a nearest goal
▪ Examples:
![Page 117: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/117.jpg)
Admissible Heuristics
▪ A heuristic h is admissible (optimistic) if:
where is the true cost to a nearest goal
▪ Examples:
15
![Page 118: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/118.jpg)
Admissible Heuristics
▪ A heuristic h is admissible (optimistic) if:
where is the true cost to a nearest goal
▪ Examples:4
15
![Page 119: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/119.jpg)
Admissible Heuristics
▪ A heuristic h is admissible (optimistic) if:
where is the true cost to a nearest goal
▪ Examples:
▪ Coming up with admissible heuristics is most of what’s involved in using A* in practice.
415
![Page 120: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/120.jpg)
Optimality of A* Tree Search
![Page 121: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/121.jpg)
Optimality of A* Tree Search
Assume: ▪ A is an optimal goal node ▪ B is a suboptimal goal node ▪ h is admissible
Claim:
▪ A will exit the fringe before B
…
![Page 122: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/122.jpg)
Optimality of A* Tree Search: Blocking
Proof:…
![Page 123: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/123.jpg)
Optimality of A* Tree Search: Blocking
Proof:▪ Imagine B is on the fringe
…
![Page 124: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/124.jpg)
Optimality of A* Tree Search: Blocking
Proof:▪ Imagine B is on the fringe
…
![Page 125: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/125.jpg)
Optimality of A* Tree Search: Blocking
Proof:▪ Imagine B is on the fringe▪ Some ancestor n of A is on the
fringe, too (maybe A!)
…
![Page 126: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/126.jpg)
Optimality of A* Tree Search: Blocking
Proof:▪ Imagine B is on the fringe▪ Some ancestor n of A is on the
fringe, too (maybe A!)
…
![Page 127: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/127.jpg)
Optimality of A* Tree Search: Blocking
Proof:▪ Imagine B is on the fringe▪ Some ancestor n of A is on the
fringe, too (maybe A!)▪ Claim: n will be expanded
before B
…
![Page 128: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/128.jpg)
Optimality of A* Tree Search: Blocking
Proof:▪ Imagine B is on the fringe▪ Some ancestor n of A is on the
fringe, too (maybe A!)▪ Claim: n will be expanded
before B
…
![Page 129: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/129.jpg)
Optimality of A* Tree Search: Blocking
Proof:▪ Imagine B is on the fringe▪ Some ancestor n of A is on the
fringe, too (maybe A!)▪ Claim: n will be expanded
before B1. f(n) is less or equal to f(A)
…
![Page 130: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/130.jpg)
Optimality of A* Tree Search: Blocking
Proof:▪ Imagine B is on the fringe▪ Some ancestor n of A is on the
fringe, too (maybe A!)▪ Claim: n will be expanded
before B1. f(n) is less or equal to f(A)
…
Definition of f-costAdmissibility of hh = 0 at a goal
![Page 131: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/131.jpg)
Optimality of A* Tree Search: Blocking
Proof: ▪ Imagine B is on the fringe ▪ Some ancestor n of A is on the
fringe, too (maybe A!) ▪ Claim: n will be expanded
before B 1. f(n) is less or equal to f(A) 2. f(A) is less than f(B)
B is suboptimalh = 0 at a goal
…
![Page 132: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/132.jpg)
Optimality of A* Tree Search: Blocking
Proof: ▪ Imagine B is on the fringe ▪ Some ancestor n of A is on the
fringe, too (maybe A!) ▪ Claim: n will be expanded before B
1. f(n) is less or equal to f(A) 2. f(A) is less than f(B) 3. n expands before B
▪ All ancestors of A expand before B ▪ A expands before B ▪ A* search is optimal
…
![Page 133: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/133.jpg)
Properties of A*
![Page 134: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/134.jpg)
Properties of A*
…b
…b
Uniform-Cost A*
![Page 135: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/135.jpg)
UCS vs A* Contours
▪ Uniform-cost expands equally in all “directions”
▪ A* expands mainly toward the goal, but does hedge its bets to ensure optimality
Start Goal
Start Goal
[Demo: contours UCS / greedy / A* empty (L3D1)] [Demo: contours A* pacman small maze (L3D5)]
![Page 136: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/136.jpg)
Video of Demo Contours (Empty) -- UCS
![Page 137: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/137.jpg)
Video of Demo Contours (Empty) -- UCS
![Page 138: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/138.jpg)
Video of Demo Contours (Empty) -- UCS
![Page 139: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/139.jpg)
Video of Demo Contours (Empty) -- Greedy
![Page 140: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/140.jpg)
Video of Demo Contours (Empty) -- Greedy
![Page 141: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/141.jpg)
Video of Demo Contours (Empty) -- Greedy
![Page 142: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/142.jpg)
Video of Demo Contours (Empty) – A*
![Page 143: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/143.jpg)
Video of Demo Contours (Empty) – A*
![Page 144: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/144.jpg)
Video of Demo Contours (Empty) – A*
![Page 145: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/145.jpg)
A* Applications
▪ Video games ▪ Pathing / routing problems ▪ Resource planning problems ▪ Robot motion planning ▪ Language analysis ▪ Machine translation ▪ Speech recognition ▪ …
[Demo: UCS / A* pacman tiny maze (L3D6,L3D7)] [Demo: guess algorithm Empty Shallow/Deep (L3D8)]
![Page 146: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/146.jpg)
Video of Demo (Empty Shallow/Deep) -- UCS
![Page 147: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/147.jpg)
Video of Demo (Empty Shallow/Deep) -- UCS
![Page 148: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/148.jpg)
Video of Demo (Empty Shallow/Deep) — Greedy
![Page 149: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/149.jpg)
Video of Demo (Empty Shallow/Deep) — Greedy
![Page 150: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/150.jpg)
Video of Demo (Empty Shallow/Deep) — A*
![Page 151: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/151.jpg)
Video of Demo (Empty Shallow/Deep) — A*
![Page 152: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/152.jpg)
Creating Heuristics
![Page 153: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/153.jpg)
Creating Admissible Heuristics
▪ Most of the work in solving hard search problems optimally is in coming up with admissible heuristics
![Page 154: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/154.jpg)
Creating Admissible Heuristics
▪ Most of the work in solving hard search problems optimally is in coming up with admissible heuristics
▪ Often, admissible heuristics are solutions to relaxed problems, where new actions are available
366
![Page 155: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/155.jpg)
Creating Admissible Heuristics
▪ Most of the work in solving hard search problems optimally is in coming up with admissible heuristics
▪ Often, admissible heuristics are solutions to relaxed problems, where new actions are available
15366
![Page 156: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/156.jpg)
Creating Admissible Heuristics
▪ Most of the work in solving hard search problems optimally is in coming up with admissible heuristics
▪ Often, admissible heuristics are solutions to relaxed problems, where new actions are available
▪ Inadmissible heuristics are often useful too
15366
![Page 157: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/157.jpg)
Example: 8 Puzzle
▪ What are the states? ▪ How many states? ▪ What are the actions? ▪ How many successors from the start state? ▪ What should the costs be?
Start State Goal StateActions
![Page 158: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/158.jpg)
8 Puzzle I
▪ Heuristic: Number of tiles misplaced
Start State Goal State
![Page 159: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/159.jpg)
8 Puzzle I
▪ Heuristic: Number of tiles misplaced▪ Why is it admissible?
Start State Goal State
![Page 160: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/160.jpg)
8 Puzzle I
▪ Heuristic: Number of tiles misplaced▪ Why is it admissible?▪ h(start) =
Start State Goal State
![Page 161: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/161.jpg)
8 Puzzle I
▪ Heuristic: Number of tiles misplaced▪ Why is it admissible?▪ h(start) =8
Start State Goal State
![Page 162: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/162.jpg)
8 Puzzle I
▪ Heuristic: Number of tiles misplaced▪ Why is it admissible?▪ h(start) =8
Average nodes expanded when the optimal path has……4 steps …8 steps …12 steps
UCS 112 6,300 3.6 x 106
TILES 13 39 227
Start State Goal State
Statistics from Andrew Moore
![Page 163: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/163.jpg)
8 Puzzle I
▪ Heuristic: Number of tiles misplaced▪ Why is it admissible?▪ h(start) =▪ This is a relaxed-problem heuristic
8
Average nodes expanded when the optimal path has……4 steps …8 steps …12 steps
UCS 112 6,300 3.6 x 106
TILES 13 39 227
Start State Goal State
Statistics from Andrew Moore
![Page 164: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/164.jpg)
8 Puzzle I
▪ Heuristic: Number of tiles misplaced▪ Why is it admissible?▪ h(start) =▪ This is a relaxed-problem heuristic
8
Average nodes expanded when the optimal path has……4 steps …8 steps …12 steps
UCS 112 6,300 3.6 x 106
TILES 13 39 227
Start State Goal State
Statistics from Andrew Moore
![Page 165: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/165.jpg)
8 Puzzle II
▪ What if we had an easier 8-puzzle where any tile could slide any direction at any time, ignoring other tiles?
Start State Goal State
![Page 166: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/166.jpg)
8 Puzzle II
▪ What if we had an easier 8-puzzle where any tile could slide any direction at any time, ignoring other tiles?
▪ Total Manhattan distanceStart State Goal State
![Page 167: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/167.jpg)
8 Puzzle II
▪ What if we had an easier 8-puzzle where any tile could slide any direction at any time, ignoring other tiles?
▪ Total Manhattan distance
▪ Why is it admissible?
Start State Goal State
![Page 168: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/168.jpg)
8 Puzzle II
▪ What if we had an easier 8-puzzle where any tile could slide any direction at any time, ignoring other tiles?
▪ Total Manhattan distance
▪ Why is it admissible?
▪ h(start) =
Start State Goal State
![Page 169: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/169.jpg)
8 Puzzle II
▪ What if we had an easier 8-puzzle where any tile could slide any direction at any time, ignoring other tiles?
▪ Total Manhattan distance
▪ Why is it admissible?
▪ h(start) = 3 + 1 + 2 + … = 18
Start State Goal State
![Page 170: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/170.jpg)
8 Puzzle II
▪ What if we had an easier 8-puzzle where any tile could slide any direction at any time, ignoring other tiles?
▪ Total Manhattan distance
▪ Why is it admissible?
▪ h(start) = 3 + 1 + 2 + … = 18Average nodes expanded when the optimal path has……4 steps …8 steps …12 steps
TILES 13 39 227MANHATTAN 12 25 73
Start State Goal State
![Page 171: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/171.jpg)
8 Puzzle III
▪ How about using the actual cost as a heuristic?▪ Would it be admissible?▪ Would we save on nodes expanded?▪ What’s wrong with it?
![Page 172: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/172.jpg)
8 Puzzle III
▪ How about using the actual cost as a heuristic?▪ Would it be admissible?▪ Would we save on nodes expanded?▪ What’s wrong with it?
▪ With A*: a trade-off between quality of estimate and work per node
![Page 173: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/173.jpg)
8 Puzzle III
▪ How about using the actual cost as a heuristic?▪ Would it be admissible?▪ Would we save on nodes expanded?▪ What’s wrong with it?
▪ With A*: a trade-off between quality of estimate and work per node
![Page 174: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/174.jpg)
8 Puzzle III
▪ How about using the actual cost as a heuristic?▪ Would it be admissible?▪ Would we save on nodes expanded?▪ What’s wrong with it?
▪ With A*: a trade-off between quality of estimate and work per node▪ As heuristics get closer to the true cost, you will expand fewer nodes but
usually do more work per node to compute the heuristic itself
![Page 175: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/175.jpg)
Semi-Lattice of Heuristics
![Page 176: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/176.jpg)
Trivial Heuristics, Dominance
▪ Dominance: ha ≥ hc if
▪ Heuristics form a semi-lattice: ▪ Max of admissible heuristics is admissible
▪ Trivial heuristics ▪ Bottom of lattice is the zero heuristic
(what does this give us?) ▪ Top of lattice is the exact heuristic
![Page 177: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/177.jpg)
Graph Search
![Page 178: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/178.jpg)
▪ Failure to detect repeated states can cause exponentially more work.
Search TreeState Graph
Tree Search: Extra Work!
![Page 179: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/179.jpg)
▪ Failure to detect repeated states can cause exponentially more work.
Search TreeState Graph
Tree Search: Extra Work!
![Page 180: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/180.jpg)
Graph Search
▪ In BFS, for example, we shouldn’t bother expanding the circled nodes (why?)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
![Page 181: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/181.jpg)
Graph Search
▪ In BFS, for example, we shouldn’t bother expanding the circled nodes (why?)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
![Page 182: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/182.jpg)
Graph Search
▪ Idea: never expand a state twice
![Page 183: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/183.jpg)
Graph Search
▪ Idea: never expand a state twice
▪ How to implement:
▪ Tree search + set of expanded states (“closed set”)▪ Expand the search tree node-by-node, but…▪ Before expanding a node, check to make sure its state has
never been expanded before▪ If not new, skip it, if new add to closed set
![Page 184: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/184.jpg)
Graph Search
▪ Idea: never expand a state twice
▪ How to implement:
▪ Tree search + set of expanded states (“closed set”)▪ Expand the search tree node-by-node, but…▪ Before expanding a node, check to make sure its state has
never been expanded before▪ If not new, skip it, if new add to closed set
▪ Important: store the closed set as a set, not a list
![Page 185: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/185.jpg)
Graph Search
▪ Idea: never expand a state twice
▪ How to implement:
▪ Tree search + set of expanded states (“closed set”)▪ Expand the search tree node-by-node, but…▪ Before expanding a node, check to make sure its state has
never been expanded before▪ If not new, skip it, if new add to closed set
▪ Important: store the closed set as a set, not a list
▪ Can graph search wreck completeness? Why/why not?
![Page 186: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/186.jpg)
Graph Search
▪ Idea: never expand a state twice
▪ How to implement:
▪ Tree search + set of expanded states (“closed set”)▪ Expand the search tree node-by-node, but…▪ Before expanding a node, check to make sure its state has
never been expanded before▪ If not new, skip it, if new add to closed set
▪ Important: store the closed set as a set, not a list
▪ Can graph search wreck completeness? Why/why not?
▪ How about optimality?
![Page 187: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/187.jpg)
A* Graph Search Gone Wrong?
S
A
B
C
G
1
1
1
23
State space graph
![Page 188: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/188.jpg)
A* Graph Search Gone Wrong?
S
A
B
C
G
1
1
1
23
h=2
h=1
h=4
h=1
h=0
State space graph
![Page 189: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/189.jpg)
A* Graph Search Gone Wrong?
S
A
B
C
G
1
1
1
23
h=2
h=1
h=4
h=1
h=0
S (0+2)
State space graph Search tree
![Page 190: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/190.jpg)
A* Graph Search Gone 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)
State space graph Search tree
![Page 191: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/191.jpg)
A* Graph Search Gone 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 (3+1)
State space graph Search tree
![Page 192: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/192.jpg)
A* Graph Search Gone 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 (3+1)
G (6+0)
State space graph Search tree
![Page 193: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/193.jpg)
A* Graph Search Gone 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) C (3+1)
G (6+0)
State space graph Search tree
![Page 194: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/194.jpg)
A* Graph Search Gone 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)
State space graph Search tree
![Page 195: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/195.jpg)
Consistency of Heuristics
3
A
C
G
h=4 h=11
![Page 196: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/196.jpg)
Consistency of Heuristics
▪ Main idea: estimated heuristic costs ≤ actual costs
▪ Admissibility: heuristic cost ≤ actual cost to goal h(A) ≤ actual cost from A to G ▪ Consistency: heuristic “arc” cost ≤ actual cost for each arc h(A) – h(C) ≤ cost(A to C)
3
A
C
G
h=4 h=11
![Page 197: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/197.jpg)
Consistency of Heuristics
▪ Main idea: estimated heuristic costs ≤ actual costs
▪ Admissibility: heuristic cost ≤ actual cost to goal h(A) ≤ actual cost from A to G ▪ Consistency: heuristic “arc” cost ≤ actual cost for each arc h(A) – h(C) ≤ cost(A to C)
3
A
C
G
h=4 h=11
![Page 198: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/198.jpg)
Consistency of Heuristics
▪ Main idea: estimated heuristic costs ≤ actual costs
▪ Admissibility: heuristic cost ≤ actual cost to goal h(A) ≤ actual cost from A to G ▪ Consistency: heuristic “arc” cost ≤ actual cost for each arc h(A) – h(C) ≤ cost(A to C)
▪ Consequences of consistency:
▪ The f value along a path never decreases h(A) ≤ cost(A to C) + h(C)
▪ A* graph search is optimal
3
A
C
G
h=4 h=11
![Page 199: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/199.jpg)
Consistency of Heuristics
▪ Main idea: estimated heuristic costs ≤ actual costs
▪ Admissibility: heuristic cost ≤ actual cost to goal h(A) ≤ actual cost from A to G ▪ Consistency: heuristic “arc” cost ≤ actual cost for each arc h(A) – h(C) ≤ cost(A to C)
▪ Consequences of consistency:
▪ The f value along a path never decreases h(A) ≤ cost(A to C) + h(C)
▪ A* graph search is optimal
3
A
C
G
h=4 h=11
h=1
![Page 200: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/200.jpg)
Optimality of A* Graph Search
![Page 201: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/201.jpg)
Optimality of A* Graph Search
▪ Sketch: consider what A* does with a consistent heuristic:
▪ Fact 1: In tree search, A* expands nodes in increasing total f value (f-contours)
▪ Fact 2: For every state s, nodes that reach s optimally are expanded before nodes that reach s suboptimally
▪ Result: A* graph search is optimal
…
f ≤ 3
f ≤ 2
f ≤ 1
![Page 202: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/202.jpg)
Optimality
▪ Tree search: ▪ A* is optimal if heuristic is admissible ▪ UCS is a special case (h = 0)
▪ Graph search: ▪ A* optimal if heuristic is consistent ▪ UCS optimal (h = 0 is consistent)
▪ Consistency implies admissibility
▪ In general, most natural admissible heuristics tend to be consistent, especially if from relaxed problems
![Page 203: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/203.jpg)
A*: Summary
▪ A* uses both backward costs and (estimates of) forward costs
▪ A* is optimal with admissible / consistent heuristics
▪ Heuristic design is key: often use relaxed problems
![Page 204: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/204.jpg)
Tree Search Pseudo-Code
![Page 205: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/205.jpg)
Graph Search Pseudo-Code
![Page 206: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/206.jpg)
Example: Pancake Problem
![Page 207: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/207.jpg)
Example: Pancake Problem
![Page 208: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/208.jpg)
Example: Pancake Problem
![Page 209: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/209.jpg)
Example: Pancake Problem
![Page 210: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/210.jpg)
Example: Pancake Problem
Cost: Number of pancakes flipped
![Page 211: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/211.jpg)
Example: Pancake Problem
3
2
4
3
3
2
2
2
4
State space graph with costs as weights
34
3
4
2
![Page 212: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/212.jpg)
Example: Heuristic Function
![Page 213: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/213.jpg)
Example: Heuristic Function
Heuristic ha: the largest pancake that is still out of place
![Page 214: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/214.jpg)
Example: Heuristic Function
Heuristic ha: the largest pancake that is still out of place
43
0
2
3
3
3
4
4
3
4
4
4
h(x)
![Page 215: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/215.jpg)
Example: Heuristic Function
Heuristic ha: the largest pancake that is still out of place
43
0
2
3
3
3
4
4
3
4
4
4
h(x)
ha is admissible, because putting the pancake i into place has a cost of at least i.
![Page 216: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/216.jpg)
Example: Heuristic Function
![Page 217: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/217.jpg)
Example: Heuristic Function
Heuristic hc: the number of the pancake that is still out of place
![Page 218: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/218.jpg)
Example: Heuristic Function
Heuristic hc: the number of the pancake that is still out of place
42
0
2
3
2
3
3
2
3
4
3
3
h(x)
![Page 219: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/219.jpg)
Example: Heuristic Function
Heuristic hc: the number of the pancake that is still out of place
42
0
2
3
2
3
3
2
3
4
3
3
h(x)
hc is admissible, because a flip of size k can put at most put k pancakes into position.
![Page 220: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/220.jpg)
Example: Heuristic Function
![Page 221: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/221.jpg)
Example: Heuristic Function
Heuristic hd: one less than the size of the pancake at the top
![Page 222: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/222.jpg)
Example: Heuristic Function
Heuristic hd: one less than the size of the pancake at the top
32
0
1
2
0
1
2
3
2
1
3
0
h(x)
![Page 223: A* Search, Graph Search, Their Completeness and Optimality · A* Search, Graph Search, Their Completeness and Optimality Instructor: Wei Xu Ohio State University [These slides were](https://reader033.vdocument.in/reader033/viewer/2022060606/605c25dc1b76d6284a66773a/html5/thumbnails/223.jpg)
Example: Heuristic Function
Heuristic hd: one less than the size of the pancake at the top
32
0
1
2
0
1
2
3
2
1
3
0
h(x)
hd is admissible, because of the size of flip needed to move the top pancake into position.