SlideShare a Scribd company logo
1 of 5
Download to read offline
IOSR Journal of Computer Engineering (IOSRJCE)
ISSN: 2278-0661 Volume 4, Issue 2 (Sep.-Oct. 2012), PP 01-05
www.iosrjournals.org
www.iosrjournals.org 1 | Page
Heuristic Searching: A* Search
Nazmul Hasan
(Department of Computer Science and Engineering, Military Institute of Science and Technology, Dhaka-1216,
Bangladesh)
Abstract: Searching has a great impact on computer science. There are lots of searching algorithms. Among
them, A* search algorithm is one of the most promising algorithm. A* search algorithm is more efficient than
the other searching algorithm, because of its heuristic characteristic. A* search is widely used in path finding
and graph traversal among the points, called nodes. Due to the heuristic characteristic A* search must find the
goal with the minimum cost, if obviously there is a goal state. For this reason there are many application of this.
The aim of this paper is to understand the A* search technique, its characteristics, mathematical representation,
some graphical representation.
Keywords: Admissibility, Best-First Search, Consistency, Dominance, Heuristic.
I. Introduction
Similar to the other informed search algorithms, A* search algorithm find the path that is most
promising to reach the goal node. A* search algorithm use the Best-First Search technique to find the lowest
cost path to find the goal node starting from the starting node. To traverse a graph A* search follows the path of
the lowest known heuristic cost. And it also keeps a sorted priority queue of alternate path along the way. On the
way to the solution, A* search maintain two list to keep count of the nodes that has been traversed and nodes to
be traversed. There are referred as the open list and close list [1]
. Open list keep track of the nodes that has been
already traversed, and closed list keep track the nodes that will be traversed in future.
It uses a function that contains the summation the cost of distance and cost to demonstrate the order in
which visits nodes in the tree. For this, it has to maintain an equation. Here the equation, Total cost = Cost of
traversed from the initial node to current node + Cost of the path to be traverse for the goal node.
From the initial state A* search create a priority queue to store the nodes that to be explored. Every
node is prioritized according to the summation of the cost of already traversed and the cost of the path that will
traverse. The lower the value of summation, the higher the priority. Every step in this algorithm the node with
the higher priority (lowest summation value) will be removed from the queue. In every step of movement the
cost of the path that have been traversed and that is yet to traverse will update simultaneously. At the goal node
the value of the summation of the cost of the already traversed and node to be traversed will be lower than any
other node. I f there are more than one ways to go to the goal state, and then the path by which lowest
summation value has obtained, will be selected. At the final state the cost of the node that is to be traverse will
be zero (0).
II. Mathematical representation of A* search
Here the mathematical representation of the A* search technique.
The equation is
f(x) = g(x) + h(x).
Here,
f(x) = The total distance (cost).
g(x) = The distance (cost) from the initial position to the current position.
h(x) = The heuristic function that is used to approximate distance (cost) from the current
location to the goal state.
This function is distinct because it is a mere estimation rather than an exact value. The more accurate
the heuristic the better the faster the goal state is reach and with much more accuracy. When starting at the
initial node this search keeps track of the nodes to be traversed. This is known as the open set and it keeps track
of nodes in order of the lowest f(x) to the highest f(x). In order of priority each node is removed from the queue
and then the values for f(x) and h(x) neighboring nodes around the removed node are updated. This search
continues until it reaches the node with the lowest f(x) value, which is called the goal node. h(x) at the goal is
zero which is an admissible heuristic because the path to the goal is clearly not an overestimate.
If the heuristic function h(x) never overestimates the minimum cost of reaching the goal, also known as
being admissible, then A* is also known to be admissible.
Heuristic Searching: A* Search
www.iosrjournals.org 2 | Page
II.I Pseudo code
function A*(start, goal)
closedset := the empty set // The set of nodes already evaluated.
openset := {start} // The set of tentative nodes to be evaluated, initially containing the
start node
came_from := the empty map // The map of navigated nodes.
g_score[start] := 0 // Cost from start along best known path.
// Estimated total cost from start to goal through y.
f_score[start] := g_score[start] + heuristic_cost_estimate(start, goal)
while openset is not empty
current := the node in openset having the lowest f_score[] value
if current = goal
return reconstruct_path(came_from, goal)
remove current from openset
add current to closedset
for each neighbor in neighbor_nodes(current)
if neighbor in closedset
continue
tentative_g_score := g_score[current] + dist_between(current,neighbor)
if neighbor not in openset or tentative_g_score < g_score[neighbor]
add neighbor to openset
came_from[neighbor] := current
g_score[neighbor] := tentative_g_score
f_score[neighbor] := g_score[neighbor] + heuristic_cost_estimate(neighbor, goal)
return failure
function reconstruct_path(came_from, current_node)
if came_from[current_node] is set
p := reconstruct_path(came_from, came_from[current_node])
return (p + current_node)
else
return current_node
[Pseudo code source: http://en.wikipedia.org/wiki/A*_search_algorithm [8]
]
III. Table and Graphical Representation
Now for better understand, we will illustrate table along with graphical representation. Starts from
node A.
III.I Table
Now at first we consider the path: A  F  H  I  D  E  G
Node Value of g(x) Value of h(x) Value of f(x)
F 15 85 100
H 15 75 90
I 15 45 60
D 10 30 40
E 15 10 25
G 5 0 5
Table 1
Heuristic Searching: A* Search
www.iosrjournals.org 3 | Page
Now we consider the second path: A  B  C  D  E  G
Node Value of g(x) Value of h(x) Value of f(x)
B 10 75 85
C 10 70 80
D 10 30 40
E 15 10 25
G 5 0 5
Table 2
Now we consider the Third path: A  B  C  J  K  G
Node Value of g(x) Value of h(x) Value of f(x)
B 10 75 85
C 10 70 80
J 12 55 67
K 15 27 42
G 5 0 5
Table 3
III.II Result
Now among the three possible ways to reach goal state from the start state, the second path that means,
A  B  C  D  E  G
will cost lower than the others. So, A* search will follow this path to reach the goal node G.
III.IV Graphical Representation
IV. Properties of A* search
We can highlight three properties of A* search, they are:
 Admissibility
 Consistency
 Dominance
