SlideShare une entreprise Scribd logo
1  sur  15
A* Algorithm
Dr. C.V. Suresh Babu
(CentreforKnowledgeTransfer)
institute
Topics for Discussion
 What is A-Star (A*) Algorithm in Artificial Intelligence?
 A* Algorithm Steps
 Why is A* Search Algorithm Preferred?
 A* and Its Basic Concepts
 What is a Heuristic Function?
 Admissibility of the Heuristic Function
 Consistency of the Heuristic Function
(CentreforKnowledgeTransfer)
institute
Introduction
 AI helps us solve problems of various complexities.
 Computational problems like path search problems can be solved using AI.
Search problems, where you need to find a path from one point to
another, say, point A to point B.
 Sometimes you need to solve it by mapping those problems to graphs,
where all the possible outcomes are represented by nodes. A* algorithm
comes up as an answer to these problems.
(CentreforKnowledgeTransfer)
institute
 Created as part of the Shakey project aimed to build a mobile robot that
has artificial intelligence to plan its actions, A* was initially designed as a
general graph traversal algorithm.
 It is widely used in solving pathfinding problems in video games. Because
of its flexibility and versatility, it can be used in a wide range of contexts.
 A* is formulated with weighted graphs, which means it can find the best
path involving the smallest cost in terms of distance and time.
 This makes A* algorithm in artificial intelligence an informed search
algorithm for best-first search.
 Let us have a detailed look into the various aspects of A*.
(CentreforKnowledgeTransfer)
institute
What is A* Algorithm in Artificial
Intelligence?
 The most important advantage of A* search algorithm which separates it
from other traversal techniques is that it has a brain.
 This makes A* very smart and pushes it much ahead of other
conventional algorithms.
(CentreforKnowledgeTransfer)
institute
 Let’s try to understand Basic AI Concepts and to comprehend
how does A* algorithm work.
 Imagine a huge maze, one that is too big that it takes hours to
reach the endpoint manually.
 Once you complete it on foot, you need to go for another one.
 Which implies that you would end up investing a lot of time
and effort to find the possible paths in this maze.
 Now, you want to make it less time-consuming.
 To make it easier, we will consider this maze as a search
problem and will try to apply it to other possible mazes we
might encounter in the due course, provided they follow the
same structure and rules.
(CentreforKnowledgeTransfer)
institute
Converting Maze into a search
problem
As the first step to convert this maze into a search problem, we need to
define these six things.
1. A set of prospective states we might be in
2. A beginning and end state
3. A way to decide if we’ve reached the endpoint
4. A set of actions in case of possible direction/path changes
5. A function that advises us about the result of an action
6. A set of costs incurring in different states/paths of movement
(CentreforKnowledgeTransfer)
institute
 To solve the problem, we need to map the intersections to the
nodes (denoted by the red dots) and all the possible ways we
can make movements towards the edges (denoted by the
blue lines).
 A denotes the starting point and B denotes the endpoint. We
define the starting and endpoint at the nodes A and B
respectively.
 If we use an uninformed search algorithm, it would be like
finding a path that is blind, while an informed algorithm for a
search problem would take the path that brings you closer to
your destination.
For instance, consider Rubik’s cube; it has many
prospective states that you can be in and this makes
the solution very difficult. This calls for the use of a
guided search algorithm to find a solution. This
explains the importance of A*.
(CentreforKnowledgeTransfer)
institute
Why A*?
 Unlike other algorithms, A* decides to take up a step only if it is
convincingly sensible and reasonable as per its functions.
 Which means, it never considers any non-optimal steps.
 This is why A* is a popular choice for AI systems that replicate the real
world – like video games and machine learning.
(CentreforKnowledgeTransfer)
institute
A* Algorithm Steps
 Firstly, add the beginning node to the open list
 Then repeat the following step
 – In the open list, find the square with the lowest F cost – and this denotes the current square.
– Now we move to the closed square.
– Consider 8 squares adjacent to the current square and
 Ignore it if it is on the closed list, or if it is not workable. Do the following if it is workable
 Check if it is on the open list; if not, add it. You need to make the current square as this square’s a parent.
You will now record the different costs of the square like the F, G and H costs.
 If it is on the open list, use G cost to measure the better path. Lower the G cost, the better the path. If
