Presentation is loading. Please wait.

Presentation is loading. Please wait.

A* Path Finding Ref: A-star tutorial.

Similar presentations


Presentation on theme: "A* Path Finding Ref: A-star tutorial."— Presentation transcript:

1 A* Path Finding Ref: A-star tutorial

2 Path Finding Problem Weighted Graph

3 The Problem start target wall Find a path of lowest cost Given

4 Terminology F G H Node Traversal cost: F = G + H
Parent node; current node Traversal cost: F = G + H G: movement cost from starting point H: heuristic cost to the target (e.g., Manhattan distance) Open list & closed list Closed: traversal cost already determined Heuristics: (wiki) experience-based techniques for problem solving, learning, and discovery. Manhattan distance

5 A* Algorithm F Parent node G H Cost: F = G + H Take the node of lowest cost from open list; switch it to closed list; name it current node For its reachable and non-closed neighbors: If not in open list, add them. Make current node their parent. Evaluate costs G & H. Else (already in open), revise parent using G. update cost. (update if F becomes smaller) Stop when: target is added to closed list Open list is empty (fail to find target). No path

6 H G F closed current 60 14 74 60 40 14 54 10 50 50 10 60 30 10 40 60 14 74 50 10 60 40 14 54

7 H G F closed current 60 14 74 60 40 14 54 10 50 50 10 60 30 10 40 60 14 74 50 10 60 40 14 54 60 28 88 50 24 74

8 H G F closed current 60 14 74 60 40 14 54 10 50 50 10 60 30 10 40 60 14 74 50 10 60 40 14 54 60 28 88 50 24 74

9 H G F closed current 60 28 88 50 24 74 60 14 74 60 40 14 54 10 50 50 10 60 30 10 40 60 14 74 50 10 60 40 14 54 60 20 80 50 24 74

10 H G F closed current 60 28 88 50 24 74 60 14 74 60 40 14 54 10 50 50 10 60 30 10 40 60 14 74 50 10 60 40 14 54 60 20 80 50 24 74 40 34 74 70 38 108 60 34 94 50 38 88

11 H G F closed current 60 28 88 50 24 74 60 14 74 60 40 14 54 10 50 50 10 60 30 10 40 60 14 74 50 10 60 40 14 54 60 20 80 50 24 74 40 34 74 30 44 74 70 38 108 60 34 94 50 38 88 40 48 88

12 H G F closed current 60 28 88 50 24 74 60 14 74 60 40 14 54 10 50 50 10 60 30 10 40 60 14 74 50 10 60 40 14 54 20 54 78 10 58 68 60 20 80 50 24 74 40 34 74 30 44 74 20 54 74 70 38 108 60 34 94 50 38 88 40 48 88 30 58 88

13 H G F closed current 60 28 88 50 24 74 60 14 74 60 40 14 54 10 50 50 10 60 30 10 40 68 60 14 74 50 10 60 40 14 54 20 54 74 10 58 68 60 20 80 50 24 74 40 34 74 30 44 74 20 54 74 70 38 108 60 34 94 50 38 88 40 48 88 30 58 88

14 H G F closed current 60 28 88 50 24 74 60 14 74 60 40 14 54 10 50 50 10 60 30 10 40 68 60 14 74 50 10 60 40 14 54 20 54 74 10 58 68 60 20 80 50 24 74 40 34 74 30 44 74 20 54 74 70 38 108 60 34 94 50 38 88 40 48 88 30 58 88

15 H G F closed current 60 28 88 50 24 74 60 14 74 60 40 14 54 10 50 50 10 60 30 10 40 68 60 14 74 50 10 60 40 14 54 20 54 74 10 58 68 60 20 80 50 24 74 40 34 74 30 44 74 20 54 74 70 38 108 60 34 94 50 38 88 40 48 88 30 58 88

16 A* Demonstration (url)

17 A* Demo (url) Another JavaScript demo

18 Dijkstra, Best-first, A* Ref: url
Comparison Dijkstra, Best-first, A* Ref: url

19 Dijkstra Algorithm Repeatedly examine the reachable & not-yet-visited vertices, adding its vertices to the set of vertices to be examined. Expand outwards from the starting point until it reaches the goal. guaranteed to find a shortest path from the starting point to the goal

20 Dijkstra Algorithm a b c d e z 1 - Input: weighted graph
Iteration a b c d e z 1 - 5 4 6 1 8 a 2 z 2 Input: weighted graph Find shortest path from a to z 3 c 10 e Node a b c d e z Previous Node -

21 Dijkstra Algorithm a b c d e z 1 - 2 4 a b c d e z - b d 5 4 6 1 8 a 2
Iteration a b c d e z 1 - 2 4 5 4 6 1 8 a 2 z 2 3 c 10 e : visited (cost determined) Node a b c d e z Previous Node -

22 Dijkstra Algorithm a b c d e z 1 - 2 4 3 10 12 3 a b c d e z - c b d 5
Iteration a b c d e z 1 - 2 4 3 10 12 5 4 6 1 8 a 2 z 2 3 c 10 e 3 : visited (cost determined) Node a b c d e z Previous Node - c

23 Dijkstra Algorithm a b c d e z 1 - 2 4 3 10 12 8 a b c d e z - b b d 5
Iteration a b c d e z 1 - 2 4 3 10 12 5 4 6 1 8 a 2 z 2 3 c 10 e 8 : visited (cost determined) Node a b c d e z Previous Node - b

24 Dijkstra Algorithm a b c d e z 1 - 2 4 3 10 12 8 5 14 10 a b c d e z -
Iteration a b c d e z 1 - 2 4 3 10 12 8 5 14 5 4 6 1 8 a 2 z 2 3 c 10 e : visited (cost determined) 10 Node a b c d e z Previous Node - d

25 Dijkstra Algorithm Path: zedbca a b c d e z 1 - 2 4 3 10 12 8 5
Iteration a b c d e z 1 - 2 4 3 10 12 8 5 14 6 5 4 6 1 8 a 2 z 2 3 c 10 e : visited (cost determined) 13 Node a b c d e z Previous Node - Path: zedbca e

26 Best-First Search Instead of selecting the vertex closest to the starting point, it selects the vertex closest to the goal. (Greedy) Best-First-Search is not guaranteed to find a shortest path.

27 Dijkstra better than Best First

28 A* combines the advantages of both

29 Implementation (google code)


Download ppt "A* Path Finding Ref: A-star tutorial."

Similar presentations


Ads by Google