IV.I Admissibility :
Let, n is our starting node and g is our goal node. The cost of moving from n to g is denoting by c (n, g).
n
c (n, g)
g
Figure-2
Heuristic Searching: A* Search
www.iosrjournals.org 4 | Page
If the cost of moving from n to g node is zero, that is
n cost = 0
Figure-3
g
Then we find, c(g) = h(n) + c(n,g)
If h(n) is the heuristic of n, then heuristic value never overestimates path cost c (n, g).
h(n) <= c (n, g)
So, if h is admissible then A* search will find optimal solution. We can make it proof by contradiction.
Let, g is the optimal goal. g2 is the suboptimal goal.
So, c (g2) > c (g)
C* is the optimal cost. Now we assume that A* explore g2 as goal.
s
n g2
Figure-4
g
So, g(g2) + h(g2) <= g(n) + h(n)
c(g2) <= g(n) + h(n)
c(g2) <= g(n) + cost(n,g) = c*
So, c (g2) <= c*
So, it is contradicted to our assumption. g2 cannot be the optimal solution.
IV.II Consistency:
h will be consistent if
a,b h (a) <= h (b) + cost (a,b)
Example of consistency, from the below figure-5, we assume that,
h(a)=3 h (b) = 2 cost (a, b) = 1 g(b) = 4
s
a f(a) = h(a)+g(a) = 4+3 = 7
Figure-5 cost (a, b) = 1
So, cost = h(b) + cost (a,b) b f(b) = h(b) + g(b) = 2+4 = 6
= 2 + 1
= 3
So, 3 <= 3 , then it is true.
IV.III Dominance:
h1 dominates h2 iff h1 (n) >= h2 (n) ;n
A* will explore a node n if,
f (n) <= c*
 h (n) + g(n) <= c*
 h (n) <= c* - g(n)
