SlideShare a Scribd company logo
CS 767: Advanced Topics in AI
Search
Instructor: Dr. Muhammad Aqib
University Institute of Information Technology
PMAS-Arid Agriculture University Rawalpindi
(slides courtesy Dan Klein, Pieter Abbeel, University of California, Berkeley)
Today
o Agents that Plan Ahead
o Search Problems
o Uninformed Search Methods
o Depth-First Search
o Breadth-First Search
o Uniform-Cost Search
Agents that Plan
o Simple reflex agents
o Model-based reflex agents
o Goal-based agents
o Utility based agents
Reflex Agents
[Demo: reflex optimal (L2D1)]
[Demo: reflex optimal (L2D2)]
Reflex Agents
o Reflex agents:
o Choose action based on current percept (and
maybe memory)
o May have memory or a model of the world’s
current state
o Do not consider the future consequences of their
actions
o Consider how the world IS
o Can a reflex agent be rational?
[Demo: reflex optimal (L2D1)]
[Demo: reflex optimal (L2D2)]
Planning Agents
o Planning agents:
o Ask “what if”
o Decisions based on (hypothesized) consequences
of actions
o Must have a model of how the world evolves in
response to actions
o Must formulate a goal (test)
o Consider how the world WOULD BE
[Demo: re-planning (L2D3)]
[Demo: mastermind (L2D4)]
Search Problems
Search Problems
Search Problems
o A search problem consists of:
o A state space
o A successor function
(with actions, costs)
o A start state and a goal test
o A solution is a sequence of actions (a plan) which
transforms the start state to a goal state
“N”, 1.0
“E”, 1.0
Example: Traveling in Romania
o State space:
o Cities
o Successor function:
o Roads: Go to adjacent city with
cost = distance
o Start state:
o Arad
o Goal test:
o Is state == Bucharest?
o Solution?
What’s in a State Space?
o Problem: Pathing
o States: (x,y) location
o Actions: NSEW
o Successor: update location
only
o Goal test: is (x,y)=END
o Problem: Eat-All-Dots
o States: {(x,y), dot booleans}
o Actions: NSEW
o Successor: update location
and possibly a dot boolean
o Goal test: dots all false
The world state includes every last detail of the environment
A search state keeps only the details needed for planning (abstraction)
State Space Sizes?
o World state:
o Agent positions: 120
o Food count: 30
o Ghost positions: 12
o Agent facing: NSEW
o How many
oWorld states?
120x(230)x(122)x4
oStates for pathing?
120
oStates for eat-all-dots?
120x(230)
Safe Passage
o Problem: eat all dots while keeping the ghosts perma-scared
o What does the state space have to specify?
o (agent position, dot booleans, power pellet booleans, remaining scared time)
State Space Graphs and Search Trees
State Space Graphs
o State space graph: A mathematical
representation of a search problem
o Nodes are (abstracted) world configurations
o Arcs represent successors (action results)
o The goal test is a set of goal nodes (maybe only one)
o In a state space graph, each state occurs only
once!
o We can rarely build this full graph in memory
(it’s too big), but it’s a useful idea
State Space Graphs
o State space graph: A mathematical
representation of a search problem
o Nodes are (abstracted) world configurations
o Arcs represent successors (action results)
o The goal test is a set of goal nodes (maybe only one)
o In a search graph, each state occurs only once!
o We can rarely build this full graph in memory
(it’s too big), but it’s a useful idea
S
G
d
b
p
q
c
e
h
a
f
r
Tiny search graph for a tiny
search problem
Search Trees
o A search tree:
o A “what if” tree of plans and their outcomes
o The start state is the root node
o Children correspond to successors
o Nodes show states, but correspond to PLANS that achieve those states
o For most problems, we can never actually build the whole tree
“E”, 1.0
“N”, 1.0
This is now / start
Possible futures
State Space Graphs vs. Search Trees
a
b
d p
a
c
e
h r
p q f
q G
c
a
q
e
h r
p q f
q G
c
a
Search Tree
S
S
G
d
b
p q
c
e
h
a
f
r
We construct both
on demand – and
we construct as
little as possible.
Each NODE in the
search tree is an
entire PATH in the
state space graph.
State Space Graph
State Space Graphs vs. Search Trees
S G
b
a
Consider this 4-state graph: How big is its search tree (from S)?
State Space Graphs vs. Search Trees
S G
b
a
Consider this 4-state graph:
… …
Important: Lots of repeated structure in the search tree!
How big is its search tree (from S)?
s
a b
b G a G
a G b G
Tree Search
Search Example: Romania
Searching with a Search Tree
o Search:
o Expand out potential plans (tree nodes)
o Maintain a fringe of partial plans under consideration
o Try to expand as few tree nodes as possible
General Tree Search
o Important ideas:
o Fringe
o Expansion
o Exploration strategy
o Main question: which fringe nodes to explore?
Example: Tree Search
S
G
d
b
p q
c
e
h
a
f
r
Example: Tree Search
a a p q f
q
h r
c
a
G
q
q
S
G
b
p q
c
h
a
f
d
e
r
S
d e p
e
h r
p q f
c
a
G
b c
s
s ? d
s ? e
s ? p
s ? d ? b
s ? d ? c
s ? d ? e
s ? d ? e ? h
s ? d ? e ? r
s ? d ? e ? r ? f
s ? d ? e ? r ? f ? c
s ? d ? e ? r ? f ? G
Depth-First Search
Depth-First Search
S
a
b
d p
a
c
e
h r
p q f
q G
c
a
q
e
h r
p q f
q G
c
a
S
G
q
p
h
f
d
b
a
c
e
r
Strategy: expand a
deepest node first
Implementation:
Fringe is a LIFO stack
Search Algorithm Properties
Search Algorithm Properties
o Complete: Guaranteed to find a solution if one exists?
o Optimal: Guaranteed to find the least cost path?
o Time complexity?
o Space complexity?
o Cartoon of search tree:
o b is the branching factor
o m is the maximum depth
o solutions at various depths
o Number of nodes in entire tree?
o 1 + b + b2 + …. bm = O(bm)
…
b
1 node
b nodes
b2 nodes
bm nodes
m tiers
Depth-First Search (DFS) Properties
o What nodes DFS expand?
o Some left prefix of the tree.
o Could process the whole tree!
o If m is finite, takes time O(bm)
o How much space does the fringe take?
o Only has siblings on path to root, so O(bm)
o Is it complete?
o m could be infinite, so only if we prevent cycles
(more later)
o Is it optimal?
o No, it finds the “leftmost” solution, regardless of
depth or cost
…
b
1 node
b nodes
b2 nodes
bm nodes
m tiers
Breadth-First Search
Breadth-First Search
S
a
b
d e p
a
c
p q f
h r
q c G
a
q
e
p q f
h r
q c G
a
S
G
d
b
p q
c
e
h
a
f
r
Search
Tiers
Strategy: expand a
shallowest node first
Implementation: Fringe
is a FIFO queue
Breadth-First Search (BFS) Properties
o What nodes does BFS expand?
o Processes all nodes above shallowest solution
o Let depth of shallowest solution be s
o Search takes time O(bs)
o How much space does the fringe take?
o Has roughly the last tier, so O(bs)
o Is it complete?
o s must be finite if a solution exists
o Is it optimal?
o Only if costs are all 1 (more on costs later)
…
b
1 node
b nodes
b2 nodes
bm nodes
s tiers
bs nodes
Thank
You

