SlideShare a Scribd company logo
1 of 15
AI3391 ARTIFICAL INTELLIGENCE
(II YEAR (III Sem))
Department of Artificial Intelligence and Data
Science
Session 9
by
Asst.Prof.M.Gokilavani
NIET
11/14/2023 Department of AI & DS 1
TEXTBOOK:
• Artificial Intelligence A modern Approach, Third
Edition, Stuart Russell and Peter Norvig, Pearson
Education.
REFERENCES:
• Artificial Intelligence, 3rd Edn, E. Rich and K.Knight
(TMH).
• Artificial Intelligence, 3rd Edn, Patrick Henny
Winston, Pearson Education.
• Artificial Intelligence, Shivani Goel, Pearson
Education.
• Artificial Intelligence and Expert Systems- Patterson,
Pearson Education.
11/14/2023 Department of CSE (AI/ML) 2
Topics covered in session 9
11/14/2023 Department of AI & DS 3
Unit II: Problem Solving
• Heuristic search Strategies
• Heuristic function
• Local search and optimization problems
• Local search in continuous space
• Search with non deterministic actions
• Search in partial observation environments
• Online search agents and unknown environment
Informed search algorithm
• Informed search algorithm contains an array of knowledge
such as how far we are from the goal, path cost, how to reach
to goal node, etc. This knowledge help agents to explore less
to the search space and find more efficiently the goal node.
Example Tree: node with information (weight )
11/14/2023 4
Department of CSE (AI/ML)
Heuristics function
• The informed search algorithm is more useful for large
search space. Informed search algorithm uses the idea of
heuristic, so it is also called Heuristic search.
• Heuristics function: Heuristic is a function which is used
in Informed Search, and it finds the most promising path.
• It takes the current state of the agent as its input and
produces the estimation of how close agent is from the
goal.
• The heuristic method, however, might not always give the
best solution, but it guaranteed to find a good solution in
reasonable time. Heuristic function estimates how close a
state is to the goal.
11/14/2023 5
Department of CSE (AI/ML)
Heuristics function
• It is represented by h(n), and it calculates the cost of
an optimal path between the pair of states. The value
of the heuristic function is always positive.
Where,
h(n) <= h*(n)
Here h(n) is heuristic cost,
h*(n) is the estimated cost.
Hence heuristic cost should be less than or equal to
the estimated cost.
11/14/2023 Department of CSE (AI/ML) 6
Types of informed search algorithm
In the informed search we will discuss two main
algorithms which are given below:
• Best First Search Algorithm(Greedy search)
• A* Search Algorithm
11/14/2023 Department of CSE (AI/ML) 7
What is Best First Search?
• BFS uses the concept of a Priority queue and heuristic search.
To search the graph space, the BFS method uses two lists for
tracking the traversal.
• An ‘Open’ list that keeps track of the current ‘immediate’
nodes available for traversal and a ‘CLOSED’ list that keeps
track of the nodes already traversed.
• In the best first search algorithm, we expand the node which
is closest to the goal node and the closest cost is estimated
by heuristic function,
• Where,
f(n)= g(n)
G(n) path distance
11/14/2023 8
Department of CSE (AI/ML)
Algorithm
1. Create 2 empty lists: OPEN and CLOSED
2. Start from the initial node (say N) and put it in the ‘ordered’ OPEN
list
3. Repeat the next steps until the GOAL node is reached
1. If the OPEN list is empty, then EXIT the loop returning ‘False’
2. Select the first/top node (say N) in the OPEN list and move it
to the CLOSED list. Also, capture the information of the
parent node
3. If N is a GOAL node, then move the node to the Closed list
and exit the loop returning ‘True’. The solution can be found
by backtracking the path
4. If N is not the GOAL node, expand node N to generate the
‘immediate’ next nodes linked to node N and add all those to
the OPEN list
5. Reorder the nodes in the OPEN list in ascending order
according to an evaluation function f(n).
11/14/2023 9
Department of CSE (AI/ML)
Best First Search Example
11/14/2023 Department of CSE (AI/ML) 10
Expand the nodes of S and put in the CLOSED
list
• Initialization: Open [A, B], Closed [S]
• Iteration 1: Open [A], Closed [S, B]
• Iteration 2: Open [E, F, A], Closed [S, B]
: Open [E, A], Closed [S, B, F]
• Iteration 3: Open [I, G, E, A], Closed [S, B, F]
: Open [I, E, A], Closed [S, B, F, G]
• Hence the final solution path will be:
S----> B----->F----> G
11/14/2023 Department of CSE (AI/ML) 11
Example 2
11/14/2023 Department of CSE (AI/ML) 12
Example 3
11/14/2023 Department of CSE (AI/ML) 13
• Advantages:
– Best first search can switch between BFS and DFS
by gaining the advantages of both the algorithms.
– This algorithm is more efficient than BFS and DFS
algorithms.
• Disadvantages:
– It can behave as an unguided depth-first search in
the worst case scenario.
– It can get stuck in a loop as DFS.
– This algorithm is not optimal.
11/14/2023 Department of CSE (AI/ML) 14
Topics to be covered in next session 10
• A* Search Algorithm
11/14/2023 Department of CSE (AI/ML) 15
Thank you!!!