Now, considering h1, h2
h1(n) <= c* - g(n)
h2(n) <= c* - g(n)
h2(n) <= h1(n) <= c* - g(n)
Since, h1(n) >= h2(n) any node explore using h1 will be explored using h2.
Heuristic Searching: A* Search
www.iosrjournals.org 5 | Page
So, h1 dominates h2.
V. Proof of completeness of A*
Here will be proved the completeness of the A* search. Before proving the completeness of A*, we
have to prove that,
f- Value is non- decreasing along any path,
f(a) = g(a) + h(a) [According to consistency property]
f(a) <= g(a) + cost(a,b) + h(b)
f(a) < = g(b) + h(b) = f(b)
f(a) <= f(b)
So, it is proved that f-value will be non-decreasing along any path.
Now we will prove that the completeness of A*. A
B D
C
Figure-6
Let, A is the state that is removed from the queue. State of the fringe has higher or equal f-value than A
(As we have proved that f-value will be non-decreasing along any path.)
Let B, C, D are the states formed by exploring node A.
So, f(B), f(C), f(D) >= f(A)
Then, A* will explore next node whose f-value >= f(current)
So, A* always explore in non-decreasing order of f-value.
Finally, A* will ultimately explore the goal state.
So, A* is complete.
VI. Dark Side of the A* Search
Though A* search is one of the most efficient searching technique, but it has also some dark side. Such
implementation of A search, required lots of memory. In general case its complexity is, O (number of the
states) For a huge search application, it may occur run out of memory.
VII. Future work
By using the A* search technique’s heuristic character, it may possible to develop the artificial
intelligence sector of the computer science. Like, implementing this searching to some kind robots like, which
are capable with some sensor devices like light, sound or radio wave to find the way to quick exit path. And this
can be used to some rescue operation, in coal mine, determining slope from the surface.
VIII. Conclusion
The theme of this paper is to show the efficiency of A* searching technique over other searching
techniques in computer science. From the above discussion and some simulations, it can be seen that A* search
is complete, optimal, admissible and consistent heuristic function. In its operation, it will expand only the
minimal number of nodes to get the goal. By this method it ensures the optimality. And if there is a goal is
present in the graph, then obviously A*will find it.
References
Conference Papers:
[1] Rong Zhou and Eric A. Hansen, Sweep A*: Space-Efficient Heuristic Search in Partially Ordered Graphs 15th IEEE International
Conference on Tools with Artificial Intelligence ² Sacramento, CA ² November 2003
[2] R. Zhou and E. Hansen, Sparse-memory graph search Proceedings of the 17th International Joint Conference on Artificial
Intelligence (IJCAI-2003), pages 1259–1266, 2003.
Journal Papers:
[3] T. Ikeda and H. Imai. Enhanced A* algorithms for multiple alignments: Optimal alignments for several sequences and k-opt
approximate alignments for large cases. Theoretical Computer Science, 210(2):341–374, 1999.
[4] R. Korf. Linear-space best-first search. Artificial Intelligence, 62:41–78, 1993.
Book:
[5] Stuart Russell, Peter Norving “Artificial Intelligence A Modern Approach” [Second Edition]
Magazine:
[6] Bryan Stout, Smart Moves: Intelligent Path finding Game Developer Magazine, July 1997
Web Site:
[7] IIT KHARAGPUR NPTEL ONLINE
[8] Wikipedia http://en.wikipedia.org/wiki/A*_search_algorithm

More Related Content

What's hot

16890 unit 2 heuristic search techniques
16890 unit 2 heuristic  search techniques16890 unit 2 heuristic  search techniques
16890 unit 2 heuristic search techniquesJais Balta
 
Ch2 3-informed (heuristic) search
Ch2 3-informed (heuristic) searchCh2 3-informed (heuristic) search
Ch2 3-informed (heuristic) searchchandsek666
 
Pathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic searchPathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic searchStavros Vassos
 
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearchJarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearchPalGov
 
Searchadditional2
Searchadditional2Searchadditional2
Searchadditional2chandsek666
 
Lecture 21 problem reduction search ao star search
Lecture 21 problem reduction search ao star searchLecture 21 problem reduction search ao star search
Lecture 21 problem reduction search ao star searchHema Kashyap
 
09 heuristic search
09 heuristic search09 heuristic search
09 heuristic searchTianlu Wang
 
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptProblem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptarunsingh660
 
Solving problems by searching Informed (heuristics) Search
Solving problems by searching Informed (heuristics) SearchSolving problems by searching Informed (heuristics) Search
Solving problems by searching Informed (heuristics) Searchmatele41
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMvikas dhakane
 
Jarrar: Informed Search
Jarrar: Informed Search  Jarrar: Informed Search
Jarrar: Informed Search Mustafa Jarrar
 
Lecture 08 uninformed search techniques
Lecture 08 uninformed search techniquesLecture 08 uninformed search techniques
Lecture 08 uninformed search techniquesHema Kashyap
 
Domain & range intro presentation
Domain & range intro presentationDomain & range intro presentation
Domain & range intro presentationdaldridge530
 

What's hot (20)

16890 unit 2 heuristic search techniques
16890 unit 2 heuristic  search techniques16890 unit 2 heuristic  search techniques
16890 unit 2 heuristic search techniques
 
04 search heuristic
04 search heuristic04 search heuristic
04 search heuristic
 