this path is better, make the current square as the parent square. Now you need to recalculate the other
scores – the G and F scores of this square.
 – You’ll stop:
 If you find the path, you need to check the closed list and add the target square to it.
 There is no path if the open list is empty and you could not find the target square.
 3. Now you can save the path and work backwards starting from the target square, going to the parent
square from each square you go, till it takes you to the starting square. You’ve found your path now.
(CentreforKnowledgeTransfer)
institute
Why is A* Search Algorithm Preferred?
 The task is to take the unit you see at the bottom of the diagram, to the top of it.
You can see that there is nothing to indicate that the object should not take the
path denoted with pink lines.
 So it chooses to move that way. As and when it reaches the top it has to change
its direction because of the ‘U’ shaped obstacle.
 Then it changes the direction, goes around the obstacle, to reach the top. In
contrast to this, A* would have scanned the area above the object and found a
short path (denoted with blue lines).
 Thus, pathfinder algorithms like A* help you plan things rather than waiting until
you discover the problem.
 They act proactively rather than reacting to a situation.
 The disadvantage is that it is a bit slower than the other algorithms.
 You can use a combination of both to achieve better results – pathfinding
algorithms give bigger picture and long paths with obstacles that change slowly;
and movement algorithms for local picture and short paths with obstacles that
change faster.
It’s easy to give movement to objects. But pathfinding is not simple. It is a complex exercise. The
following situation explains it.
(CentreforKnowledgeTransfer)
institute
A* Algorithm and Its Basic Concepts
 A* algorithm works based on heuristic methods and this helps achieve optimality.
 A* is a different form of the best-first algorithm.
 Optimality empowers an algorithm to find the best possible solution to a problem.
 Such algorithms also offer completeness, if there is any solution possible to an existing problem, the
algorithm will definitely find it.
When A* enters into a problem, firstly it calculates the cost to travel to the neighbouring nodes and
chooses the node with the lowest cost.
 If The f(n) denotes the cost, A* chooses the node with the lowest f(n) value.
 Here ‘n’ denotes the neighbouring nodes. The calculation of the value can be done as shown below:
f(n)=g(n)+h(n)f(n)=g(n)+h(n)
g(n) = shows the shortest path’s value from the starting node to node n
h(n) = The heuristic approximation of the value of the node
 The heuristic value has an important role in the efficiency of the A* algorithm.
 To find the best solution, you might have to use different heuristic function according to the type of
the problem.
 However, the creation of these functions is a difficult task, and this is the basic problem we face in AI.
(CentreforKnowledgeTransfer)
institute
What is a Heuristic Function?
 A heuristic as it is simply called, a heuristic
function that helps rank the alternatives given
in a search algorithm at each of its steps.
 It can either produce a result on its own or
work in conjugation with a given algorithm to
create a result.
 Essentially, a heuristic function helps
algorithms to make the best decision faster
and more efficiently.
 This ranking is made based on the best
available information and helps the algorithm
to decide on the best possible branch to
follow.
 Admissibility and consistency are the two
fundamental properties of a heuristic function.
(CentreforKnowledgeTransfer)
institute
Admissibility of the Heuristic Function
 A heuristic function is admissible if it could effectively estimate the real
distance between a node ‘n’ and the end node.
 It never overestimates and if it ever does, it will be denoted by ‘d’, which
also denotes the accuracy of the solution.
(CentreforKnowledgeTransfer)
institute
Consistency of the Heuristic Function
 A heuristic function is consistent if the estimate of a given heuristic function turns out to
be equal to, or less than the distance between the goal (n) and a neighbour, and the
cost calculated to reach that neighbour.
 A* is indeed a very powerful algorithm used to increase the performance of artificial
intelligence. It is one of the most popular search algorithms in AI.
 Sky is the limit when it comes to the potential of this algorithm. However, the efficiency
of an A* algorithm highly depends on the quality of its heuristic function.
 Wonder why this algorithm is preferred and used in many software systems?
 There is no single facet of AI where A*algorithm has not found its application. From
search optimization to games, robotics and machine learning, A* algorithm is an
inevitable part of a smart program.
(CentreforKnowledgeTransfer)
institute

Contenu connexe

Tendances

Heuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptHeuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptkarthikaparthasarath
 
Uninformed search /Blind search in AI
Uninformed search /Blind search in AIUninformed search /Blind search in AI
Uninformed search /Blind search in AIKirti Verma
 