More Related Content

Similar to AI3391 Session 9 Greedy Best first search algorithm.pptx

AI unit-2 lecture notes.docx
AI unit-2 lecture notes.docxAI unit-2 lecture notes.docx
AI unit-2 lecture notes.docx
CS50Bootcamp
 
PowerPoint - K-State Laboratory for Knowledge Discovery in ...
PowerPoint - K-State Laboratory for Knowledge Discovery in ...PowerPoint - K-State Laboratory for Knowledge Discovery in ...
PowerPoint - K-State Laboratory for Knowledge Discovery in ...
butest
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptx
Swagat Praharaj
 
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
PalGov
 
Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)
SURBHI SAROHA
 

Similar to AI3391 Session 9 Greedy Best first search algorithm.pptx (20)

AI3391 ARTIFICIAL INTELLIGENCE Session 6 Search algorithm.pptx
AI3391 ARTIFICIAL INTELLIGENCE Session 6 Search algorithm.pptxAI3391 ARTIFICIAL INTELLIGENCE Session 6 Search algorithm.pptx
AI3391 ARTIFICIAL INTELLIGENCE Session 6 Search algorithm.pptx
 
AI3391 Session 12 Local search in continious space.pptx
AI3391 Session 12 Local search in continious space.pptxAI3391 Session 12 Local search in continious space.pptx
AI3391 Session 12 Local search in continious space.pptx
 
AI_Session 4 Uniformed search strategies.pptx
AI_Session 4 Uniformed search strategies.pptxAI_Session 4 Uniformed search strategies.pptx
AI_Session 4 Uniformed search strategies.pptx
 
09_Informed_Search.ppt
09_Informed_Search.ppt09_Informed_Search.ppt
09_Informed_Search.ppt
 
AI unit-2 lecture notes.docx
AI unit-2 lecture notes.docxAI unit-2 lecture notes.docx
AI unit-2 lecture notes.docx
 
AI_Session 26 Algorithm for state space.pptx
AI_Session 26 Algorithm for state space.pptxAI_Session 26 Algorithm for state space.pptx
AI_Session 26 Algorithm for state space.pptx
 
CSA 2001 (Module-2).pptx
CSA 2001 (Module-2).pptxCSA 2001 (Module-2).pptx
CSA 2001 (Module-2).pptx
 
AI_Session 11: searching with Non-Deterministic Actions and partial observati...
AI_Session 11: searching with Non-Deterministic Actions and partial observati...AI_Session 11: searching with Non-Deterministic Actions and partial observati...
AI_Session 11: searching with Non-Deterministic Actions and partial observati...
 
Unit1_AI&ML_leftover (2).pptx
Unit1_AI&ML_leftover (2).pptxUnit1_AI&ML_leftover (2).pptx
Unit1_AI&ML_leftover (2).pptx
 
