Dijkstra’s Algorithm and Heuristic Graph Search David Johnson.

Slides:



Advertisements
Similar presentations
Problem solving with graph search
Advertisements

CSE 390B: Graph Algorithms Based on CSE 373 slides by Jessica Miller, Ruth Anderson 1.
1 Graphs Traversals In many graph problems, we need to traverse the vertices of the graph in some order Analogy: Binary tree traversals –Pre-order Traversal.
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
CS 206 Introduction to Computer Science II 03 / 27 / 2009 Instructor: Michael Eckmann.
ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999.
Graph Searching CSE 373 Data Structures Lecture 20.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
Breadth-First Search David Johnson. Today Look at one version of Breadth-first search on a grid Develop Matlab version of BFS.
CS171 Introduction to Computer Science II Graphs Strike Back.
State Space Search Algorithms CSE 472 Introduction to Artificial Intelligence Autumn 2003.
Review: Search problem formulation
Games with Chance Other Search Algorithms CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 3 Adapted from slides of Yoonsuck Choe.
Using Search in Problem Solving
Pathfinding Algorithms Josh Palmer Rachael Beers.
Problem Solving and Search in AI Heuristic Search
© 2006 Pearson Addison-Wesley. All rights reserved14 B-1 Chapter 14 (continued) Graphs.
5-Nov-2003 Heuristic Search Techniques What do you do when the search space is very large or infinite? We’ll study three more AI search algorithms: Backtracking.
Graphs & Graph Algorithms Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
CS 206 Introduction to Computer Science II 03 / 30 / 2009 Instructor: Michael Eckmann.
More Graph Algorithms Weiss ch Exercise: MST idea from yesterday Alternative minimum spanning tree algorithm idea Idea: Look at smallest edge not.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
Informed Search Idea: be smart about what paths to try.
Lab 3 How’d it go?.
Graphs II Robin Burke GAM 376. Admin Skip the Lua topic.
1 Game AI Path Finding. A Common Situation of Game AI A Common Situation of Game AI Path Planning Path Planning –From a start position to a destination.
Tree Searching Breadth First Search Dept First Search.
GRAPHS
COSC 2007 Data Structures II Chapter 14 Graphs III.
Shortest Path Problem Weight of the graph –Nonnegative real number assigned to the edges connecting to vertices Weighted graphs –When a graph.
How are things going? Core AI Problem Mobile robot path planning: identifying a trajectory that, when executed, will enable the robot to reach the goal.
P ROBLEM Write an algorithm that calculates the most efficient route between two points as quickly as possible.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
Informed Search Methods. Informed Search  Uninformed searches  easy  but very inefficient in most cases of huge search tree  Informed searches  uses.
Informed Search Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
For Monday Read chapter 4, section 1 No homework..
Graphs. Definitions A graph is two sets. A graph is two sets. –A set of nodes or vertices V –A set of edges E Edges connect nodes. Edges connect nodes.
Search with Costs and Heuristic Search 1 CPSC 322 – Search 3 January 17, 2011 Textbook §3.5.3, Taught by: Mike Chiang.
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.
Advanced Artificial Intelligence Lecture 2: Search.
Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Graphs. Graphs Similar to the graphs you’ve known since the 5 th grade: line graphs, bar graphs, etc., but more general. Those mathematical graphs are.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
Graph Algorithms GAM 376 Robin Burke Fall Outline Graphs Theory Data structures Graph search Algorithms DFS BFS Project #1 Soccer Break Lab.
Informed Search CSE 473 University of Washington.
Depth-First Search Lecture 21: Graph Traversals
A* Path Finding Ref: A-star tutorial.
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
3.5 Informed (Heuristic) Searches This section show how an informed search strategy can find solution more efficiently than uninformed strategy. Best-first.
Honors Track: Competitive Programming & Problem Solving Finding your way with A*-algorithm Patrick Shaw.
Artificial Intelligence Lecture No. 8 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Graph Searching CSIT 402 Data Structures II. 2 Graph Searching Methodology Depth-First Search (DFS) Depth-First Search (DFS) ›Searches down one path as.
Solving problems by searching Uninformed search algorithms Discussion Class CS 171 Friday, October, 2nd (Please read lecture topic material before and.
Best-first search is a search algorithm which explores a graph by expanding the most promising node chosen according to a specified rule.
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
For Monday Read chapter 4 exercise 1 No homework.
CSC 213 – Large Scale Programming Lecture 31: Graph Traversals.
CSE 326: Data Structures Lecture #17 Heuristic Graph Search Henry Kautz Winter Quarter 2002.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Review: Tree search Initialize the frontier using the starting state
The A* Algorithm Héctor Muñoz-Avila.
A* Path Finding Ref: A-star tutorial.
CSE 373: Data Structures and Algorithms
Weighted Graphs & Shortest Paths
HW 1: Warmup Missionaries and Cannibals
HW 1: Warmup Missionaries and Cannibals
Reading: Chapter 4.5 HW#2 out today, due Oct 5th
Presentation transcript:

Dijkstra’s Algorithm and Heuristic Graph Search David Johnson

DFS and BFS Examples of uninformed graph search –Only metric of quality is number of vertices in path Want to look at difficulty of moving along an edge –Weighted graph –Want the minimum cost path

Dijkstra’s Algorithm Always finds the lowest cost path –For positive edge weight graphs Some subtle differences with breadth-first search Maintains a cost to visit every vertex Looks at the successors of the current lowest cost vertex in the wavefront

Dijkstra’s Outline Initialize a cost array to infinity Set the start vertex cost to 0.0, put in search list Find the minimum cost vertex in searchList For each successor –Compute tentative cost = current cost + edge –If tentative cost < existing cost then overwrite Mark min cost vertex as visited/locked –This has a different meaning than breadth-first Terminate when goal is minimum cost vertex

Example Look at graph in matlab, run through by hand.

Heuristic Search More powerful techniques employ a heuristic –Estimate cost to goal –Expand most promising vertices first –Try to avoid the expanding ring of BFS and Dijkstra

Search Heuristics Heuristic –Informal approach to solving a problem –“rule-of-thumb” –Estimates On a terrain map, what would be an example heuristic for choosing which node to expand?

Greedy Best-First Search Expands the vertex in the search list with the smallest valued estimated cost to goal –Can only use when a meaningful heuristic is available –Ignores the cost so far

Dijkstra vs Best-First

Problem Solved?

A* Combines –Dijkstra’s current path cost G(n) –Best-first’s cost to goal heuristic H(n) Finds shortest paths –Under some conditions Doesn’t search as much as BFS Pretty standard

A* Expands the node with smallest F(n) = G(n) + H(n) Need to choose H(n) –If H(n) < true cost, finds shortest path What if G(n) >> H(n)? What if H(n) >> G(n)?

Some Example Heuristics 4-point connectivity (Manhattan distance)

Some Example Heuristics 8-point connectivity

Some Example Heuristics Euclidean Distance –Cannot move to match heuristic –H(n) does not match G(n)

One complication Multiple paths may have same cost A* will explore them all What kind of terrain would this map represent?

Add a tie-breaker Makes the costs not exactly the same

Implementation Just like Dijkstra –Need a cost-so-far plus heuristic cost summed array –Select current vertex based on that

More resources Amit’s A* page – mming/Heuristics.htmlhttp://theory.stanford.edu/~amitp/GameProgra mming/Heuristics.html –Applet – AStar.html