More Related Content

Similar to CS767_Lecture_02.pptx

Searching
SearchingSearching
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
 
State space search and Problem Solving techniques
State space search and Problem Solving techniquesState space search and Problem Solving techniques
State space search and Problem Solving techniques
Kirti Verma
 
Chapter3 Search
Chapter3 SearchChapter3 Search
Chapter3 Search
Khiem Ho
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
Jay Nagar
 
Search
SearchSearch
Search 1
Search 1Search 1
Hadoop in Data Warehousing
Hadoop in Data WarehousingHadoop in Data Warehousing
Hadoop in Data Warehousing
Alexey Grigorev
 
Using Topological Data Analysis on your BigData
Using Topological Data Analysis on your BigDataUsing Topological Data Analysis on your BigData
Using Topological Data Analysis on your BigData
AnalyticsWeek
 
AI Lesson 04
AI Lesson 04AI Lesson 04
AI Lesson 04
Assistant Professor
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
chandsek666
 
AI: AI & Problem Solving
AI: AI & Problem SolvingAI: AI & Problem Solving
AI: AI & Problem Solving
DataminingTools Inc
 
AI: AI & problem solving
AI: AI & problem solvingAI: AI & problem solving
AI: AI & problem solving
Datamining Tools
 
Music recommendations @ MLConf 2014
Music recommendations @ MLConf 2014Music recommendations @ MLConf 2014
Music recommendations @ MLConf 2014
Erik Bernhardsson
 