Searching and Sorting Algorithms
Searching and Sorting AlgorithmsSearching and Sorting Algorithms
Searching and Sorting Algorithms
 
PowerPoint - K-State Laboratory for Knowledge Discovery in ...
PowerPoint - K-State Laboratory for Knowledge Discovery in ...PowerPoint - K-State Laboratory for Knowledge Discovery in ...
PowerPoint - K-State Laboratory for Knowledge Discovery in ...
 
AI3391 ARTIFICAL INTELLIGENCE Session 5 Problem Solving Agent and searching f...
AI3391 ARTIFICAL INTELLIGENCE Session 5 Problem Solving Agent and searching f...AI3391 ARTIFICAL INTELLIGENCE Session 5 Problem Solving Agent and searching f...
AI3391 ARTIFICAL INTELLIGENCE Session 5 Problem Solving Agent and searching f...
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptx
 
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
 
AI_Session 6 Iterative deepening Depth-first and bidirectional search.pptx
AI_Session 6 Iterative deepening Depth-first and bidirectional search.pptxAI_Session 6 Iterative deepening Depth-first and bidirectional search.pptx
AI_Session 6 Iterative deepening Depth-first and bidirectional search.pptx
 
Artificial Intelligence_Searching.pptx
Artificial Intelligence_Searching.pptxArtificial Intelligence_Searching.pptx
Artificial Intelligence_Searching.pptx
 
AI3391 Session 13 searching with Non-Deterministic Actions and partial observ...
AI3391 Session 13 searching with Non-Deterministic Actions and partial observ...AI3391 Session 13 searching with Non-Deterministic Actions and partial observ...
AI3391 Session 13 searching with Non-Deterministic Actions and partial observ...
 
AI Lesson 04
AI Lesson 04AI Lesson 04
AI Lesson 04
 
Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)
 
Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Science
 

More from Asst.prof M.Gokilavani

More from Asst.prof M.Gokilavani (20)

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
IT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdfIT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdf
 
IT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notesIT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notes
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
 
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfGE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
 
GE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdfGE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdf
 
GE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdfGE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdf
 
GE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _NotesGE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _Notes
 
GE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_NotesGE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_Notes
 
GE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_NotesGE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_Notes
 
GE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_NotesGE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_Notes
 
GE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_NotesGE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_Notes
 
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
 
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdfAI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
 
AI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptxAI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptx
 
AI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptxAI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptx
 
AI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptxAI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptx
 

Recently uploaded

Query optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsQuery optimization and processing for advanced database systems
Query optimization and processing for advanced database systems
meharikiros2
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
hublikarsn
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
jaanualu31
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 

Recently uploaded (20)

Query optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsQuery optimization and processing for advanced database systems
Query optimization and processing for advanced database systems
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata Model
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 

