1 / 23

A* algorithm

A* algorithm. Hristian Hristov. Telerik Corporation. http:/telerikacademy.com. Table of Contents. Dijkstra algorithm Greedy search A* Heuristics Admissible heuristics Consistent heuristic Additional information. Dijkstra algorithm. Short Revision. Dijkstra algorithm.

Download Presentation

A* algorithm

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. A* algorithm HristianHristov Telerik Corporation http:/telerikacademy.com

  2. Table of Contents • Dijkstra algorithm • Greedy search • A* • Heuristics • Admissible heuristics • Consistent heuristic • Additional information

  3. Dijkstra algorithm Short Revision

  4. Dijkstra algorithm • Uninformed search- We do not know where the goal is! - Guaranteed to find the goal!

  5. Dijkstra algorithm • Short explanation1. Start from a certain state and add onto fringe 2. Pop the state with highest priority from the fringe, mark as used and add its unmarked successors to the fringe 3. If fringe is empty - end the algorithm, else go to step 2 • Complexity – O(nlogn)

  6. Dijsktra algorithm - Example

  7. Greedy search

  8. Greedy search We are informed for the goal Use some greedy function to reach the goal Does NOT always work!

  9. Greedy search Short explanation For the labyrinth example: 1. Start from certain state 2. Move towards the goal minimizing the Manhattan distance. 3. If cannot move – end algorithm, else go to step 2

  10. Greedy search - Example

  11. A* algorithm

  12. A* algorithm Why not mixing greedy and Dijkstra?

  13. A* algorithm How to mix them? - Hello heuristic functions! - admissible heuristics - consistant heuristics

  14. Heuristics What is a heuristic?

  15. Heuristics • Some interesting values for graph searchh(n) – heuristic of state nC(n) – actual minimum cost from ng(n) – cost to current state from startf(n) – evaluation functionc(n , p) – edge between states n and pf(n) = g(n) + h(n)

  16. Heuristics • Admissible heuristics for every state n: C(n) >= f(n)

  17. Heuristics Consistent heuristic for every n and its successor a: h(n) <= c(n , a) + h(a) and h(goal)=O

  18. A* algorithm Let’s use the heuristics! • Basically same idea as Dijkstra • Instead of the distance travelled we use the heuristics • Heuristics should be admissible and consistent

  19. A* algorithm Pseudocode 1. Push start state with its heuristics onto the fringe 2. While fringe is not empty or goal is not reached: - Pop highest-priority state from the fringe - Push its non-visited successors onto the fringe calculating their heuristics and mark current state as parent 3. Print the path if needed

  20. Algorithm Live demo

  21. Additional information • DijkstraALgorithms: “Programming = ++Algorithms” by P. Nakov;http://en.wikipedia.org/wiki/Dijkstra's_algorithm • Heuristics:http://en.wikipedia.org/wiki/Heuristic;http://en.wikipedia.org/wiki/Admissible_heuristichttp://en.wikipedia.org/wiki/Consistent_heuristic

  22. http://algoacademy.telerik.com

  23. Free Trainings @ Telerik Academy • “C# Programming @ Telerik Academy • csharpfundamentals.telerik.com • Telerik Software Academy • academy.telerik.com • Telerik Academy @ Facebook • facebook.com/TelerikAcademy • Telerik Software Academy Forums • forums.academy.telerik.com

More Related