Workshop: A* Search.

Slides:



Advertisements
Similar presentations
BEST FIRST SEARCH - BeFS
Advertisements

Review: Search problem formulation
Informed search strategies
AI Pathfinding Representing the Search Space
An Introduction to Artificial Intelligence
A* Search. 2 Tree search algorithms Basic idea: Exploration of state space by generating successors of already-explored states (a.k.a.~expanding states).
Greedy best-first search Use the heuristic function to rank the nodes Search strategy –Expand node with lowest h-value Greedily trying to find the least-cost.
D* Lite an incremental version of A* for navigating in unknown terrain Focussed Dynamic A* It implements the same behavior as Stentz’
an incremental version of A*
Solving Problem by Searching
October 31, Algorithms and Data Structures Lecture XIII Simonas Šaltenis Nykredit Center for Database Research Aalborg University
CSE 101- Winter ‘15 Discussion Section January 26th 2015.
CSE 380 – Computer Game Programming Pathfinding AI
1 Ceng 585 Paper Presentation D*-Lite Path Finding Algorithm and its Variations Can Eroğul
Informed Search Idea: be smart about what paths to try.
Graphs II Robin Burke GAM 376. Admin Skip the Lua topic.
Computer Science CPSC 322 Lecture A* and Search Refinements (Ch 3.6.1, 3.7.1, 3.7.2) Slide 1.
P ROBLEM Write an algorithm that calculates the most efficient route between two points as quickly as possible.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Slides by: Eric Ringger, adapted from slides by Stuart Russell of UC Berkeley. CS 312: Algorithm Design & Analysis Lecture #36: Best-first State- space.
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Lecture 3: Uninformed Search
Review: Tree search Initialize the frontier using the starting state
BackTracking CS255.
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Shortest Paths and Minimum Spanning Trees
Single-Source Shortest Path
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Artificial Intelligence (CS 370D)
For Monday Chapter 6 Homework: Chapter 3, exercise 7.
Abstraction Transformation & Heuristics
Algorithms and Data Structures Lecture XIII
Heuristic Search Henry Kautz.
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Finding Heuristics Using Abstraction
The A* Algorithm Héctor Muñoz-Avila.
Search-Based Footstep Planning
Crowd Simulation (INFOMCRWS) - A* Search
CGDD4003 – Spring 2010 A* Path Planning.
Algorithms (2IL15) – Lecture 5 SINGLE-SOURCE SHORTEST PATHS
CSE 373: Data Structures and Algorithms
Informed search algorithms
Lectures on Graph Algorithms: searching, testing and sorting
Informed search algorithms
CS Fall 2016 (Shavlik©), Lecture 10, Week 6
Algorithms and Data Structures Lecture XIII
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
CS621: Artificial Intelligence
CSE 373: Data Structures and Algorithms
Iterative Deepening CPSC 322 – Search 6 Textbook § 3.7.3
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
CSE 473 University of Washington
Algorithms (2IL15) – Lecture 7
Lecture 14 Shortest Path (cont’d) Minimum Spanning Tree
CSE332: Data Abstractions Lecture 17: Shortest Paths
Efficiently Estimating Travel Time
HW 1: Warmup Missionaries and Cannibals
More advanced aspects of search
CSE 373 Data Structures and Algorithms
Informed Search Idea: be smart about what paths to try.
Iterative Deepening and Branch & Bound
The Rich/Knight Implementation
HW 1: Warmup Missionaries and Cannibals
CS 416 Artificial Intelligence
Lecture 13 Shortest Path (cont’d) Minimum Spanning Tree
Reading: Chapter 4.5 HW#2 out today, due Oct 5th
Informed Search Idea: be smart about what paths to try.
The Rich/Knight Implementation
Presentation transcript:

Workshop: A* Search

Goals Understand the A* algorithm Reason about its properties Know that it applies to many problems 4/6/2019 Workshop: A* Search

Contents A* basics Heuristics Properties and proofs Solving other problems Variants of A* 4/6/2019 Workshop: A* Search

Getting started A* Basics 4/6/2019 Workshop: A* Search

A* is born General-purpose graph search Very popular, also in games P. Hart, N. Nilsson, B. Raphael. A Formal Basis for the Heuristic Determination of Minimum Cost Paths (1968) General-purpose graph search Compute optimal paths Sub-optimal paths if you want to Easy to implement Very popular, also in games Many versions assume grids and distance-based costs But it’s way broader than that 4/6/2019 Workshop: A* Search

Graph search 1959: Dijkstra’s algorithm Given a graph G = (V,E) Edges e є E have non-negative costs Start vertex vs є V Compute minimum-cost paths from vs to all other vertices O(|E| + |V| log |V|) time (with the right data structures) 4/6/2019 Workshop: A* Search

Graph search 1968: A* algorithm Given a graph G = (V,E) Edges e є E have non-negative costs Start vertex vs є V, goal vertex vg є V Compute a minimum-cost path from vs to vg 4/6/2019 Workshop: A* Search

A* versus Dijkstra A* steers towards the goal using heuristics An estimate of the path cost to the goal “Dijkstra is A* without heuristics” Best-first search Expand the most promising vertex Choice of heuristic determines the behavior Optimal vs. sub-optimal paths Running time Possibility for speed-ups 4/6/2019 Workshop: A* Search