state-spaces29Sep06.ppt
state-spaces29Sep06.pptstate-spaces29Sep06.ppt
state-spaces29Sep06.ppt
PerumalPitchandi
 
03 search blind
03 search blind03 search blind
03 search blind
Nour Zeineddine
 
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptxPPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
RaviKiranVarma4
 
GDSC SSN - solution Challenge : Fundamentals of Decision Making
GDSC SSN - solution Challenge : Fundamentals of Decision MakingGDSC SSN - solution Challenge : Fundamentals of Decision Making
GDSC SSN - solution Challenge : Fundamentals of Decision Making
GDSCSSN
 
Popular search algorithms
Popular search algorithmsPopular search algorithms
Popular search algorithms
Minakshi Atre
 
1 blind search
1 blind search1 blind search
1 blind search
Rahel Amanda
 

Similar to CS767_Lecture_02.pptx (20)

Searching
SearchingSearching
Searching
 
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
 
State space search and Problem Solving techniques
State space search and Problem Solving techniquesState space search and Problem Solving techniques
State space search and Problem Solving techniques
 
Chapter3 Search
Chapter3 SearchChapter3 Search
Chapter3 Search
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
 
Search
SearchSearch
Search
 
Search 1
Search 1Search 1
Search 1
 
Hadoop in Data Warehousing
Hadoop in Data WarehousingHadoop in Data Warehousing
Hadoop in Data Warehousing
 
Using Topological Data Analysis on your BigData
Using Topological Data Analysis on your BigDataUsing Topological Data Analysis on your BigData
Using Topological Data Analysis on your BigData
 
AI Lesson 04
AI Lesson 04AI Lesson 04
AI Lesson 04
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
AI: AI & Problem Solving
AI: AI & Problem SolvingAI: AI & Problem Solving
AI: AI & Problem Solving
 
AI: AI & problem solving
AI: AI & problem solvingAI: AI & problem solving
AI: AI & problem solving
 
Music recommendations @ MLConf 2014
Music recommendations @ MLConf 2014Music recommendations @ MLConf 2014
Music recommendations @ MLConf 2014
 
state-spaces29Sep06.ppt
state-spaces29Sep06.pptstate-spaces29Sep06.ppt
state-spaces29Sep06.ppt
 
03 search blind
03 search blind03 search blind
03 search blind
 
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptxPPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
 
GDSC SSN - solution Challenge : Fundamentals of Decision Making
GDSC SSN - solution Challenge : Fundamentals of Decision MakingGDSC SSN - solution Challenge : Fundamentals of Decision Making
GDSC SSN - solution Challenge : Fundamentals of Decision Making
 
Popular search algorithms
Popular search algorithmsPopular search algorithms
Popular search algorithms
 
1 blind search
1 blind search1 blind search
1 blind search
 

More from ShujatHussainGadi

Decision Tree Assignment.pdf
Decision  Tree Assignment.pdfDecision  Tree Assignment.pdf
Decision Tree Assignment.pdf
ShujatHussainGadi
 
Marakas-Ch04-Saif Week 04.ppt
Marakas-Ch04-Saif Week 04.pptMarakas-Ch04-Saif Week 04.ppt
Marakas-Ch04-Saif Week 04.ppt
ShujatHussainGadi
 
Lec-01.ppt
Lec-01.pptLec-01.ppt
Lec-01.ppt
ShujatHussainGadi
 
GA.pptx
GA.pptxGA.pptx
CS767_Lecture_03.pptx
CS767_Lecture_03.pptxCS767_Lecture_03.pptx
CS767_Lecture_03.pptx
ShujatHussainGadi
 
