SlideShare a Scribd company logo
1 of 45
SEARCHING FOR SOLUTIONS
Main reference:
Chapters 3 of Russell, S., & Norvig, P. (2016). Artificial intelligence: a modern approach.
Two main steps of search algorithms
1. CHOOSE A NODE
2. EXPANDING THE NODE
Repeat these 2 steps until
BẾN TRE
AN GIANG
CẦN THƠ
BẾN TRE
AN GIANG
BẾN
TRE
Initial state
Expanding BẾN TRE
BẾN
TRE
CẦN
THƠ
TP HCM
AN
GIANG
BẾN
TRE
CẦN
THƠ
TP HCM
AN
GIANG
KIÊN
GIANG
TP HCM
TÂY
NINH
Expanding AN GIANG
BẾN
TRE
Source: (Russell, 2016)
Conceptual algorithm #1 - TREE SEARCH
BẾN
TRE
CẦN
THƠ
TP HCM
AN
GIANG
KIÊN
GIANG
TP HCM
TÂY
NINH
Expanding AN GIANG
BẾN
TRE
BẾN
TRE
CẦN
THƠ
TP HCM
AN
GIANG
KIÊN
GIANG
TP HCM
TÂY
NINH
Issue: Repeated states
BẾN
TRE
Conceptual algorithm #2 - GRAPH SEARCH
Source: (Russell, 2016)
Developing search algorithms
(from the above conceptual designs)
Two types of search algorithms
Uninformed search:
Informed search:
Uninformed search algorithms
Breadth-first search
A simple strategy in which
 the root node is expanded first,
 then all the successors of the root node are expanded next,
 then their successors, and so on.
Breadth-first search algorithm
Source: (Russell, 2016)
Components of a node
For each node n:
n.STATE:
n.PARENT:
n.ACTION:
n.PATH-COST:
CHILD-NODE(problem, parent, action)
Queues
Operations on a queue:
EMPTY?(queue):
POP(queue):
INSERT(element, queue):
Three common variants of queues
FIFO queue (first-in, first-out):
LIFO queue (last-in, first-out, aka a stack):
Priority queue:
Breadth-first search (BFS) algorithm
Source: (Russell, 2016)
BFS demo
Source: (Russell, 2016)
Animation demo (8-puzzle problem)
http://tristanpenman.com/demos/n-puzzle/
BFS can find an optimal solution if the path cost is a nondecreasing function of the depth
Example
BẾN TRE – TP. HCM – VŨNG TÀU – PHAN THIẾT
BẾN TRE – TP. HCM – PHAN THIẾT
BẾN TRE
Example of path cost is NOT a nondecreasing function of the depth
Measuring algorithm's performance
Completeness:
Optimality:
Complexity:
See section 3.3.2 of (Russell, 2016) for more details.
Source: (Russell, 2016)
Uniform-cost search algorithm
Source: (Russell, 2016)
Example of path cost is NOT a nondecreasing function of the depth
Depth-first search (DFS)
Expands the deepest node in the frontier.
DFS demo
Source: (Russell, 2016)
Animation demo (8-puzzle problem)
http://tristanpenman.com/demos/n-puzzle/
DFS versus BFS
BFS is optimal (with condition). DFS is nonoptimal.
DFS is better than BFS in space complexity,
For example,
Memory used by BFS and DFS (GRAPH-SEARCH version)
Memory used by BFS and DFS (GRAPH-SEARCH version)
Memory used by BFS and DFS (TREE-SEARCH version)
DFS fails when encountering an infinite non-goal path
Depth-limited search
Stop expanding at a predetermined depth limit.
For example,
Depth-limited search (TREE-SEARCH version)
Source: Fig. 3.17 of (Russell, 2016)
Depth-limited search requires a predetermined depth limit.
Issue of depth-limited search
Iterative deepening search
Iterative deepening combines the benefits of depth-first and
breadth-first search:
 Like depth-first search:
 Like breadth-first search:
See section 3.4.5 of (Russell, 2016) for more details.
Comparing uninformed search strategies
Source: section 3.4.5 of (Russell, 2016)

More Related Content

More from Nguyễn Tiến (20)

AIw13_slide.pptx
AIw13_slide.pptxAIw13_slide.pptx
AIw13_slide.pptx
 
AIw12_Cross entropy.pptx
AIw12_Cross entropy.pptxAIw12_Cross entropy.pptx
AIw12_Cross entropy.pptx
 
AIw11_Exercises.pptx
AIw11_Exercises.pptxAIw11_Exercises.pptx
AIw11_Exercises.pptx
 
AIw11_slide.pptx
AIw11_slide.pptxAIw11_slide.pptx
AIw11_slide.pptx
 
AIw10_Exercises.pptx
AIw10_Exercises.pptxAIw10_Exercises.pptx
AIw10_Exercises.pptx
 
AIw10_Backtracking.pptx
AIw10_Backtracking.pptxAIw10_Backtracking.pptx
AIw10_Backtracking.pptx
 
AIw09_Exercises.pptx
AIw09_Exercises.pptxAIw09_Exercises.pptx
AIw09_Exercises.pptx
 
AIw09.pptx
AIw09.pptxAIw09.pptx
AIw09.pptx
 
AIw08_Exercises.pptx
AIw08_Exercises.pptxAIw08_Exercises.pptx
AIw08_Exercises.pptx
 
AIw08.pptx
AIw08.pptxAIw08.pptx
AIw08.pptx
 
AIw07 Exercises.pptx
AIw07 Exercises.pptxAIw07 Exercises.pptx
AIw07 Exercises.pptx
 
AIw07.pptx
AIw07.pptxAIw07.pptx
AIw07.pptx
 
AIw06_Exercises.pptx
AIw06_Exercises.pptxAIw06_Exercises.pptx
AIw06_Exercises.pptx
 
AIw05_Exercises.pptx
AIw05_Exercises.pptxAIw05_Exercises.pptx
AIw05_Exercises.pptx
 
AIw04_Exercises.pptx
AIw04_Exercises.pptxAIw04_Exercises.pptx
AIw04_Exercises.pptx
 
AIw04_slide.pptx
AIw04_slide.pptxAIw04_slide.pptx
AIw04_slide.pptx
 
AIw03.pptx
AIw03.pptxAIw03.pptx
AIw03.pptx
 
AI02_exercises.pptx
AI02_exercises.pptxAI02_exercises.pptx
AI02_exercises.pptx
 
AI02_Python (cont.).pptx
AI02_Python (cont.).pptxAI02_Python (cont.).pptx
AI02_Python (cont.).pptx
 
AI01_exercises.pptx
AI01_exercises.pptxAI01_exercises.pptx
AI01_exercises.pptx
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MysoreMuleSoftMeetup
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
cupulin
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 

Recently uploaded (20)

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 

AIw05.pptx

Editor's Notes

  1. Why adding ()? See: https://ai.stackexchange.com/questions/17904/understanding-the-pseudocode-of-uniform-cost-search-from-the-book-artificial-in