0% found this document useful (0 votes)
90 views14 pages

A Search Algorithm: Krishna Kumar (IT2018/122) Kishan Raj (IT2018/025) Aavriti Dutta (IT2018/101)

A* search algorithm is an informed search algorithm that finds the shortest path between a starting node and goal node. It uses both the cost of getting from the starting node to the current node (g(n)) and an estimate of the cost to get from the current node to the goal node (h(n)) to determine the best order to explore nodes. A* selects the node with the lowest combined cost (f(n) = g(n) + h(n)) to expand next. It will continue expanding nodes until the goal is found. The time complexity of A* depends on the heuristic function and branching factor.

Uploaded by

Jessi Krishna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views14 pages

A Search Algorithm: Krishna Kumar (IT2018/122) Kishan Raj (IT2018/025) Aavriti Dutta (IT2018/101)

A* search algorithm is an informed search algorithm that finds the shortest path between a starting node and goal node. It uses both the cost of getting from the starting node to the current node (g(n)) and an estimate of the cost to get from the current node to the goal node (h(n)) to determine the best order to explore nodes. A* selects the node with the lowest combined cost (f(n) = g(n) + h(n)) to expand next. It will continue expanding nodes until the goal is found. The time complexity of A* depends on the heuristic function and branching factor.

Uploaded by

Jessi Krishna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

A* SEARCH ALGORITHM

Presented By Group 19

Krishna Kumar(IT2018/122)
Kishan Raj(IT2018/025)
Aavriti Dutta(IT2018/101)
HEURISTIC SEARCH

Heuristic function- Heuristic is a function which is used in Informed Search, and it


finds the most promising path.This function estimates how close a state is to the
goal.It is represented by h(n), and it calculates the cost of an optimal path between
the pair of states.

Heuristic search – It is the simplest form of informed search algorithms that


expands the nodes based on their heuristic value ie. h(n).
A* SEARCH ALGORITHM

A* search is the most commonly known form of best-first search.It uses heuristic function h(n), and the
cost to reach the node n from the start state ie. g(n).This search algorithm expands less search tree and
provides optimal result faster. And it is also worth mentioning that many games and web-based maps
use this algorithm to find the shortest path very efficiently.
It is formulated in terms of weighted graphs: starting from a specific starting node of a graph, it aims to
find a path to the given goal node having the smallest cost (least distance travelled, shortest time, etc.)
It does this by maintaining a tree of path originating at the start node and extending those paths one
edge at a time until the goal node is reached.
At each point in the search space, only those nodes are expanded which have the lowest value of f(n),
and the algorithm terminates when the goal node is found.
Function of A* Search Algorithm
f(n) = g(n) + h(n)

Estimated cost of Cost to reach n Cost to reach from


the cheapest node from start node n to goal node
solution state

g(n) : the exact cost of moving from the Starting node to the
current node. Basically, it is the sum of all the cells that
have been visited since leaving the first cell.

h(n) : the heuristic value associated with each node, it is


the estimated cost of moving from the current node to the
final node. The actual cost cannot be calculated until the
final cell is reached. Hence, h(n) is the estimated cost.

f(n): estimated cost of the cheapest solution ie. Sum of the


values of g(n) and h(n).
How A* Search works?

Step1: Place the starting node in the start node.

Step2: Check if the start node is empty or not, if empty then return failure and stop.

Step3: Select the node from next to start which has the smallest value of evaluation
function (g+h), if node n is goal node then return success and stop.

Step4: Expand node n and generate all of its successors, and put n into the memory. For
each successor n', check whether n' is already in the memory or not, if not then
compute evaluation function for n' and place into memory.

Step5: Repeat the above steps untill the goal node is reached.
Example of A* Search
Let us understand the process of A* search algorithm with the help of an example

S → Starting Node
G → Goal Node
f(n)=g(n)+h(n)

Step-1
Initialization: f(S)=0+5=5

Red values: Heuristic cost

Black values: Exact cost


Step-2
Iteration1: Cost for path
S→A=1+3=4
S→G=0+10=10

Path after iteration1:-


(S→ A, 4)
(S→G, 10)

(S→ A) is chosen
Step-3
Iteration2: Cost for path
S→A→C=1+1+2=4
S→A→B=1+2+4=7
S→G=0+10=10

Path after iteration2:-


(S→ A→C, 4)
(S→ A→B, 7)
(S→G, 10)}

(S→A→C) is chosen
Step-4
Iteration3: Cost for path
S→A→C→G=1+1+4=6
S→A→C→D=1+1+3+6=11
S→A→B=1+2+4=7
S→G=0+10=10

Path after iteration3:-


(S→ A→C→G, 6)
(S→A→C→D, 11)
(S→A→B, 7)
(S→G, 10)
Step-5

Iteration 4 will give the final result, as

S→A→C→G

it provides the optimal path with cost 6.

Tree
Advantages of A* search algorithm:-

i. This algorithm can solve many complex problems.


ii. This algorithm is optimal and complete.
iii. It is the best search algorithm and is used in many fields of computer science and various
web based games.

Disadvantages of A* search algorithm:-

iv. It does not always produce the shortest path as it is mostly based on heuristic and
approximation.
v. A* algorithm has some complexity issues as we have to explore every nodes to find the
optimal path.
vi. The algorithm is complete only if the branching factor is finite and every action
has fixed cost.
Points to be remembered:-
i. A* algorithm returns the path which occurred first, and it does not search
for all remaining paths.
ii. The efficiency of A* algorithm depends on the quality of heuristic.
iii. A* algorithm expands all nodes which satisfy the condition f(n).
iv. It is not practical for various large scale problems because there is
memory requirement as it keeps all generated nodes in the memory.
v. Time Complexity: The time complexity of A* search algorithm depends on
heuristic function, and the number of nodes expanded is exponential to the
depth of solution “d”.So the time complexity is O(b^d), where “b” is the
branching factor.
vi. Space Complexity: The space complexity of A* search algorithm
is O(b^d).
Conclusion:-
A* is a mighty algorithm in Artificial Intelligence with a wide range
of usage. However, it is only as good as its heuristic function( which
can be highly variable considering the nature of a problem).
A* is the most popular choice for pathfinding because it’s reasonably
flexible.
It has found applications in many software systems, from Machine
Learning and search Optimization to game development where
characters navigate through complex terrain and obstacles to reach the
player.
THANK
YOU!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy