cse 40171: artificial intelligence...games-like-age-of-empires-798x350 by 2.0 siddhartha thota...
TRANSCRIPT
![Page 1: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/1.jpg)
Informed Search: A* Search
CSE 40171: Artificial Intelligence
�1
![Page 2: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/2.jpg)
�2
Homework #2 has been released It is due at 11:59PM on 9/30
![Page 3: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/3.jpg)
Quick Recap: Search
![Page 4: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/4.jpg)
Quick Recap: SearchSearch problem: ‣ States (configurations of the world) ‣ Actions and costs ‣ Successor function (world dynamics) ‣ Start state and goal test
Search algorithm:
‣ Systematically builds a search tree
‣ Chooses an ordering of the fringe (unexplored nodes)
‣ Optimal: finds least-cost plans
Search tree:
‣ Vertices: represent plans for reaching states ‣ Plans have costs (sum of action costs)
![Page 5: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/5.jpg)
Quick Recap: Search
Image credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
Breadth-First Search
Depth-First Search
![Page 6: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/6.jpg)
What was wrong with uninformed search?
• Did not make use of problem-specific knowledge beyond the definition of the problem itself
• Was not efficient
![Page 7: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/7.jpg)
Informed Search
Image credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
![Page 8: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/8.jpg)
New Aspects of Informed Search
The general approach we will consider is best-first search‣ Instance of TREE-SEARCH or GRAPH-SEARCH
A vertex is selected for expansion based on an evaluation function, f (v) ‣ vertex v with the lowest evaluation is expanded first
Most best-first search algorithms include as a component of a heuristic function, h(v) ‣ h(v) = estimated cost of the cheapest path from the
site at vertex v to a goal state
![Page 9: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/9.jpg)
Search Heuristics
10
511.2
Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
A heuristic in this context 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 path planning
![Page 10: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/10.jpg)
Image Credit: Russel and Norvig
h(v)
![Page 11: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/11.jpg)
Greedy Best-First Search
Image credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
![Page 12: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/12.jpg)
Greedy Best-First Search
Strategy: expand the vertex that is closest to the goal
Assumption: this is likely to lead to a solution quickly
Heuristic Function: f (v) = h(v)
…b
Image credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
![Page 13: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/13.jpg)
Image Credit: Russel and Norvig
h(v)
Example with the following heuristic
![Page 14: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/14.jpg)
Practical Problems with Greedy Best-First Search
…b
Sllide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
A common case: best first takes you straight to the wrong goal
The worst case: like a badly guided depth-first search
![Page 15: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/15.jpg)
Analysis of Greedy Best-First Search
Completeness: incomplete in a finite state space (just like depth-first search)
Optimality: the algorithm is not optimal ‣ In our example, we found the path Arad → Sibiu → Fagaras → Bucharest. But this is 32KM longer than the path going from Arad → Sibiu → Rimnicu Vilcea → Pitesti → Bucharest.
Assume a uniform tree where every state has b successors
Time complexity: O(bm), where m is the maximum depth of the search space
Space complexity: O(bm)
![Page 16: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/16.jpg)
A* Search
Image credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
![Page 17: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/17.jpg)
A* Search
A* search is the most widely known form of best-first search
g(v): the cost to reach the vertex
h(v): the cost to get from the vertex to the goal
Vertices are evaluated via: f (v) = g(v) + h(v)
i.e., f (v) = estimated cost of the cheapest solution through v
![Page 18: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/18.jpg)
Image Credit: Russel and Norvig
h(v)
Example with the following heuristic
g(v): path costs in graph
![Page 19: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/19.jpg)
Visual Example of A* Search
https://bgrins.github.io/javascript-astar/demo/
![Page 20: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/20.jpg)
Conditions for Optimality in TREE-SEARCH: Admissibility
Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
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 21: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/21.jpg)
Conditions for Optimality in TREE-SEARCH: Admissibility
A heuristic h is admissible (optimistic) if:
0 ≤ h(v) ≤ h*(v)
15Example:
where h*(v) is the true cost to a nearest goal
Coming up with admissible heuristics is most of what is involved in using A* in practice.
Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
![Page 22: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/22.jpg)
Conditions for Optimality in GRAPH-SEARCH: Consistency
h(v) is consistent if:
For every vertex v and every successor v' of v generated by any action a, the estimated cost of reaching the goal from v is not greater than the step cost of getting v' plus the estimated cost of reaching the goal from v'
h(v) ≤ c(v, a, v') + h(v') ← Form of the triangle inequality
![Page 23: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/23.jpg)
Optimality of A* TREE-SEARCH
…
Assume:• A is an optimal goal vertex
• B is a suboptimal goal vertex
• h is admissible
Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
Claim:• A will exit the fringe before B
![Page 24: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/24.jpg)
Optimality of A* TREE-SEARCH
…
Proof:• Assume B is on the fringe
• Some ancestor n of A is on the fringe, too (possibly A!)
• Claim: n will be expanded before B
1. f (n) is less or equal to f (A)
Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
f (n) = g(n) + h(n)
f (n) ≤ g(A)
g(A) = f (A)
Definition of f-costAdmissibility of hh = 0 at a goal
![Page 25: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/25.jpg)
Optimality of A* TREE-SEARCH
…
Proof:• Assume B is on the fringe
• Some ancestor n of A is on the fringe, too (possibly 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)
g(A) < g(B)
f (A) < f (B)B is suboptimalh = 0 at a goal
Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
![Page 26: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/26.jpg)
Optimality of A* TREE-SEARCH
…
Proof:• Assume B is on the fringe
• Some ancestor n of A is on the fringe, too (possibly 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
f (n) ≤ f (A) < f (B)
Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
![Page 27: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/27.jpg)
Optimality of A* TREE-SEARCH
…• All ancestors of A expand before B
• A expands before B
• A* search is optimal
Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188
![Page 28: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/28.jpg)
Complexity and Completeness of A*
Completeness: A* search is complete
Depth of tree: d
Assume a uniform tree where every state has b successors
Time complexity: O(|E|) = O(bd)
Space complexity: O(|V|) = O(bd)
![Page 29: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/29.jpg)
Applications of A* Search
Originally developed as a path planner for Shakey the Robot at Stanford (1968)
SRI Shakey with callouts BY-SA 3.0 SRI International
![Page 30: CSE 40171: Artificial Intelligence...games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota Commonly used in games where terrain is mapped to a grid Title Topic_5_Informed_Search](https://reader034.vdocuments.net/reader034/viewer/2022051907/5ff9997f6898bf32853eb8c4/html5/thumbnails/30.jpg)
Applications of A* Search
games-like-age-of-empires-798x350 BY 2.0 Siddhartha Thota
Commonly used in games where terrain is mapped to a grid