Computer Game Programming Basic Path Finding

Similar documents
Planning Techniques for Robotics Planning Representations: Skeletonization- and Grid-based Graphs

Search-based Planning with Motion Primitives. Maxim Likhachev Carnegie Mellon University

CSE-571. Deterministic Path Planning in Robotics. Maxim Likhachev 1. Motion/Path Planning. Courtesy of Maxim Likhachev University of Pennsylvania

Robot Motion Control Matteo Matteucci

Cognitive Robotics Robot Motion Planning Matteo Matteucci

ECE276B: Planning & Learning in Robotics Lecture 5: Configuration Space

Sub-optimal Heuristic Search and its Application to Planning for Manipulation

Planning, Execution and Learning Heuristics and Multi-Heuristic A*

Planning & Decision-making in Robotics Case Study: Planning for Autonomous Driving

Sub-Optimal Heuristic Search ARA* and Experience Graphs

Visual Navigation for Flying Robots. Motion Planning

Jane Li. Assistant Professor Mechanical Engineering Department, Robotic Engineering Program Worcester Polytechnic Institute

Planning Techniques for Robotics Search Algorithms: Multi-goal A*, IDA*

Lecture 3: Motion Planning (cont.)

Can work in a group of at most 3 students.! Can work individually! If you work in a group of 2 or 3 students,!

CMU-Q Lecture 4: Path Planning. Teacher: Gianni A. Di Caro

Humanoid Robotics. Path Planning and Walking. Maren Bennewitz

Robotics Tasks. CS 188: Artificial Intelligence Spring Manipulator Robots. Mobile Robots. Degrees of Freedom. Sensors and Effectors

Course Outline. Video Game AI: Lecture 7 Heuristics & Smoothing. Finding the best location out of several. Variable size units / special movement?

Robot Motion Planning

Path Planning. Marcello Restelli. Dipartimento di Elettronica e Informazione Politecnico di Milano tel:

Configuration Space of a Robot

Autonomous and Mobile Robotics Prof. Giuseppe Oriolo. Motion Planning 1 Retraction and Cell Decomposition

Visibility Graph. How does a Mobile Robot get from A to B?

Notes. Video Game AI: Lecture 5 Planning for Pathfinding. Lecture Overview. Knowledge vs Search. Jonathan Schaeffer this Friday

6.141: Robotics systems and science Lecture 10: Implementing Motion Planning

CS 4649/7649 Robot Intelligence: Planning

Navigation and Metric Path Planning

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2. Problem Solving Agents. Problem Solving Agents: Assumptions

I may not have gone where I intended to go, but I think I have ended up where I needed to be. Douglas Adams

6.141: Robotics systems and science Lecture 10: Motion Planning III

Lecture 3: Motion Planning 2

6.141: Robotics systems and science Lecture 9: Configuration Space and Motion Planning

CHAPTER SIX. the RRM creates small covering roadmaps for all tested environments.

Informed Search A* Algorithm

Advanced Robotics Path Planning & Navigation

Chapter 5.4 Artificial Intelligence: Pathfinding

Lecture 11 Combinatorial Planning: In the Plane

Pathfinding. Artificial Intelligence for gaming

CS 354R: Computer Game Technology

Motion Planning for a Point Robot (2/2) Point Robot on a Grid. Planning requires models. Point Robot on a Grid 1/18/2012.

Algorithms for Sensor-Based Robotics: Sampling-Based Motion Planning

Motion Planning. Howie CHoset

Local Search Methods. CS 188: Artificial Intelligence Fall Announcements. Hill Climbing. Hill Climbing Diagram. Today

Assignment 1 is out! Due: 9 Sep 23:59! Can work in a group of 2-3 students.! NO cheating!!!! Submit in turnitin! Code + report!

Approximate path planning. Computational Geometry csci3250 Laura Toma Bowdoin College

Informed search. Soleymani. CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2016

Search-Based Planning with Provable Suboptimality Bounds for Continuous State Spaces

Introduction to Information Science and Technology (IST) Part IV: Intelligent Machines and Robotics Planning

Announcements. CS 188: Artificial Intelligence Fall Robot motion planning! Today. Robotics Tasks. Mobile Robots

CS 188: Artificial Intelligence Fall Announcements

Algorithms for Sensor-Based Robotics: Sampling-Based Motion Planning

I may not have gone where I intended to go, but I think I have ended up where I needed to be. Douglas Adams

Robot Motion Planning

Pathfinding. Pathfinding Planned Movement

