a* algorithm
DESCRIPTION
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. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/1.jpg)
A* algorithm
Hristian Hristov
Telerik Corporationhttp:/telerikacademy.
com
![Page 2: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/2.jpg)
Table of Contents
1. Dijkstra algorithm
2. Greedy search
3. A*
Heuristics
Admissible heuristics
Consistent heuristic
4. Additional information
2
![Page 3: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/3.jpg)
Dijkstra algorithm Short Revision
![Page 4: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/4.jpg)
Dijkstra algorithm Uninformed search- We do not know where the goal is!
- Guaranteed to find the goal!
![Page 5: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/5.jpg)
Dijkstra algorithm Short explanation
1. 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)
5
![Page 6: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/6.jpg)
Dijsktra algorithm - Example
6
![Page 7: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/7.jpg)
Greedy search
![Page 8: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/8.jpg)
Greedy search We are informed for the goal
Use some greedy function to reach the goal
Does NOT always work!
![Page 9: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/9.jpg)
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
![Page 10: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/10.jpg)
Greedy search - Example
![Page 11: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/11.jpg)
A* algorithm
![Page 12: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/12.jpg)
A* algorithm
Why not mixing greedy and Dijkstra?
12
![Page 13: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/13.jpg)
A* algorithm
How to mix them? - Hello heuristic functions!
- admissible heuristics
- consistant heuristics
13
![Page 14: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/14.jpg)
Heuristics
What is a heuristic?
14
![Page 15: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/15.jpg)
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 p
f(n) = g(n) + h(n)15
![Page 16: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/16.jpg)
Heuristics Admissible heuristics
for every state n: C(n) >= f(n)
16
![Page 17: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/17.jpg)
HeuristicsConsistent heuristic
for every n and its successor a:
h(n) <= c(n , a) + h(a) and h(goal)=O
17
![Page 18: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/18.jpg)
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
18
![Page 19: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/19.jpg)
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 19
![Page 20: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/20.jpg)
AlgorithmLive demo
![Page 21: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/21.jpg)
Additional information Dijkstra ALgorithms: “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_heuristic
http://en.wikipedia.org/wiki/Consistent_heuristic
21
![Page 22: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/22.jpg)
форум програмиране, форум уеб дизайнкурсове и уроци по програмиране, уеб дизайн – безплатно
програмиране за деца – безплатни курсове и уроцибезплатен SEO курс - оптимизация за търсачки
уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop
уроци по програмиране и уеб дизайн за ученициASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC
безплатен курс "Разработка на софтуер в cloud среда"
BG Coder - онлайн състезателна система - online judge
курсове и уроци по програмиране, книги – безплатно от Наков
безплатен курс "Качествен програмен код"
алго академия – състезателно програмиране, състезания
ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NETкурсове и уроци по програмиране – Телерик академия
курс мобилни приложения с iPhone, Android, WP7, PhoneGap
free C# book, безплатна книга C#, книга Java, книга C#Дончо Минков - сайт за програмиранеНиколай Костов - блог за програмиранеC# курс, програмиране, безплатно
?
? ? ??
?? ?
?
?
?
??
?
?
? ?
Questions?
?http://algoacademy.telerik.com
![Page 23: A* algorithm](https://reader030.vdocument.in/reader030/viewer/2022032708/56812c66550346895d90f884/html5/thumbnails/23.jpg)
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