CS767_Lecture_04.pptx
CS767_Lecture_04.pptxCS767_Lecture_04.pptx
CS767_Lecture_04.pptx
ShujatHussainGadi
 
CS767_Lecture_05.pptx
CS767_Lecture_05.pptxCS767_Lecture_05.pptx
CS767_Lecture_05.pptx
ShujatHussainGadi
 

More from ShujatHussainGadi (7)

Decision Tree Assignment.pdf
Decision  Tree Assignment.pdfDecision  Tree Assignment.pdf
Decision Tree Assignment.pdf
 
Marakas-Ch04-Saif Week 04.ppt
Marakas-Ch04-Saif Week 04.pptMarakas-Ch04-Saif Week 04.ppt
Marakas-Ch04-Saif Week 04.ppt
 
Lec-01.ppt
Lec-01.pptLec-01.ppt
Lec-01.ppt
 
GA.pptx
GA.pptxGA.pptx
GA.pptx
 
CS767_Lecture_03.pptx
CS767_Lecture_03.pptxCS767_Lecture_03.pptx
CS767_Lecture_03.pptx
 
CS767_Lecture_04.pptx
CS767_Lecture_04.pptxCS767_Lecture_04.pptx
CS767_Lecture_04.pptx
 
CS767_Lecture_05.pptx
CS767_Lecture_05.pptxCS767_Lecture_05.pptx
CS767_Lecture_05.pptx
 

Recently uploaded

REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
سمير بسيوني
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Vivekanand Anglo Vedic Academy
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 

Recently uploaded (20)

REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 

