Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hristian Hristov Telerik Corporation

Similar presentations


Presentation on theme: "Hristian Hristov Telerik Corporation"— Presentation transcript:

1 Hristian Hristov Telerik Corporation http:/telerikacademy.com

2 1. Dijkstra algorithm 2. Greedy search 3. A*  Heuristics  Admissible heuristics  Consistent heuristic 4. Additional information 2

3 Short Revision

4  Uninformed search - We do not know where the goal is! - Guaranteed to find the goal!

5  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

6 6

7

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

9  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

11

12 Why not mixing greedy and Dijkstra? 12

13 How to mix them? - Hello heuristic functions! -admissible heuristics - consistant heuristics 13

14 What is a heuristic? 14

15  Some interesting values for graph search h(n) – heuristic of state n C(n) – actual minimum cost from n g(n) – cost to current state from start f(n) – evaluation function c(n, p) – edge between states n and p f(n) = g(n) + h(n) 15

16  Admissible heuristics for every state n: C(n) >= f(n) 16

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

18 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

19 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

20 Live demo

21  Dijkstra ALgorithms: “Programming = ++Algorithms” by P. Nakov; http://en.wikipedia.org/wiki/Dijkstra's_algorit hm http://en.wikipedia.org/wiki/Dijkstra's_algorit hm http://en.wikipedia.org/wiki/Dijkstra's_algorit hm  Heuristics: http://en.wikipedia.org/wiki/Heuristic; http://en.wikipedia.org/wiki/Admissible_heuris tic http://en.wikipedia.org/wiki/Consistent_heuris tic http://en.wikipedia.org/wiki/Heuristic http://en.wikipedia.org/wiki/Admissible_heuris tic http://en.wikipedia.org/wiki/Consistent_heuris tic http://en.wikipedia.org/wiki/Heuristic http://en.wikipedia.org/wiki/Admissible_heuris tic http://en.wikipedia.org/wiki/Consistent_heuris tic 21

22 форум програмиране, форум уеб дизайн курсове и уроци по програмиране, уеб дизайн – безплатно програмиране за деца – безплатни курсове и уроци безплатен 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# Николай Костов - блог за програмиране http://algoacademy.telerik.com

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


Download ppt "Hristian Hristov Telerik Corporation"

Similar presentations


Ads by Google