AI3391 Session 9 Greedy Best first search algorithm.pptx

  • 1. AI3391 ARTIFICAL INTELLIGENCE (II YEAR (III Sem)) Department of Artificial Intelligence and Data Science Session 9 by Asst.Prof.M.Gokilavani NIET 11/14/2023 Department of AI & DS 1
  • 2. TEXTBOOK: • Artificial Intelligence A modern Approach, Third Edition, Stuart Russell and Peter Norvig, Pearson Education. REFERENCES: • Artificial Intelligence, 3rd Edn, E. Rich and K.Knight (TMH). • Artificial Intelligence, 3rd Edn, Patrick Henny Winston, Pearson Education. • Artificial Intelligence, Shivani Goel, Pearson Education. • Artificial Intelligence and Expert Systems- Patterson, Pearson Education. 11/14/2023 Department of CSE (AI/ML) 2
  • 3. Topics covered in session 9 11/14/2023 Department of AI & DS 3 Unit II: Problem Solving • Heuristic search Strategies • Heuristic function • Local search and optimization problems • Local search in continuous space • Search with non deterministic actions • Search in partial observation environments • Online search agents and unknown environment
  • 4. Informed search algorithm • Informed search algorithm contains an array of knowledge such as how far we are from the goal, path cost, how to reach to goal node, etc. This knowledge help agents to explore less to the search space and find more efficiently the goal node. Example Tree: node with information (weight ) 11/14/2023 4 Department of CSE (AI/ML)
  • 5. Heuristics function • The informed search algorithm is more useful for large search space. Informed search algorithm uses the idea of heuristic, so it is also called Heuristic search. • Heuristics function: Heuristic is a function which is used in Informed Search, and it finds the most promising path. • It takes the current state of the agent as its input and produces the estimation of how close agent is from the goal. • The heuristic method, however, might not always give the best solution, but it guaranteed to find a good solution in reasonable time. Heuristic function estimates how close a state is to the goal. 11/14/2023 5 Department of CSE (AI/ML)
  • 6. Heuristics function • It is represented by h(n), and it calculates the cost of an optimal path between the pair of states. The value of the heuristic function is always positive. Where, h(n) <= h*(n) Here h(n) is heuristic cost, h*(n) is the estimated cost. Hence heuristic cost should be less than or equal to the estimated cost. 11/14/2023 Department of CSE (AI/ML) 6
  • 7. Types of informed search algorithm In the informed search we will discuss two main algorithms which are given below: • Best First Search Algorithm(Greedy search) • A* Search Algorithm 11/14/2023 Department of CSE (AI/ML) 7
  • 8. What is Best First Search? • BFS uses the concept of a Priority queue and heuristic search. To search the graph space, the BFS method uses two lists for tracking the traversal. • An ‘Open’ list that keeps track of the current ‘immediate’ nodes available for traversal and a ‘CLOSED’ list that keeps track of the nodes already traversed. • In the best first search algorithm, we expand the node which is closest to the goal node and the closest cost is estimated by heuristic function, • Where, f(n)= g(n) G(n) path distance 11/14/2023 8 Department of CSE (AI/ML)
  • 9. Algorithm 1. Create 2 empty lists: OPEN and CLOSED 2. Start from the initial node (say N) and put it in the ‘ordered’ OPEN list 3. Repeat the next steps until the GOAL node is reached 1. If the OPEN list is empty, then EXIT the loop returning ‘False’ 2. Select the first/top node (say N) in the OPEN list and move it to the CLOSED list. Also, capture the information of the parent node 3. If N is a GOAL node, then move the node to the Closed list and exit the loop returning ‘True’. The solution can be found by backtracking the path 4. If N is not the GOAL node, expand node N to generate the ‘immediate’ next nodes linked to node N and add all those to the OPEN list 5. Reorder the nodes in the OPEN list in ascending order according to an evaluation function f(n). 11/14/2023 9 Department of CSE (AI/ML)
  • 10. Best First Search Example 11/14/2023 Department of CSE (AI/ML) 10
  • 11. Expand the nodes of S and put in the CLOSED list • Initialization: Open [A, B], Closed [S] • Iteration 1: Open [A], Closed [S, B] • Iteration 2: Open [E, F, A], Closed [S, B] : Open [E, A], Closed [S, B, F] • Iteration 3: Open [I, G, E, A], Closed [S, B, F] : Open [I, E, A], Closed [S, B, F, G] • Hence the final solution path will be: S----> B----->F----> G 11/14/2023 Department of CSE (AI/ML) 11
  • 12. Example 2 11/14/2023 Department of CSE (AI/ML) 12
  • 13. Example 3 11/14/2023 Department of CSE (AI/ML) 13
  • 14. • Advantages: – Best first search can switch between BFS and DFS by gaining the advantages of both the algorithms. – This algorithm is more efficient than BFS and DFS algorithms. • Disadvantages: – It can behave as an unguided depth-first search in the worst case scenario. – It can get stuck in a loop as DFS. – This algorithm is not optimal. 11/14/2023 Department of CSE (AI/ML) 14
  • 15. Topics to be covered in next session 10 • A* Search Algorithm 11/14/2023 Department of CSE (AI/ML) 15 Thank you!!!