Lecture 16 memory bounded search
Lecture 16 memory bounded searchLecture 16 memory bounded search
Lecture 16 memory bounded searchHema Kashyap
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMvikas dhakane
 
Heuristics Search Techniques in AI
Heuristics Search Techniques in AI Heuristics Search Techniques in AI
Heuristics Search Techniques in AI Bharat Bhushan
 
knowledge representation using rules
knowledge representation using rulesknowledge representation using rules
knowledge representation using rulesHarini Balamurugan
 
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
 
I. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithmI. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithmvikas dhakane
 
Artificial Intelligence Searching Techniques
Artificial Intelligence Searching TechniquesArtificial Intelligence Searching Techniques
Artificial Intelligence Searching TechniquesDr. C.V. Suresh Babu
 
4 informed-search
4 informed-search4 informed-search
4 informed-searchMhd Sb
 
Local search algorithm
Local search algorithmLocal search algorithm
Local search algorithmMegha Sharma
 
Heuristc Search Techniques
Heuristc Search TechniquesHeuristc Search Techniques
Heuristc Search TechniquesJismy .K.Jose
 

Tendances (20)

A star algorithms
A star algorithmsA star algorithms
A star algorithms
 
Heuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptHeuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.ppt
 
AI Lecture 3 (solving problems by searching)
AI Lecture 3 (solving problems by searching)AI Lecture 3 (solving problems by searching)
AI Lecture 3 (solving problems by searching)
 
Astar algorithm
Astar algorithmAstar algorithm
Astar algorithm
 
Uninformed search /Blind search in AI
Uninformed search /Blind search in AIUninformed search /Blind search in AI
Uninformed search /Blind search in AI
 
Hill climbing algorithm
Hill climbing algorithmHill climbing algorithm
Hill climbing algorithm
 
Lecture 16 memory bounded search
Lecture 16 memory bounded searchLecture 16 memory bounded search
Lecture 16 memory bounded search
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
 
Heuristics Search Techniques in AI
Heuristics Search Techniques in AI Heuristics Search Techniques in AI
Heuristics Search Techniques in AI
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 
knowledge representation using rules
knowledge representation using rulesknowledge representation using rules
knowledge representation using rules
 
search strategies in artificial intelligence
search strategies in artificial intelligencesearch strategies in artificial intelligence
search strategies in artificial intelligence
 
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
 
I. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithmI. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithm
 
Artificial Intelligence Searching Techniques
Artificial Intelligence Searching TechniquesArtificial Intelligence Searching Techniques
Artificial Intelligence Searching Techniques
 
4 informed-search
4 informed-search4 informed-search
4 informed-search
 
Local search algorithm
Local search algorithmLocal search algorithm
Local search algorithm
 
A Star Search
A Star SearchA Star Search
A Star Search
 
Heuristc Search Techniques
Heuristc Search TechniquesHeuristc Search Techniques
Heuristc Search Techniques
 
AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)
 

Similaire à A* Algorithm

unit-1-l3AI..........................ppt
unit-1-l3AI..........................pptunit-1-l3AI..........................ppt
unit-1-l3AI..........................pptShilpaBhatia32
 
Heuristic search-in-artificial-intelligence
Heuristic search-in-artificial-intelligenceHeuristic search-in-artificial-intelligence
Heuristic search-in-artificial-intelligencegrinu
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxSwagat Praharaj
 
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?Santosh Pandeya
 
Exploring Algorithms
Exploring AlgorithmsExploring Algorithms
Exploring AlgorithmsSri Prasanna
 
Popular search algorithms
Popular search algorithmsPopular search algorithms
Popular search algorithmsMinakshi Atre
 
Straight Line Distance Heuristic
Straight Line Distance HeuristicStraight Line Distance Heuristic
Straight Line Distance Heuristicahmad bassiouny
 
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
 
Jarrar.lecture notes.aai.2011s.ch3.uniformedsearch
Jarrar.lecture notes.aai.2011s.ch3.uniformedsearchJarrar.lecture notes.aai.2011s.ch3.uniformedsearch
Jarrar.lecture notes.aai.2011s.ch3.uniformedsearchPalGov
 
Practical Digital Image Processing 3
 Practical Digital Image Processing 3 Practical Digital Image Processing 3
Practical Digital Image Processing 3Aly Abdelkareem
 