Ch2 3-informed (heuristic) search
Ch2 3-informed (heuristic) searchCh2 3-informed (heuristic) search
Ch2 3-informed (heuristic) search
 
Pathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic searchPathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic search
 
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearchJarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
 
Searchadditional2
Searchadditional2Searchadditional2
Searchadditional2
 
Lecture 21 problem reduction search ao star search
Lecture 21 problem reduction search ao star searchLecture 21 problem reduction search ao star search
Lecture 21 problem reduction search ao star search
 
M4 Heuristics
M4 HeuristicsM4 Heuristics
M4 Heuristics
 
09 heuristic search
09 heuristic search09 heuristic search
09 heuristic search
 
A star algorithms
A star algorithmsA star algorithms
A star algorithms
 
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptProblem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.ppt
 
Array
ArrayArray
Array
 
Solving problems by searching Informed (heuristics) Search
Solving problems by searching Informed (heuristics) SearchSolving problems by searching Informed (heuristics) Search
Solving problems by searching Informed (heuristics) Search
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
 
Jarrar: Informed Search
Jarrar: Informed Search  Jarrar: Informed Search
Jarrar: Informed Search
 
A* Algorithm
A* AlgorithmA* Algorithm
A* Algorithm
 
M4 heuristics
M4 heuristicsM4 heuristics
M4 heuristics
 
Game Paper
Game PaperGame Paper
Game Paper
 
Lecture 08 uninformed search techniques
Lecture 08 uninformed search techniquesLecture 08 uninformed search techniques
Lecture 08 uninformed search techniques
 
Domain & range intro presentation
Domain & range intro presentationDomain & range intro presentation
Domain & range intro presentation
 

Viewers also liked

Implementation of Fuzzy Logic for the High-Resolution Remote Sensing Images w...
Implementation of Fuzzy Logic for the High-Resolution Remote Sensing Images w...Implementation of Fuzzy Logic for the High-Resolution Remote Sensing Images w...
Implementation of Fuzzy Logic for the High-Resolution Remote Sensing Images w...IOSR Journals
 
Performance Evaluation of a Distributed System Based Upon Fault Tree Analysis
Performance Evaluation of a Distributed System Based Upon Fault Tree AnalysisPerformance Evaluation of a Distributed System Based Upon Fault Tree Analysis
Performance Evaluation of a Distributed System Based Upon Fault Tree AnalysisIOSR Journals
 
Eigenvalues for HIV-1 dynamic model with two delays
Eigenvalues for HIV-1 dynamic model with two delaysEigenvalues for HIV-1 dynamic model with two delays
Eigenvalues for HIV-1 dynamic model with two delaysIOSR Journals
 
Chained Commutative Ternary Semigroups
Chained Commutative Ternary SemigroupsChained Commutative Ternary Semigroups
Chained Commutative Ternary SemigroupsIOSR Journals
 
Integrated E-Health Approach For Early Detection of Human Body Disorders in R...
Integrated E-Health Approach For Early Detection of Human Body Disorders in R...Integrated E-Health Approach For Early Detection of Human Body Disorders in R...
Integrated E-Health Approach For Early Detection of Human Body Disorders in R...IOSR Journals
 
Software effort estimation through clustering techniques of RBFN network
Software effort estimation through clustering techniques of RBFN networkSoftware effort estimation through clustering techniques of RBFN network
Software effort estimation through clustering techniques of RBFN networkIOSR Journals
 
Rainy and Dry Days as a Stochastic Process (Albaha City)
Rainy and Dry Days as a Stochastic Process (Albaha City)Rainy and Dry Days as a Stochastic Process (Albaha City)
Rainy and Dry Days as a Stochastic Process (Albaha City)IOSR Journals
 

Viewers also liked (20)

G1303034650
G1303034650G1303034650
G1303034650
 
Implementation of Fuzzy Logic for the High-Resolution Remote Sensing Images w...
Implementation of Fuzzy Logic for the High-Resolution Remote Sensing Images w...Implementation of Fuzzy Logic for the High-Resolution Remote Sensing Images w...
Implementation of Fuzzy Logic for the High-Resolution Remote Sensing Images w...
 
F017264143
F017264143F017264143
F017264143
 
K017346572
K017346572K017346572
K017346572
 
W01761157162
W01761157162W01761157162
W01761157162
 
D010312127
D010312127D010312127
D010312127
 
M017358794
M017358794M017358794
M017358794
 