Formalized Edge costs Heuristics OPEN set CLOSED set Each edge (v,v’) has a cost c(v,v’) ≥ 0 Heuristics For each vertex v, a function h(v) estimates the path cost to vg We assume that h(v) never overestimates the actual cost (we’ll explain why later) OPEN set A “wavefront” of vertices to expand, starting at vs Sorted by f(v) = g(v) + h(v) g(v) = cost of the optimal path to v found so far CLOSED set A set of already expanded vertices 4/6/2019 Workshop: A* Search

Assignment 1 Grid example Run A* by hand and see what happens Cells are either free or blocked Each cell is connected to 4 neighbours (if they are free) Costs are uniform (e.g. 1 per cell connection) Run A* by hand and see what happens Pseudocode on next slide 4/6/2019 Workshop: A* Search

Pseudocode 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 g(vs) = 0, parent(vs) = NULL OPEN = {vs}, CLOSED = Ø while OPEN ≠ Ø v = argmin v’ є OPEN f(v’) if v = vg return the path to vs via parent pointers Remove v from OPEN Add v to CLOSED for each outgoing edge (v,v’) є E if v’ є CLOSED continue if v’ є OPEN or g(v) + c(v,v’) < g(v’) g(v’) = g(v) + c(v,v’) f(v’) = g(v’) + h(v’) parent(v’) = v Add / update v’ in OPEN return  4/6/2019 Workshop: A* Search

Solution 4/6/2019 Workshop: A* Search

εὑρίσκω (“I find / discover”) Heuristics 4/6/2019 Workshop: A* Search

3 important properties A heuristic h is perfect if: it always equals the actual path cost to the goal Formally: h(v) = g*(v,vg) for all v A heuristic h is admissible if: it never overestimates the actual path cost to the goal Formally: h(v) ≤ g*(v,vg) for all v A heuristic h is consistent/monotone if: the decrease in h is never bigger than the increase in g Formally: 1. h(vg) = 0 2. For any vertex v and any successor v’ of v during the search: h(v) ≤ c(v,v’) + h(v’) 4/6/2019 Workshop: A* Search

Assignment 2 Look at various problems and heuristics Check if the heuristics are perfect/admissible/consistent Note: A heuristic can have multiple properties! 4/6/2019 Workshop: A* Search

Reasoning about A* Properties and proofs 4/6/2019 Workshop: A* Search

Every consistent heuristic Assignment 3 Prove the following: Hints Admissible: h(v) ≤ g*(v,vg) for all v Consistent: 1. h(vg) = 0 2. For any vertex v and any successor v’ of v during the search: h(v) ≤ c(v,v’) + h(v’) You could use induction Every consistent heuristic is admissible! 4/6/2019 Workshop: A* Search

Other properties If h is admissible, A* returns an optimal path An inadmissible heuristic may still be useful (faster?) Anytime A*: Start non-optimal and improve while you have time If h is perfect, A* does not expand any vertices that are not on an optimal path If h is consistent, the optimal path to a vertex v is known as soon as v is expanded This allows us to use a closed set  If h is inconsistent, we cannot (safely) use a closed set! 4/6/2019 Workshop: A* Search

Solving other problems Graph search in other places Solving other problems 4/6/2019 Workshop: A* Search

Navigation meshes Polygonal cells  Dual graph A* on the graph h = 2D distance to goal vertex Result: sequence of cells Shorten the path within cells Optimal path? Graph: yes Original geometry: not always Multi-layered environments Heuristics? 4/6/2019 Workshop: A* Search

Abstract graph search Remember: A* can find optimal path in graphs Many search problems can be defined as graph problems Can be non-geometric Example: Sliding puzzle Vertex = puzzle state Edge = move (sliding 1 piece) Heuristic = ??? 4/6/2019 Workshop: A* Search

Variants of A* 4/6/2019 Workshop: A* Search

Anytime A* Start with a fast and imperfect search e.g. an inadmissible heuristic e.g. limited search space path cost ≤ (1+ε) * optimal cost Improve the path while time is available Check out: ARA*: Anytime A* with Provable Bounds on Sub-Optimality Likhachev et al. (2003) ANA*: Anytime Nonparametric A* van den Berg et al. (2011) 4/6/2019 Workshop: A* Search

Dynamic A* Related to / combined with anytime A* Re-plan the path when the environment changes Remember the A* search space from the initial plan Update the vertices where g changes + good for unknown environments - memory usage, structural changes Check out: D* Lite; Koenig & Lihkachev (2002) Lifelong Planning A*; Koenig et al. (2004) Dynamically Pruned A*; van Toll & Geraerts (2015) 4/6/2019 Workshop: A* Search

Hierarchical A* Exploit the environment’s hierarchy Various options Multiple “levels” of graphs e.g. highways versus city streets; multi-layered buildings Various options First plan on coarse graph, then on fine graph Optimality? Use coarse graph plan as heuristic Precomputed or on the fly? Check out: Hierarchical A*: Searching Abstraction Hierarchies Efficiently Holte et al. (1996) Near-Optimal Hierarchical Pathfinding (HPA*) Botea et al. (2004) 4/6/2019 Workshop: A* Search

Conclusions 4/6/2019 Workshop: A* Search

Goals Understand the A* algorithm Reason about its properties Know that it applies to many problems 4/6/2019 Workshop: A* Search

Conclusions A* is widely used and analyzed Not just for grids Modelling the problem is most of the work Of course, there’s much more to say Lots of resources online 4/6/2019 Workshop: A* Search