autonomous-vehicles_final
autonomous-vehicles_finalautonomous-vehicles_final
autonomous-vehicles_finalNicholas Jones
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.pptMIT,Imphal
 
Comparison of various heuristic
Comparison of various heuristicComparison of various heuristic
Comparison of various heuristicijaia
 
AbstractWe design an software to find optimal(shortest) path .docx
AbstractWe design an software to find optimal(shortest) path .docxAbstractWe design an software to find optimal(shortest) path .docx
AbstractWe design an software to find optimal(shortest) path .docxaryan532920
 
AI_03_Solving Problems by Searching.pptx
AI_03_Solving Problems by Searching.pptxAI_03_Solving Problems by Searching.pptx
AI_03_Solving Problems by Searching.pptxYousef Aburawi
 
Path Planning And Navigation
Path Planning And NavigationPath Planning And Navigation
Path Planning And Navigationguest90654fd
 

Similaire à A* Algorithm (20)

artifical intelligence final paper
artifical intelligence final paperartifical intelligence final paper
artifical intelligence final paper
 
Ai1.pdf
Ai1.pdfAi1.pdf
Ai1.pdf
 
unit-1-l3.ppt
unit-1-l3.pptunit-1-l3.ppt
unit-1-l3.ppt
 
unit-1-l3AI..........................ppt
unit-1-l3AI..........................pptunit-1-l3AI..........................ppt
unit-1-l3AI..........................ppt
 
Heuristic search-in-artificial-intelligence
Heuristic search-in-artificial-intelligenceHeuristic search-in-artificial-intelligence
Heuristic search-in-artificial-intelligence
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptx
 
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
 
Exploring Algorithms
Exploring AlgorithmsExploring Algorithms
Exploring Algorithms
 
Popular search algorithms
Popular search algorithmsPopular search algorithms
Popular search algorithms
 
Straight Line Distance Heuristic
Straight Line Distance HeuristicStraight Line Distance Heuristic
Straight Line Distance Heuristic
 
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
 
Jarrar.lecture notes.aai.2011s.ch3.uniformedsearch
Jarrar.lecture notes.aai.2011s.ch3.uniformedsearchJarrar.lecture notes.aai.2011s.ch3.uniformedsearch
Jarrar.lecture notes.aai.2011s.ch3.uniformedsearch
 
Practical Digital Image Processing 3
 Practical Digital Image Processing 3 Practical Digital Image Processing 3
Practical Digital Image Processing 3
 
autonomous-vehicles_final
autonomous-vehicles_finalautonomous-vehicles_final
autonomous-vehicles_final
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.ppt
 
Comparison of various heuristic
Comparison of various heuristicComparison of various heuristic
Comparison of various heuristic
 
AbstractWe design an software to find optimal(shortest) path .docx
AbstractWe design an software to find optimal(shortest) path .docxAbstractWe design an software to find optimal(shortest) path .docx
AbstractWe design an software to find optimal(shortest) path .docx
 
Game Paper
Game PaperGame Paper
Game Paper
 
AI_03_Solving Problems by Searching.pptx
AI_03_Solving Problems by Searching.pptxAI_03_Solving Problems by Searching.pptx
AI_03_Solving Problems by Searching.pptx
 
Path Planning And Navigation
Path Planning And NavigationPath Planning And Navigation
Path Planning And Navigation
 

Plus de Dr. C.V. Suresh Babu (20)

Data analytics with R
Data analytics with RData analytics with R
Data analytics with R
 
Association rules
Association rulesAssociation rules
Association rules
 
Clustering
ClusteringClustering
Clustering
 
Classification
ClassificationClassification
Classification
 
Blue property assumptions.
Blue property assumptions.Blue property assumptions.
Blue property assumptions.
 
Introduction to regression
Introduction to regressionIntroduction to regression
Introduction to regression
 
DART
DARTDART
DART
 
Mycin
MycinMycin
Mycin
 
Expert systems
Expert systemsExpert systems
Expert systems
 
Dempster shafer theory
Dempster shafer theoryDempster shafer theory
Dempster shafer theory
 
Bayes network
Bayes networkBayes network
Bayes network
 
Bayes' theorem
Bayes' theoremBayes' theorem
Bayes' theorem
 
Knowledge based agents
Knowledge based agentsKnowledge based agents
Knowledge based agents
 
Rule based system
Rule based systemRule based system
Rule based system
 