Performance Evaluation of a Distributed System Based Upon Fault Tree Analysis
Performance Evaluation of a Distributed System Based Upon Fault Tree AnalysisPerformance Evaluation of a Distributed System Based Upon Fault Tree Analysis
Performance Evaluation of a Distributed System Based Upon Fault Tree Analysis
 
D1803041822
D1803041822D1803041822
D1803041822
 
H013116878
H013116878H013116878
H013116878
 
L017146571
L017146571L017146571
L017146571
 
Eigenvalues for HIV-1 dynamic model with two delays
Eigenvalues for HIV-1 dynamic model with two delaysEigenvalues for HIV-1 dynamic model with two delays
Eigenvalues for HIV-1 dynamic model with two delays
 
J1302024854
J1302024854J1302024854
J1302024854
 
I0554754
I0554754I0554754
I0554754
 
N013148591
N013148591N013148591
N013148591
 
C1302031319
C1302031319C1302031319
C1302031319
 
Chained Commutative Ternary Semigroups
Chained Commutative Ternary SemigroupsChained Commutative Ternary Semigroups
Chained Commutative Ternary Semigroups
 
Integrated E-Health Approach For Early Detection of Human Body Disorders in R...
Integrated E-Health Approach For Early Detection of Human Body Disorders in R...Integrated E-Health Approach For Early Detection of Human Body Disorders in R...
Integrated E-Health Approach For Early Detection of Human Body Disorders in R...
 
Software effort estimation through clustering techniques of RBFN network
Software effort estimation through clustering techniques of RBFN networkSoftware effort estimation through clustering techniques of RBFN network
Software effort estimation through clustering techniques of RBFN network
 
Rainy and Dry Days as a Stochastic Process (Albaha City)
Rainy and Dry Days as a Stochastic Process (Albaha City)Rainy and Dry Days as a Stochastic Process (Albaha City)
Rainy and Dry Days as a Stochastic Process (Albaha City)
 

Similar to Heuristic Searching: A* Search

Informed Search.pptx
Informed Search.pptxInformed Search.pptx
Informed Search.pptxMohanKumarP34
 
Unit 3 Informed Search Strategies.pptx
Unit  3 Informed Search Strategies.pptxUnit  3 Informed Search Strategies.pptx
Unit 3 Informed Search Strategies.pptxDrYogeshDeshmukh1
 
Informed search algorithms.pptx
Informed search algorithms.pptxInformed search algorithms.pptx
Informed search algorithms.pptxDr.Shweta
 
Informed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data scienceInformed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data sciencedevvpillpersonal
 
Branch and bound.ppt
Branch and bound.pptBranch and bound.ppt
Branch and bound.pptumairshams6
 
Analysis of Pathfinding Algorithms
Analysis of Pathfinding AlgorithmsAnalysis of Pathfinding Algorithms
Analysis of Pathfinding AlgorithmsSigSegVSquad
 
A* and Min-Max Searching Algorithms in AI , DSA.pdf
A* and Min-Max Searching Algorithms in AI , DSA.pdfA* and Min-Max Searching Algorithms in AI , DSA.pdf
A* and Min-Max Searching Algorithms in AI , DSA.pdfCS With Logic
 
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdfAI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdfAsst.prof M.Gokilavani
 
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttktshamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttktPEACENYAMA1
 
AstarAlgorithm_v5_TeamFlash
AstarAlgorithm_v5_TeamFlashAstarAlgorithm_v5_TeamFlash
AstarAlgorithm_v5_TeamFlashShuqing Zhang
 
Route-Planning other sesion for Universal
Route-Planning other sesion for UniversalRoute-Planning other sesion for Universal
Route-Planning other sesion for UniversalDidik56
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.pptMIT,Imphal
 

Similar to Heuristic Searching: A* Search (20)

Informed Search.pptx
Informed Search.pptxInformed Search.pptx
Informed Search.pptx
 
A star
A starA star
A star
 
Unit 3 Informed Search Strategies.pptx
Unit  3 Informed Search Strategies.pptxUnit  3 Informed Search Strategies.pptx
Unit 3 Informed Search Strategies.pptx
 
Informed search algorithms.pptx
Informed search algorithms.pptxInformed search algorithms.pptx
Informed search algorithms.pptx
 
Informed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data scienceInformed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data science
 
Branch and bound.ppt
Branch and bound.pptBranch and bound.ppt
Branch and bound.ppt
 
Analysis of Pathfinding Algorithms
Analysis of Pathfinding AlgorithmsAnalysis of Pathfinding Algorithms
Analysis of Pathfinding Algorithms
 
