AI_CSE5005_M2_ASearch.pptx for the algorithm for machine
2. The A* (A-star) algorithm
• The A* (A-star) algorithm is a powerful and
versatile search method used in computer
science to find the most efficient path between
nodes in a graph.
• Widely used in a variety of applications ranging
from pathfinding in video games to network
routing and AI, A* remains a foundational
technique in the field of algorithms and
artificial intelligence.
3. The Mechanism of A* Algorithm
• The core of the A* algorithm is based on cost functions and
heuristics. It uses two main parameters:
• g(n): The actual cost from the starting node to any node n.
• h(n): The heuristic estimated cost from node n to the goal. This is
where A* integrates knowledge beyond the graph to guide the
search.
• The sum, f(n)=g(n)+h(n)
f(n)=g(n)+h(n), represents the total estimated cost of the cheapest
solution through nnn.
The A* algorithm functions by maintaining a priority queue (or open
set) of all possible paths along the graph, prioritizing them based on
their fff values
4. The steps of the algorithm are as follows:
• Initialization: Start by adding the initial node to the open set with
its f(n).
• Loop: While the open set is not empty, the node with the lowest
f(n) value is removed from the queue.
• Goal Check: If this node is the goal, the algorithm terminates and
returns the discovered path.
• Node Expansion: Otherwise, expand the node (find all its
neighbors), calculating g, h, and f values for each neighbor. Add
each neighbor to the open set if it's not already present, or if a
better path to this neighbor is found.
• Repeat: The loop repeats until the goal is reached or if there are
no more nodes in the open set, indicating no available path.
5. Applications of A*
• The A* algorithm's ability to find the most efficient path with a
given heuristic makes it suitable for various practical applications:
• Pathfinding in Games and Robotics: A* is extensively used in the
gaming industry to control characters in dynamic environments,
as well as in robotics for navigating between points.
• Network Routing: In telecommunications, A* helps in
determining the shortest routing path that data packets should
take to reach the destination.
• AI and Machine Learning: A* can be used in planning and
decision-making algorithms, where multiple stages of decisions
and movements need to be evaluated.
• Pathfinding using A* Algorithm