Anytime search in dynamic graphs

Planning & Decision-making in Robotics Planning Representations/Search Algorithms: RRT, RRT-Connect, RRT*

CSE 40171: Artificial Intelligence. Informed Search: A* Search

CS4733 Class Notes. 1 2-D Robot Motion Planning Algorithm Using Grown Obstacles

Introduction to State-of-the-art Motion Planning Algorithms. Presented by Konstantinos Tsianos

Anytime Search in Dynamic Graphs

Sung-Eui Yoon ( 윤성의 )

6.141: Robotics systems and science Lecture 9: Configuration Space and Motion Planning

Geometric Path Planning McGill COMP 765 Oct 12 th, 2017

Trajectory Optimization

Planning: Part 1 Classical Planning

Motion Planning. Howie CHoset

Planning, Execution and Learning Application: Examples of Planning for Mobile Manipulation and Articulated Robots

Spring 2010: Lecture 9. Ashutosh Saxena. Ashutosh Saxena

Sampling-Based Robot Motion Planning. Lydia Kavraki Department of Computer Science Rice University Houston, TX USA

CS Path Planning

CPS 170: Artificial Intelligence Search

The Drunken Sailor s Challenge

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2: Search. Problem Solving Agents

Searching with Partial Information

Computational Geometry csci3250. Laura Toma. Bowdoin College

Planning in Mobile Robotics

Informed search strategies (Section ) Source: Fotolia

Unit 5: Part 1 Planning

Manipula0on Algorithms Mo0on Planning. Mo#on Planning I. Katharina Muelling (NREC, Carnegie Mellon University) 1

Any-Angle Search Case Study: Theta* slides by Alex Nash / with contributions by Sven Koenig

Spring Localization II. Roland Siegwart, Margarita Chli, Juan Nieto, Nick Lawrance. ASL Autonomous Systems Lab. Autonomous Mobile Robots

Discrete Motion Planning

Mobile Robot Path Planning in Static Environments using Particle Swarm Optimization

Cluster Subgraphs Example, With Tile Graphs. Alternatives. Cluster Subgraphs. Cluster Subgraphs Example, With Tile Graphs

Problem Solving: Informed Search

for Motion Planning RSS Lecture 10 Prof. Seth Teller

CS 331: Artificial Intelligence Informed Search. Informed Search

Non-Homogeneous Swarms vs. MDP s A Comparison of Path Finding Under Uncertainty

Informed search algorithms

Theta*: Any-Angle Path Planning on Grids

Game AI: The set of algorithms, representations, tools, and tricks that support the creation and management of real-time digital experiences

CS 331: Artificial Intelligence Informed Search. Informed Search

Road Map Methods. Including material from Howie Choset / G.D. Hager S. Leonard

Jane Li. Assistant Professor Mechanical Engineering Department, Robotic Engineering Program Worcester Polytechnic Institute

Path Planning. Jacky Baltes Dept. of Computer Science University of Manitoba 11/21/10

Search-based Planning Library SBPL. Maxim Likhachev Robotics Institute Carnegie Mellon University

Beyond A*: Speeding up pathfinding through hierarchical abstraction. Daniel Harabor NICTA & The Australian National University

COMP9414: Artificial Intelligence Informed Search

Optimal Perception Planning with Informed Heuristics Constructed from Visibility Maps

Transcription:

15-466 Computer Game Programming Basic Path Finding Robotics Institute

Path Planning Sven Path Planning needs to be very fast (especially for games with many characters) needs to generate believable paths Why not pre-compute all paths? 2

Path Planning Sven Path Planning in partially-known environments is a repeated process dynamic environments is also a repeated process re-planning path as map becomes known 3

Definition of Path Planning Task: find a feasible (and cost-minimal) path from the current pose to a goal pose Two types of constraints: environmental constraints (e.g., obstacles) dynamics/kinematics constraints Generated motion/path should (objective): be a feasible path minimize cost such as distance, time, unrealistic effects, 4

Path Planning Examples (of what is usually referred to as path planning): 5

Path Planning Examples (of what is usually referred to as motion planning): Piano Movers problem the example above is borrowed from www.cs.cmu.edu/~awm/tutorials 6

Configuration Space Configuration is legal if it does not intersect any obstacles and is valid (e.g., does not intersect itself, joint angles are within their limits) Configuration Space is the set of legal configurations 7

Configuration Space Configuration is legal if it does not intersect any obstacles and is valid (e.g., does not intersect itself, joint angles are within their limits) Configuration Space is the set of legal configurations What is the dimensionality of this configuration space? 8