A* and Min-Max Searching Algorithms in AI , DSA.pdf
A* and Min-Max Searching Algorithms in AI , DSA.pdfA* and Min-Max Searching Algorithms in AI , DSA.pdf
A* and Min-Max Searching Algorithms in AI , DSA.pdf
 
algorithm Unit 3
algorithm Unit 3algorithm Unit 3
algorithm Unit 3
 
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdfAI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
 
Unit 3 daa
Unit 3 daaUnit 3 daa
Unit 3 daa
 
A* Algorithm
A* AlgorithmA* Algorithm
A* Algorithm
 
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttktshamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
 
A* algorithm
A* algorithmA* algorithm
A* algorithm
 
Dstar Lite
Dstar LiteDstar Lite
Dstar Lite
 
AstarAlgorithm_v5_TeamFlash
AstarAlgorithm_v5_TeamFlashAstarAlgorithm_v5_TeamFlash
AstarAlgorithm_v5_TeamFlash
 
Route-Planning other sesion for Universal
Route-Planning other sesion for UniversalRoute-Planning other sesion for Universal
Route-Planning other sesion for Universal
 
Search 2
Search 2Search 2
Search 2
 
Final slide (bsc csit) chapter 5
Final slide (bsc csit) chapter 5Final slide (bsc csit) chapter 5
Final slide (bsc csit) chapter 5
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.ppt
 

More from IOSR Journals (20)

A011140104
A011140104A011140104
A011140104
 
M0111397100
M0111397100M0111397100
M0111397100
 
L011138596
L011138596L011138596
L011138596
 
K011138084
K011138084K011138084
K011138084
 
J011137479
J011137479J011137479
J011137479
 
I011136673
I011136673I011136673
I011136673
 
G011134454
G011134454G011134454
G011134454
 
H011135565
H011135565H011135565
H011135565
 
F011134043
F011134043F011134043
F011134043
 
E011133639
E011133639E011133639
E011133639
 
D011132635
D011132635D011132635
D011132635
 
C011131925
C011131925C011131925
C011131925
 
B011130918
B011130918B011130918
B011130918
 
A011130108
A011130108A011130108
A011130108
 
I011125160
I011125160I011125160
I011125160
 
H011124050
H011124050H011124050
H011124050
 
G011123539
G011123539G011123539
G011123539
 
F011123134
F011123134F011123134
F011123134
 
E011122530
E011122530E011122530
E011122530
 
D011121524
D011121524D011121524
D011121524
 

Recently uploaded

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 

Recently uploaded (20)

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 

