Documente Academic
Documente Profesional
Documente Cultură
Rishabh Vashistha
Nishit Bose
Deepanshu Kapoor
The A* Algorithm
A* is the most popular choice for pathfinding, because its
fairly flexible and can be used in a wide range of contexts.
It avoids expanding paths that are already expensive, but
expands most promising paths first.
A* is like Dijkstras algorithm and Greedy Best-First-Search
approach in that it can use a heuristic to guide itself.
Heuristics for A *
Heuristic, is any approach to problem solving, learning, or discovery that employs a practical
method not guaranteed to be optimal or perfect, but sufficient for the immediate goals.
Selection of the path to be traversed is estimated and dependent on a mathematical function f (n)
such that :
= +
Manhattan Distance
Diagonal Distance
Euclidean Distance
MANHATTAN DISTANCE
The standard heuristic on a square grid where it can move in four directions is D times
Manhattan distance.
function heuristic(node)
dx = abs(node.x - goal.x)
dy = abs(node.y - goal.y)
return D * (dx + dy)
DIAGONAL DISTANCE
If the map allows diagonal movements we need different heuristics. In diagonal
distance instead of 4 direction there are 8*D directions.
function heuristic(node)
dx = abs(node.x - goal.x)
dy = abs(node.y - goal.y)
return D * (dx + dy) + (D2 - 2 * D) * min(dx, dy)
If map intend to move in any direction then we use Euclidean distance as heuristic
approach.
function heuristic(node)
dx = abs(node.x - goal.x)
dy = abs(node.y - goal.y)
return D * sqrt(dx * dx + dy * dy)
Working of A * Algorithm
Pre-Path Calculations:
Some nodes are defined on the search area and shortest paths are calculated for each pair of nodes
and stored in the memory. These pre-stored paths are then used during searching new paths.
CONCLUSION
At first it was made solely for shakey the robot for finding shortest path but due to its best first
greedy approach with better time complexity it finds its applications in Artificial Intelligence,
Game, Neural Networks DNA Sequencing.
A* path finding search algorithm is very famous in advanced/real-time games for finding
shortest distance between two nodes. Todays games have lakhs of components moving at a
same time in the presence of obstacles. Thus it has becomes important to find shortest paths
concurrently and in a fast way . Making use of GPUs highly parallel multi-threaded nature suits
this scenario.