C-Space Transform Configuration space for rigid-body objects in 2D world is: - 2D if object is circular R C-Space Transform R r expand all obstacles by the radius of the object r planning can be done for a point R (and not a circle anymore) 9

C-Space Transform Configuration space for rigid-body objects in 2D world is: - 2D if object is circular Is this a correct expansion? R C-Space Transform R r expand all obstacles by the radius of the object r planning can be done for a point R (and not a circle anymore) 10

C-Space Transform Configuration space for rigid-body objects in 2D world is: - 2D if object is circular R C-Space Transform R r advantage: planning is faster for a single point why? disadvantage: need to expand obstacles every time map is updated (O(n) methods exist to compute distance transforms) 11

C-Space Transform Configuration space for arbitrary objects in 2D world is: - 3D if object is non-circular y R = 0º C-Space Transform R r = 0º x advantage: planning is faster for a single point disadvantage: constructing C-space is expensive 12

Planning as Graph Search Problem 1. Construct a graph representing the planning problem 2. Search the graph for a (hopefully, close-to-optimal) path The two steps above are often interleaved 13

Planning as Graph Search Problem 1. Construct a graph representing the planning problem 2. Search the graph for a (hopefully, close-to-optimal) path The two steps above are often interleaved 14

Cell decomposition - X-connected grids Graph Construction - lattice-based graphs replicate action template online Skeletonization of the environment/c-space -Visibility graphs - Voronoi diagrams - Probabilistic roadmaps - Navmeshes 15

Graphs Construction Once a graph is constructed, we will search it for a least-cost path Once again: depending on the planning algorithm, graph construction can be interleaved with graph search S start 1 2 S 2 S 1 1 3 S 4 S 3 2 1 S goal 16

Planning via Cell Decomposition Exact Cell Decomposition: - overlay convex exact polygons over the free C-space - construct a graph, search the graph for a path - overly expensive for non-trivial environments and/or above 2D 17

Planning via Cell Decomposition Approximate Cell Decomposition: - overlay uniform grid over the C-space (discretize) discretize planning map 18

Planning via Cell Decomposition Approximate Cell Decomposition: - construct a graph and search it for a least-cost path discretize S 1 S 2 S 3 S 4 S 5 S 6 convert into a graph S 1 S 2 S 3 S 4 S 5 S 6 planning map search the graph for a least-cost path from s start to s goal 19

Planning via Cell Decomposition Approximate Cell Decomposition: - construct a graph and search it for a least-cost path discretize eight-connected grid (one way to construct a graph) planning map S 1 S 2 S 3 S 4 S 5 S 6 convert into a graph S 1 S 2 S 3 S 4 S 5 S 6 search the graph for a least-cost path from s start to s goal 20

Planning via Cell Decomposition Approximate Cell Decomposition: - construct a graph and search it for a least-cost path - VERY popular due to its simplicity - expensive in high-dimensional spaces construct the grid on-the-fly, i.e. while planning still expensive discretize 21

Planning via Cell Decomposition Approximate Cell Decomposition: - what to do with partially blocked cells? S 1 S 2 S 3 S 4 S 5 S 6 convert into a graph S 1 S 2 S 3 S 4 S 5 S 6 search the graph for a least-cost path from s start to s goal 22

Planning via Cell Decomposition Approximate Cell Decomposition: - what to do with partially blocked cells? - make it untraversable incomplete (may not find a path that exists) S 1 S 2 S 3 S 4 S 5 S 6 convert into a graph S 1 S 2 S 3 S 4 S 5 S 6 search the graph for a least-cost path from s start to s goal 23

Planning via Cell Decomposition Approximate Cell Decomposition: - what to do with partially blocked cells? - make it traversable unsound (may return invalid path) so, what s the solution? S 1 S 2 S 3 S 4 S 5 S 6 convert into a graph S 1 S 2 S 3 S 4 S 5 S 6 search the graph for a least-cost path from s start to s goal 24

Planning via Cell Decomposition Approximate Cell Decomposition: - solution 1: - make the discretization very fine - expensive, especially in high-d S 1 S 2 S 3 S 4 S 5 S 6 convert into a graph S 1 S 2 S 3 S 4 S 5 S 6 search the graph for a least-cost path from s start to s goal 25

Planning via Cell Decomposition Approximate Cell Decomposition: - solution 2: - make the discretization adaptive - various ways possible How? S 1 S 2 S 3 S 4 S 5 S 6 convert into a graph S 1 S 2 S 3 S 4 S 5 S 6 search the graph for a least-cost path from s start to s goal 26

