html5-img
1 / 19

Dijkstra’s Algorithm and Heuristic Graph Search

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.

bree
Download Presentation

Dijkstra’s Algorithm and Heuristic Graph Search

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Dijkstra’s Algorithm andHeuristic Graph Search David Johnson

  2. 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

  3. 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

  4. 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

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

  6. 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

  7. 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?

  8. 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

  9. Dijkstra vs Best-First

  10. Problem Solved?

  11. 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

  12. 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)?

  13. Some Example Heuristics • 4-point connectivity (Manhattan distance)

  14. Some Example Heuristics • 8-point connectivity

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

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

  17. Add a tie-breaker • Makes the costs not exactly the same

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

  19. More resources • Amit’s A* page • http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html • Applet • http://www.vision.ee.ethz.ch/~cvcourse/astar/AStar.html

More Related