Formal Logic in AI
Formal Logic in AIFormal Logic in AI
Formal Logic in AI
 
Production based system
Production based systemProduction based system
Production based system
 
Game playing in AI
Game playing in AIGame playing in AI
Game playing in AI
 
Diagnosis test of diabetics and hypertension by AI
Diagnosis test of diabetics and hypertension by AIDiagnosis test of diabetics and hypertension by AI
Diagnosis test of diabetics and hypertension by AI
 
A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”
 
A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”
 

Dernier

Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
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
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
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
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Dernier (20)

Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
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
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
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...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

A* Algorithm

  • 1. A* Algorithm Dr. C.V. Suresh Babu (CentreforKnowledgeTransfer) institute
  • 2. Topics for Discussion  What is A-Star (A*) Algorithm in Artificial Intelligence?  A* Algorithm Steps  Why is A* Search Algorithm Preferred?  A* and Its Basic Concepts  What is a Heuristic Function?  Admissibility of the Heuristic Function  Consistency of the Heuristic Function (CentreforKnowledgeTransfer) institute
  • 3. Introduction  AI helps us solve problems of various complexities.  Computational problems like path search problems can be solved using AI. Search problems, where you need to find a path from one point to another, say, point A to point B.  Sometimes you need to solve it by mapping those problems to graphs, where all the possible outcomes are represented by nodes. A* algorithm comes up as an answer to these problems. (CentreforKnowledgeTransfer) institute
  • 4.  Created as part of the Shakey project aimed to build a mobile robot that has artificial intelligence to plan its actions, A* was initially designed as a general graph traversal algorithm.  It is widely used in solving pathfinding problems in video games. Because of its flexibility and versatility, it can be used in a wide range of contexts.  A* is formulated with weighted graphs, which means it can find the best path involving the smallest cost in terms of distance and time.  This makes A* algorithm in artificial intelligence an informed search algorithm for best-first search.  Let us have a detailed look into the various aspects of A*. (CentreforKnowledgeTransfer) institute
  • 5. What is A* Algorithm in Artificial Intelligence?  The most important advantage of A* search algorithm which separates it from other traversal techniques is that it has a brain.  This makes A* very smart and pushes it much ahead of other conventional algorithms. (CentreforKnowledgeTransfer) institute
  • 6.  Let’s try to understand Basic AI Concepts and to comprehend how does A* algorithm work.  Imagine a huge maze, one that is too big that it takes hours to reach the endpoint manually.  Once you complete it on foot, you need to go for another one.  Which implies that you would end up investing a lot of time and effort to find the possible paths in this maze.  Now, you want to make it less time-consuming.  To make it easier, we will consider this maze as a search problem and will try to apply it to other possible mazes we might encounter in the due course, provided they follow the same structure and rules. (CentreforKnowledgeTransfer) institute
  • 7. Converting Maze into a search problem As the first step to convert this maze into a search problem, we need to define these six things. 1. A set of prospective states we might be in 2. A beginning and end state 3. A way to decide if we’ve reached the endpoint 4. A set of actions in case of possible direction/path changes 5. A function that advises us about the result of an action 6. A set of costs incurring in different states/paths of movement (CentreforKnowledgeTransfer) institute
  • 8.  To solve the problem, we need to map the intersections to the nodes (denoted by the red dots) and all the possible ways we can make movements towards the edges (denoted by the blue lines).  A denotes the starting point and B denotes the endpoint. We define the starting and endpoint at the nodes A and B respectively.  If we use an uninformed search algorithm, it would be like finding a path that is blind, while an informed algorithm for a search problem would take the path that brings you closer to your destination. For instance, consider Rubik’s cube; it has many prospective states that you can be in and this makes the solution very difficult. This calls for the use of a guided search algorithm to find a solution. This explains the importance of A*. (CentreforKnowledgeTransfer) institute
  • 9. Why A*?  Unlike other algorithms, A* decides to take up a step only if it is convincingly sensible and reasonable as per its functions.  Which means, it never considers any non-optimal steps.  This is why A* is a popular choice for AI systems that replicate the real world – like video games and machine learning. (CentreforKnowledgeTransfer) institute
  • 10. A* Algorithm Steps  Firstly, add the beginning node to the open list  Then repeat the following step  – In the open list, find the square with the lowest F cost – and this denotes the current square. – Now we move to the closed square. – Consider 8 squares adjacent to the current square and  Ignore it if it is on the closed list, or if it is not workable. Do the following if it is workable  Check if it is on the open list; if not, add it. You need to make the current square as this square’s a parent. You will now record the different costs of the square like the F, G and H costs.  If it is on the open list, use G cost to measure the better path. Lower the G cost, the better the path. If this path is better, make the current square as the parent square. Now you need to recalculate the other scores – the G and F scores of this square.  – You’ll stop:  If you find the path, you need to check the closed list and add the target square to it.  There is no path if the open list is empty and you could not find the target square.  3. Now you can save the path and work backwards starting from the target square, going to the parent square from each square you go, till it takes you to the starting square. You’ve found your path now. (CentreforKnowledgeTransfer) institute
  • 11. Why is A* Search Algorithm Preferred?  The task is to take the unit you see at the bottom of the diagram, to the top of it. You can see that there is nothing to indicate that the object should not take the path denoted with pink lines.  So it chooses to move that way. As and when it reaches the top it has to change its direction because of the ‘U’ shaped obstacle.  Then it changes the direction, goes around the obstacle, to reach the top. In contrast to this, A* would have scanned the area above the object and found a short path (denoted with blue lines).  Thus, pathfinder algorithms like A* help you plan things rather than waiting until you discover the problem.  They act proactively rather than reacting to a situation.  The disadvantage is that it is a bit slower than the other algorithms.  You can use a combination of both to achieve better results – pathfinding algorithms give bigger picture and long paths with obstacles that change slowly; and movement algorithms for local picture and short paths with obstacles that change faster. It’s easy to give movement to objects. But pathfinding is not simple. It is a complex exercise. The following situation explains it. (CentreforKnowledgeTransfer) institute
  • 12. A* Algorithm and Its Basic Concepts  A* algorithm works based on heuristic methods and this helps achieve optimality.  A* is a different form of the best-first algorithm.  Optimality empowers an algorithm to find the best possible solution to a problem.  Such algorithms also offer completeness, if there is any solution possible to an existing problem, the algorithm will definitely find it. When A* enters into a problem, firstly it calculates the cost to travel to the neighbouring nodes and chooses the node with the lowest cost.  If The f(n) denotes the cost, A* chooses the node with the lowest f(n) value.  Here ‘n’ denotes the neighbouring nodes. The calculation of the value can be done as shown below: f(n)=g(n)+h(n)f(n)=g(n)+h(n) g(n) = shows the shortest path’s value from the starting node to node n h(n) = The heuristic approximation of the value of the node  The heuristic value has an important role in the efficiency of the A* algorithm.  To find the best solution, you might have to use different heuristic function according to the type of the problem.  However, the creation of these functions is a difficult task, and this is the basic problem we face in AI. (CentreforKnowledgeTransfer) institute
  • 13. What is a Heuristic Function?  A heuristic as it is simply called, a heuristic function that helps rank the alternatives given in a search algorithm at each of its steps.  It can either produce a result on its own or work in conjugation with a given algorithm to create a result.  Essentially, a heuristic function helps algorithms to make the best decision faster and more efficiently.  This ranking is made based on the best available information and helps the algorithm to decide on the best possible branch to follow.  Admissibility and consistency are the two fundamental properties of a heuristic function. (CentreforKnowledgeTransfer) institute
  • 14. Admissibility of the Heuristic Function  A heuristic function is admissible if it could effectively estimate the real distance between a node ‘n’ and the end node.  It never overestimates and if it ever does, it will be denoted by ‘d’, which also denotes the accuracy of the solution. (CentreforKnowledgeTransfer) institute
  • 15. Consistency of the Heuristic Function  A heuristic function is consistent if the estimate of a given heuristic function turns out to be equal to, or less than the distance between the goal (n) and a neighbour, and the cost calculated to reach that neighbour.  A* is indeed a very powerful algorithm used to increase the performance of artificial intelligence. It is one of the most popular search algorithms in AI.  Sky is the limit when it comes to the potential of this algorithm. However, the efficiency of an A* algorithm highly depends on the quality of its heuristic function.  Wonder why this algorithm is preferred and used in many software systems?  There is no single facet of AI where A*algorithm has not found its application. From search optimization to games, robotics and machine learning, A* algorithm is an inevitable part of a smart program. (CentreforKnowledgeTransfer) institute