Planning via Cell Decomposition Graph construction: - connect neighbors eight-connected grid S 1 S 2 S 3 S 4 S 5 convert into a graph S 1 S 2 S 3 S 4 S 5 S 6 S 6 27

Planning via Cell Decomposition Graph construction: - connect neighbors - path is restricted to 45º degrees 28

Planning via Cell Decomposition Graph construction: - connect neighbors - path is restricted to 45º degrees Will planning in 3D help? 29

Planning via Cell Decomposition Graph construction: - connect cells to neighbor of neighbors - path is restricted to 22.5º degrees 16-connected grid S 1 S 2 S 3 S 4 S 5 convert into a graph S 1 S 2 S 3 S 4 S 5 S 6 S 6 30

Planning via Cell Decomposition Graph construction: - connect cells to neighbor of neighbors - path is restricted to 22.5º degrees Disadvantages? S 1 S 2 S 3 S 4 S 5 16-connected grid convert into a graph S 1 S 2 S 3 S 4 S 5 S 6 S 6 31

Planning via Cell Decomposition Graph construction: - lattice graph for computing smooth (realistic) paths outcome state is the center of the corresponding cell action template each transition is feasible (constructed beforehand) replicate it online 32

Planning via Cell Decomposition Graph construction: - lattice graph - pros: sparse graph, feasible paths - cons: possible incompleteness action template replicate it online 33

Planning via Cell Decomposition Graph construction: - lattice graph 34

Planning via Cell Decomposition Graph construction: - lattice graph planning on 4D lattice graph: each state represents <x,y,orientation,velocity> each edge represents a short feasible motion between corresponding cells part of efforts by Tartanracing team from CMU for the Urban Challenge 2007 race 35

Skeletonization of the C-Space Skeletonization: construction of a unidimensional representation of the C-space Visibility graph Voronoi diagram Probabilistic road-map Navmeshes 36

Planning via Skeletonization Visibility Graphs [Wesley & Lozano-Perez 79] - based on idea that the shortest path consists of obstacle-free straight line segments connecting all obstacle vertices and start and goal C-space or environment suboptimal path start configuration goal configuration 37

Planning via Skeletonization Visibility Graphs - based on idea that the shortest path consists of obstacle-free straight line segments connecting all obstacle vertices and start and goal Assumption? C-space or environment suboptimal path start configuration goal configuration 38

Planning via Skeletonization Visibility Graphs - based on idea that the shortest path consists of obstacle-free straight line segments connecting all obstacle vertices and start and goal Assumption? C-space or environment suboptimal path start configuration goal configuration Proof for this case? 39

