a* path finding ref: a-star tutorial
Post on 06-Jan-2018
244 Views
Preview:
DESCRIPTION
TRANSCRIPT
A* Path FindingRef: A-star tutorial
The Problem
start target
Given
Find a path of lowest costwall
TerminologyNode
Parent node; current nodeTraversal 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
A* AlgorithmTake the node of lowest cost from open list; switch it to closed list; name it current nodeFor 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.Stop when: target is added to closed list Open list is empty (fail to find target). No path
(0,0)
(0,4)
(6,0)
(5,2)(1,2)
ExampleOpen: (0,1),(0,2),(0,3),(1,1),(1,3),(2,1),(2,2),(2,3)
Closed:(1,2)
(0,0)
(0,4)
(6,0)
(5,2)(1,2)
Open: (0,1),(0,2),(0,3),(1,1),(1,3),(2,1),(2,3)Closed: (1,2),(2,2)
10+10<14
Open: (0,1),(0,2),(0,3),(1,1),(1,3),(2,3),(1,0),(2,0)Closed: (1,2),(2,2),(2,1)
(0,0)
(0,4)
(6,0)This neighbor is NOT addeddue to the “cut-corner” constraint
Finally,
ComparisonDijkstra, Best-first, A* Ref: url
Dijkstra AlgorithmRepeatedly examines the closest not-yet-examined vertex, adding its vertices to the set of vertices to be examined. expands outwards from the starting point until it reaches the goal.guaranteed to find a shortest path from the starting point to the goal
Best-First SearchInstead 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.
Dijkstra better than Best first
Dijkstra Best-first
A* combines the advantages of both
Implementation (google code)
top related