Heuristic Searching: A* Search

  • 1. IOSR Journal of Computer Engineering (IOSRJCE) ISSN: 2278-0661 Volume 4, Issue 2 (Sep.-Oct. 2012), PP 01-05 www.iosrjournals.org www.iosrjournals.org 1 | Page Heuristic Searching: A* Search Nazmul Hasan (Department of Computer Science and Engineering, Military Institute of Science and Technology, Dhaka-1216, Bangladesh) Abstract: Searching has a great impact on computer science. There are lots of searching algorithms. Among them, A* search algorithm is one of the most promising algorithm. A* search algorithm is more efficient than the other searching algorithm, because of its heuristic characteristic. A* search is widely used in path finding and graph traversal among the points, called nodes. Due to the heuristic characteristic A* search must find the goal with the minimum cost, if obviously there is a goal state. For this reason there are many application of this. The aim of this paper is to understand the A* search technique, its characteristics, mathematical representation, some graphical representation. Keywords: Admissibility, Best-First Search, Consistency, Dominance, Heuristic. I. Introduction Similar to the other informed search algorithms, A* search algorithm find the path that is most promising to reach the goal node. A* search algorithm use the Best-First Search technique to find the lowest cost path to find the goal node starting from the starting node. To traverse a graph A* search follows the path of the lowest known heuristic cost. And it also keeps a sorted priority queue of alternate path along the way. On the way to the solution, A* search maintain two list to keep count of the nodes that has been traversed and nodes to be traversed. There are referred as the open list and close list [1] . Open list keep track of the nodes that has been already traversed, and closed list keep track the nodes that will be traversed in future. It uses a function that contains the summation the cost of distance and cost to demonstrate the order in which visits nodes in the tree. For this, it has to maintain an equation. Here the equation, Total cost = Cost of traversed from the initial node to current node + Cost of the path to be traverse for the goal node. From the initial state A* search create a priority queue to store the nodes that to be explored. Every node is prioritized according to the summation of the cost of already traversed and the cost of the path that will traverse. The lower the value of summation, the higher the priority. Every step in this algorithm the node with the higher priority (lowest summation value) will be removed from the queue. In every step of movement the cost of the path that have been traversed and that is yet to traverse will update simultaneously. At the goal node the value of the summation of the cost of the already traversed and node to be traversed will be lower than any other node. I f there are more than one ways to go to the goal state, and then the path by which lowest summation value has obtained, will be selected. At the final state the cost of the node that is to be traverse will be zero (0). II. Mathematical representation of A* search Here the mathematical representation of the A* search technique. The equation is f(x) = g(x) + h(x). Here, f(x) = The total distance (cost). g(x) = The distance (cost) from the initial position to the current position. h(x) = The heuristic function that is used to approximate distance (cost) from the current location to the goal state. This function is distinct because it is a mere estimation rather than an exact value. The more accurate the heuristic the better the faster the goal state is reach and with much more accuracy. When starting at the initial node this search keeps track of the nodes to be traversed. This is known as the open set and it keeps track of nodes in order of the lowest f(x) to the highest f(x). In order of priority each node is removed from the queue and then the values for f(x) and h(x) neighboring nodes around the removed node are updated. This search continues until it reaches the node with the lowest f(x) value, which is called the goal node. h(x) at the goal is zero which is an admissible heuristic because the path to the goal is clearly not an overestimate. If the heuristic function h(x) never overestimates the minimum cost of reaching the goal, also known as being admissible, then A* is also known to be admissible.
  • 2. Heuristic Searching: A* Search www.iosrjournals.org 2 | Page II.I Pseudo code function A*(start, goal) closedset := the empty set // The set of nodes already evaluated. openset := {start} // The set of tentative nodes to be evaluated, initially containing the start node came_from := the empty map // The map of navigated nodes. g_score[start] := 0 // Cost from start along best known path. // Estimated total cost from start to goal through y. f_score[start] := g_score[start] + heuristic_cost_estimate(start, goal) while openset is not empty current := the node in openset having the lowest f_score[] value if current = goal return reconstruct_path(came_from, goal) remove current from openset add current to closedset for each neighbor in neighbor_nodes(current) if neighbor in closedset continue tentative_g_score := g_score[current] + dist_between(current,neighbor) if neighbor not in openset or tentative_g_score < g_score[neighbor] add neighbor to openset came_from[neighbor] := current g_score[neighbor] := tentative_g_score f_score[neighbor] := g_score[neighbor] + heuristic_cost_estimate(neighbor, goal) return failure function reconstruct_path(came_from, current_node) if came_from[current_node] is set p := reconstruct_path(came_from, came_from[current_node]) return (p + current_node) else return current_node [Pseudo code source: http://en.wikipedia.org/wiki/A*_search_algorithm [8] ] III. Table and Graphical Representation Now for better understand, we will illustrate table along with graphical representation. Starts from node A. III.I Table Now at first we consider the path: A  F  H  I  D  E  G Node Value of g(x) Value of h(x) Value of f(x) F 15 85 100 H 15 75 90 I 15 45 60 D 10 30 40 E 15 10 25 G 5 0 5 Table 1
  • 3. Heuristic Searching: A* Search www.iosrjournals.org 3 | Page Now we consider the second path: A  B  C  D  E  G Node Value of g(x) Value of h(x) Value of f(x) B 10 75 85 C 10 70 80 D 10 30 40 E 15 10 25 G 5 0 5 Table 2 Now we consider the Third path: A  B  C  J  K  G Node Value of g(x) Value of h(x) Value of f(x) B 10 75 85 C 10 70 80 J 12 55 67 K 15 27 42 G 5 0 5 Table 3 III.II Result Now among the three possible ways to reach goal state from the start state, the second path that means, A  B  C  D  E  G will cost lower than the others. So, A* search will follow this path to reach the goal node G. III.IV Graphical Representation IV. Properties of A* search We can highlight three properties of A* search, they are:  Admissibility  Consistency  Dominance IV.I Admissibility : Let, n is our starting node and g is our goal node. The cost of moving from n to g is denoting by c (n, g). n c (n, g) g Figure-2
  • 4. Heuristic Searching: A* Search www.iosrjournals.org 4 | Page If the cost of moving from n to g node is zero, that is n cost = 0 Figure-3 g Then we find, c(g) = h(n) + c(n,g) If h(n) is the heuristic of n, then heuristic value never overestimates path cost c (n, g). h(n) <= c (n, g) So, if h is admissible then A* search will find optimal solution. We can make it proof by contradiction. Let, g is the optimal goal. g2 is the suboptimal goal. So, c (g2) > c (g) C* is the optimal cost. Now we assume that A* explore g2 as goal. s n g2 Figure-4 g So, g(g2) + h(g2) <= g(n) + h(n) c(g2) <= g(n) + h(n) c(g2) <= g(n) + cost(n,g) = c* So, c (g2) <= c* So, it is contradicted to our assumption. g2 cannot be the optimal solution. IV.II Consistency: h will be consistent if a,b h (a) <= h (b) + cost (a,b) Example of consistency, from the below figure-5, we assume that, h(a)=3 h (b) = 2 cost (a, b) = 1 g(b) = 4 s a f(a) = h(a)+g(a) = 4+3 = 7 Figure-5 cost (a, b) = 1 So, cost = h(b) + cost (a,b) b f(b) = h(b) + g(b) = 2+4 = 6 = 2 + 1 = 3 So, 3 <= 3 , then it is true. IV.III Dominance: h1 dominates h2 iff h1 (n) >= h2 (n) ;n A* will explore a node n if, f (n) <= c*  h (n) + g(n) <= c*  h (n) <= c* - g(n) Now, considering h1, h2 h1(n) <= c* - g(n) h2(n) <= c* - g(n) h2(n) <= h1(n) <= c* - g(n) Since, h1(n) >= h2(n) any node explore using h1 will be explored using h2.
  • 5. Heuristic Searching: A* Search www.iosrjournals.org 5 | Page So, h1 dominates h2. V. Proof of completeness of A* Here will be proved the completeness of the A* search. Before proving the completeness of A*, we have to prove that, f- Value is non- decreasing along any path, f(a) = g(a) + h(a) [According to consistency property] f(a) <= g(a) + cost(a,b) + h(b) f(a) < = g(b) + h(b) = f(b) f(a) <= f(b) So, it is proved that f-value will be non-decreasing along any path. Now we will prove that the completeness of A*. A B D C Figure-6 Let, A is the state that is removed from the queue. State of the fringe has higher or equal f-value than A (As we have proved that f-value will be non-decreasing along any path.) Let B, C, D are the states formed by exploring node A. So, f(B), f(C), f(D) >= f(A) Then, A* will explore next node whose f-value >= f(current) So, A* always explore in non-decreasing order of f-value. Finally, A* will ultimately explore the goal state. So, A* is complete. VI. Dark Side of the A* Search Though A* search is one of the most efficient searching technique, but it has also some dark side. Such implementation of A search, required lots of memory. In general case its complexity is, O (number of the states) For a huge search application, it may occur run out of memory. VII. Future work By using the A* search technique’s heuristic character, it may possible to develop the artificial intelligence sector of the computer science. Like, implementing this searching to some kind robots like, which are capable with some sensor devices like light, sound or radio wave to find the way to quick exit path. And this can be used to some rescue operation, in coal mine, determining slope from the surface. VIII. Conclusion The theme of this paper is to show the efficiency of A* searching technique over other searching techniques in computer science. From the above discussion and some simulations, it can be seen that A* search is complete, optimal, admissible and consistent heuristic function. In its operation, it will expand only the minimal number of nodes to get the goal. By this method it ensures the optimality. And if there is a goal is present in the graph, then obviously A*will find it. References Conference Papers: [1] Rong Zhou and Eric A. Hansen, Sweep A*: Space-Efficient Heuristic Search in Partially Ordered Graphs 15th IEEE International Conference on Tools with Artificial Intelligence ² Sacramento, CA ² November 2003 [2] R. Zhou and E. Hansen, Sparse-memory graph search Proceedings of the 17th International Joint Conference on Artificial Intelligence (IJCAI-2003), pages 1259–1266, 2003. Journal Papers: [3] T. Ikeda and H. Imai. Enhanced A* algorithms for multiple alignments: Optimal alignments for several sequences and k-opt approximate alignments for large cases. Theoretical Computer Science, 210(2):341–374, 1999. [4] R. Korf. Linear-space best-first search. Artificial Intelligence, 62:41–78, 1993. Book: [5] Stuart Russell, Peter Norving “Artificial Intelligence A Modern Approach” [Second Edition] Magazine: [6] Bryan Stout, Smart Moves: Intelligent Path finding Game Developer Magazine, July 1997 Web Site: [7] IIT KHARAGPUR NPTEL ONLINE [8] Wikipedia http://en.wikipedia.org/wiki/A*_search_algorithm