Planning via Skeletonization Visibility Graphs [Wesley & Lozano-Perez 79] - construct a graph by connecting all vertices, start and goal by obstacle-free straight line segments (graph is O(n 2 ), where n - # of vert.) - search the graph for a shortest path 40

Planning via Skeletonization Visibility Graphs - advantages: - independent of the size of the environment - disadvantages: - path is too close to obstacles - hard to deal with non-uniform cost function - hard to deal with non-polygonal obstacles 41

Planning via Skeletonization Voronoi diagrams [Rowat 79] - voronoi diagram: set of all points that are equidistant to two nearest obstacles - based on the idea of maximizing clearance instead of minimizing travel distance the example above is borrowed from AI: A Modern Approach by S. RusselL & P. Norvig 42

Planning via Skeletonization Voronoi diagrams - compute voronoi diagram (O (n log n), where n - # of invalid configurations) - add a shortest path segment from start to the nearest segment of voronoi diagram - add a shortest path segment from goal to the nearest segment of voronoi diagram - compute shortest path in the graph the example above is borrowed from AI: A Modern Approach by S. RusselL & P. Norvig 43

Planning via Skeletonization Voronoi diagrams - advantages: - tends to stay away from obstacles - independent of the size of the environment - disadvantages: - can result in highly suboptimal paths the example above is borrowed from AI: A Modern Approach by S. RusselL & P. Norvig 44

Planning via Skeletonization Voronoi diagrams - advantages: - tends to stay away from obstacles - independent of the size of the environment - disadvantages: - can result in highly suboptimal paths In which environments? the example above is borrowed from AI: A Modern Approach by S. RusselL & P. Norvig 45

Planning via Skeletonization Probabilistic roadmaps [Kavraki et al. 96] - construct a graph by: - randomly sampling valid configurations - adding edges in between the samples that are easy to connect with a straight line - add start and goal configurations to the graph with appropriate edges - compute shortest path in the graph the example above is borrowed from AI: A Modern Approach by S. RusselL & P. Norvig 46

Planning via Skeletonization Probabilistic roadmaps [Kavraki et al. 96] - simple and highly effective (especially in >2D) - very popular - can result in suboptimal paths, no guarantees on suboptimality - difficulty with narrow passages the example above is borrowed from AI: A Modern Approach by S. RusselL & P. Norvig 47

Planning via Skeletonization Navmeshes - pick centers of triangles defining floor plan as graph vertices - semi-manual but very popular in games - can result in suboptimal paths, no guarantees on suboptimality from Artificial Intelligence for Games by I. Millington & J. Funge 48

Planning via Skeletonization Navmeshes - pick centers of triangles defining floor plan as graph vertices - semi-manual but very popular in games - can result in suboptimal paths, no guarantees on suboptimality Other disadvantages? from Artificial Intelligence for Games by I. Millington & J. Funge 49

Planning as Graph Search Problem 1. Construct a graph representing the planning problem 2. Search the graph for a (hopefully, close-to-optimal) path The two steps above are often interleaved 50

Searching Graphs for a Least-cost Path Once a graph is constructed (from skeletonization or uniform cell decomposition or adaptive cell decomposition or lattice or whatever else), we need to search it for a least-cost path S start 1 2 S 2 S 1 1 3 S 4 S 3 2 1 S goal 51

A* Search Computes optimal g-values for relevant states at any point of time: the cost of a shortest path from s start to s found so far g(s) an (under) estimate of the cost of a shortest path from s to s goal h(s) S S 1 S start S 2 S goal 52

A* Search Computes optimal g-values for relevant states at any point of time: g(s) h(s) heuristic function S S 1 S start S 2 S goal one popular heuristic function Euclidean distance 53

A* Search Heuristic function must be: admissible: for every state s, h(s) c*(s,s goal ) consistent (satisfy triangle inequality): minimal cost from s to s goal h(s goal,s goal ) = 0 and for every s s goal, h(s) c(s,succ(s)) + h(succ(s)) admissibility follows from consistency and often consistency follows from admissibility 54

A* Search Computes optimal g-values for relevant states Main function g(s start ) = 0; all other g-values are infinite; OPEN = {s start }; ComputePath(); publish solution; ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; expand s; for every expanded state g(s) is optimal (if heuristics are consistent) set of candidates for expansion g=0 h=3 1 S start g= h=1 g= h=2 2 S 2 S 1 1 S 4 3 S 3 g= g= h=2 h=1 2 1 g= h=0 S goal 55

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; expand s; g=0 h=3 1 S start g= h=1 g= h=2 2 S 2 S 1 1 S 4 3 S 3 g= g= h=2 h=1 2 1 g= h=0 S goal 56

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; tries to decrease g(s ) using the found path from s start to s set of states that have already been expanded g=0 h=3 1 S start g= h=1 g= h=2 2 S 2 S 1 1 S 4 3 S 3 g= g= h=2 h=1 2 1 g= h=0 S goal 57

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; CLOSED = {} OPEN = {s start } next state to expand: s start g=0 h=3 1 S start g= h=1 g= h=2 2 S 2 S 1 1 S 4 3 S 3 g= g= h=2 h=1 2 1 g= h=0 S goal 58

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; CLOSED = {} OPEN = {s start } next state to expand: s start g=0 h=3 1 S start g(s 2 ) > g(s start ) + c(s start,s 2 ) g= h=1 g= h=2 2 S 2 S 1 1 S 4 3 S 3 g= g= h=2 h=1 2 1 g= h=0 S goal 59

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; g=0 h=3 1 S start g=1 g= h=2 h=1 2 S 2 S 1 1 S 4 3 S 3 g= g= h=2 h=1 2 1 g= h=0 S goal 60

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; CLOSED = {s start } OPEN = {s 2 } next state to expand: s 2 g=0 h=3 1 S start g= h=1 g=1 h=2 2 S 2 S 1 1 S 4 3 S 3 g= g= h=2 h=1 2 1 g= h=0 S goal 61

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; CLOSED = {s start,s 2 } OPEN = {s 1,s 4 } next state to expand: s 1 g=0 h=3 1 S start g=1 g= 3 h=2 h=1 2 S 2 S 1 1 S 4 3 S 3 g= 2 g= h=2 h=1 2 1 g= h=0 S goal 62

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; CLOSED = {s start,s 2,s 1 } OPEN = {s 4,s goal } next state to expand: s 4 g=0 h=3 1 S start g=1 g= 3 h=2 h=1 2 S 2 S 1 1 S 4 3 S 3 g= 2 g= h=2 h=1 2 1 g= 5 h=0 S goal 63

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; CLOSED = {s start,s 2,s 1,s 4 } OPEN = {s 3,s goal } next state to expand: s goal g=0 h=3 1 S start g=1 g= 3 h=2 h=1 2 S 2 S 1 1 S 4 3 S 3 g= 2 g= 5 h=2 h=1 2 1 g= 5 h=0 S goal 64

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; CLOSED = {s start,s 2,s 1,s 4,s goal } OPEN = {s 3 } done g=0 h=3 1 S start g=1 g= 3 h=2 h=1 2 S 2 S 1 1 S 4 3 S 3 g= 2 g= 5 h=2 h=1 2 1 g= 5 h=0 S goal 65

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; g=0 h=3 1 S start for every expanded state g(s) is optimal for every other state g(s) is an upper bound we can now compute a least-cost path g=1 g= 3 h=2 h=1 2 S 2 S 1 1 S 4 3 S 3 g= 2 g= 5 h=2 h=1 2 1 g= 5 h=0 S goal 66

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; g=0 h=3 1 S start for every expanded state g(s) is optimal for every other state g(s) is an upper bound we can now compute a least-cost path g=1 g= 3 h=2 h=1 2 S 2 S 1 1 S 4 3 S 3 g= 2 g= 5 h=2 h=1 2 1 g= 5 h=0 S goal 67

A* Search Computes optimal g-values for relevant states ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; g=0 h=3 1 S start for every expanded state g(s) is optimal for every other state g(s) is an upper bound we can now compute a least-cost path g=1 g= 3 h=2 h=1 2 S 2 S 1 1 S 4 3 S 3 g= 2 g= 5 h=2 h=1 why? 2 1 g= 5 h=0 S goal 68

A* Search Is guaranteed to return an optimal path (in fact, for every expanded state) optimal in terms of the solution Performs provably minimal number of state expansions required to guarantee optimality optimal in terms of the computations g=0 h=3 1 S start g=1 g= 3 h=2 h=1 2 S 2 S 1 1 S 4 3 S 3 g= 2 g= 5 h=2 h=1 2 1 g= 5 h=0 S goal 69

Effect of the Heuristic Function A* Search: expands states in the order of f = g+h values ComputePath function while(s goal is not expanded) remove s with the smallest [f(s) = g(s)+h(s)] from OPEN; insert s into CLOSED; for every successor s of s such that s not in CLOSED if g(s ) > g(s) + c(s,s ) g(s ) = g(s) + c(s,s ); insert s into OPEN; expansion of s 70

Effect of the Heuristic Function A* Search: expands states in the order of f = g+h values Dijkstra s: expands states in the order of f = g values (pretty much) Intuitively: f(s) estimate of the cost of a least cost path from start to goal via s the cost of a shortest path from s start to s found so far g(s) S an (under) estimate of the cost of a shortest path from s to s goal h(s) S 1 S start S 2 S goal 71

Effect of the Heuristic Function A* Search: expands states in the order of f = g+h values Dijkstra s: expands states in the order of f = g values (pretty much) Weighted A*: expands states in the order of f = g+εh values, ε > 1 = bias towards states that are closer to goal the cost of a shortest path from s start to s found so far g(s) an (under) estimate of the cost of a shortest path from s to s goal h(s) S 1 S start S 2 S S goal 72

Effect of the Heuristic Function Dijkstra s: expands states in the order of f = g values What are the states expanded? s start s goal 73

Effect of the Heuristic Function A* Search: expands states in the order of f = g+h values What are the states expanded? s start s goal 74

Effect of the Heuristic Function A* Search: expands states in the order of f = g+h values for large problems this results in A* being slow s start s goal 75

Effect of the Heuristic Function Weighted A* Search: expands states in the order of f = g+εh values, ε > 1 = bias towards states that are closer to goal what states are expanded? research question s start s goal 76

Effect of the Heuristic Function Weighted A* Search: trades off optimality for speed ε-suboptimal: cost(solution) ε cost(optimal solution) in many domains, it has been shown to be orders of magnitude faster than A* A*: ε =1.0 Weighted A*: ε =2.5 20 expansions solution=10 moves 13 expansions solution=11 moves 77