CS767_Lecture_02.pptx

  • 1. CS 767: Advanced Topics in AI Search Instructor: Dr. Muhammad Aqib University Institute of Information Technology PMAS-Arid Agriculture University Rawalpindi (slides courtesy Dan Klein, Pieter Abbeel, University of California, Berkeley)
  • 2. Today o Agents that Plan Ahead o Search Problems o Uninformed Search Methods o Depth-First Search o Breadth-First Search o Uniform-Cost Search
  • 3. Agents that Plan o Simple reflex agents o Model-based reflex agents o Goal-based agents o Utility based agents
  • 4. Reflex Agents [Demo: reflex optimal (L2D1)] [Demo: reflex optimal (L2D2)]
  • 5. Reflex Agents o Reflex agents: o Choose action based on current percept (and maybe memory) o May have memory or a model of the world’s current state o Do not consider the future consequences of their actions o Consider how the world IS o Can a reflex agent be rational? [Demo: reflex optimal (L2D1)] [Demo: reflex optimal (L2D2)]
  • 6. Planning Agents o Planning agents: o Ask “what if” o Decisions based on (hypothesized) consequences of actions o Must have a model of how the world evolves in response to actions o Must formulate a goal (test) o Consider how the world WOULD BE [Demo: re-planning (L2D3)] [Demo: mastermind (L2D4)]
  • 9. Search Problems o A search problem consists of: o A state space o A successor function (with actions, costs) o A start state and a goal test o A solution is a sequence of actions (a plan) which transforms the start state to a goal state “N”, 1.0 “E”, 1.0
  • 10. Example: Traveling in Romania o State space: o Cities o Successor function: o Roads: Go to adjacent city with cost = distance o Start state: o Arad o Goal test: o Is state == Bucharest? o Solution?
  • 11. What’s in a State Space? o Problem: Pathing o States: (x,y) location o Actions: NSEW o Successor: update location only o Goal test: is (x,y)=END o Problem: Eat-All-Dots o States: {(x,y), dot booleans} o Actions: NSEW o Successor: update location and possibly a dot boolean o Goal test: dots all false The world state includes every last detail of the environment A search state keeps only the details needed for planning (abstraction)
  • 12. State Space Sizes? o World state: o Agent positions: 120 o Food count: 30 o Ghost positions: 12 o Agent facing: NSEW o How many oWorld states? 120x(230)x(122)x4 oStates for pathing? 120 oStates for eat-all-dots? 120x(230)
  • 13. Safe Passage o Problem: eat all dots while keeping the ghosts perma-scared o What does the state space have to specify? o (agent position, dot booleans, power pellet booleans, remaining scared time)
  • 14. State Space Graphs and Search Trees
  • 15. State Space Graphs o State space graph: A mathematical representation of a search problem o Nodes are (abstracted) world configurations o Arcs represent successors (action results) o The goal test is a set of goal nodes (maybe only one) o In a state space graph, each state occurs only once! o We can rarely build this full graph in memory (it’s too big), but it’s a useful idea
  • 16. State Space Graphs o State space graph: A mathematical representation of a search problem o Nodes are (abstracted) world configurations o Arcs represent successors (action results) o The goal test is a set of goal nodes (maybe only one) o In a search graph, each state occurs only once! o We can rarely build this full graph in memory (it’s too big), but it’s a useful idea S G d b p q c e h a f r Tiny search graph for a tiny search problem
  • 17. Search Trees o A search tree: o A “what if” tree of plans and their outcomes o The start state is the root node o Children correspond to successors o Nodes show states, but correspond to PLANS that achieve those states o For most problems, we can never actually build the whole tree “E”, 1.0 “N”, 1.0 This is now / start Possible futures
  • 18. State Space Graphs vs. Search Trees a b d p a c e h r p q f q G c a q e h r p q f q G c a Search Tree S S G d b p q c e h a f r We construct both on demand – and we construct as little as possible. Each NODE in the search tree is an entire PATH in the state space graph. State Space Graph
  • 19. State Space Graphs vs. Search Trees S G b a Consider this 4-state graph: How big is its search tree (from S)?
  • 20. State Space Graphs vs. Search Trees S G b a Consider this 4-state graph: … … Important: Lots of repeated structure in the search tree! How big is its search tree (from S)? s a b b G a G a G b G
  • 23. Searching with a Search Tree o Search: o Expand out potential plans (tree nodes) o Maintain a fringe of partial plans under consideration o Try to expand as few tree nodes as possible
  • 24. General Tree Search o Important ideas: o Fringe o Expansion o Exploration strategy o Main question: which fringe nodes to explore?
  • 26. Example: Tree Search a a p q f q h r c a G q q S G b p q c h a f d e r S d e p e h r p q f c a G b c s s ? d s ? e s ? p s ? d ? b s ? d ? c s ? d ? e s ? d ? e ? h s ? d ? e ? r s ? d ? e ? r ? f s ? d ? e ? r ? f ? c s ? d ? e ? r ? f ? G
  • 28. Depth-First Search S a b d p a c e h r p q f q G c a q e h r p q f q G c a S G q p h f d b a c e r Strategy: expand a deepest node first Implementation: Fringe is a LIFO stack
  • 30. Search Algorithm Properties o Complete: Guaranteed to find a solution if one exists? o Optimal: Guaranteed to find the least cost path? o Time complexity? o Space complexity? o Cartoon of search tree: o b is the branching factor o m is the maximum depth o solutions at various depths o Number of nodes in entire tree? o 1 + b + b2 + …. bm = O(bm) … b 1 node b nodes b2 nodes bm nodes m tiers
  • 31. Depth-First Search (DFS) Properties o What nodes DFS expand? o Some left prefix of the tree. o Could process the whole tree! o If m is finite, takes time O(bm) o How much space does the fringe take? o Only has siblings on path to root, so O(bm) o Is it complete? o m could be infinite, so only if we prevent cycles (more later) o Is it optimal? o No, it finds the “leftmost” solution, regardless of depth or cost … b 1 node b nodes b2 nodes bm nodes m tiers
  • 33. Breadth-First Search S a b d e p a c p q f h r q c G a q e p q f h r q c G a S G d b p q c e h a f r Search Tiers Strategy: expand a shallowest node first Implementation: Fringe is a FIFO queue
  • 34. Breadth-First Search (BFS) Properties o What nodes does BFS expand? o Processes all nodes above shallowest solution o Let depth of shallowest solution be s o Search takes time O(bs) o How much space does the fringe take? o Has roughly the last tier, so O(bs) o Is it complete? o s must be finite if a solution exists o Is it optimal? o Only if costs are all 1 (more on costs later) … b 1 node b nodes b2 nodes bm nodes s tiers bs nodes