SlideShare a Scribd company logo
1 of 31
1
CS 2710, ISSP 2160
Foundations of Artificial
Intelligence
Solving Problems by Searching
Chapter 3 Part 1
• Problem solving by search
• Uninformed search strategies
• Chapter 3 through 3.4
2
Setup
• Perception/action cycle [board]
• Goal-based agent: find a sequence of actions to achieve a goal
– Search, then execute
• The methods in this chapter are appropriate for problems for
which the environment is observable, discrete,
determininistic.[which means?]
3
Giurgiu
Urziceni
Hirsova
Eforie
Neamt
Oradea
Zerind
Arad
Timisoara
Lugoj
Mehadia
Drobeta
Craiova
Sibiu Fagaras
Pitesti
Vaslui
Iasi
Rimnicu Vilcea
Bucharest
71
75
118
111
70
75
120
151
140
99
80
97
101
211
138
146 85
90
98
142
92
87
86
4
8-Puzzle
5
• []
6
Problem Solving
[A problem is formally defined by 4 components]
7
Example Problems
• Toy problems
– Illustrate/test various problem-solving methods
– Concise, exact description
– Can be used to compare performance
– Examples: 8-puzzle, 8-queens problem, Cryptarithmetic,
Vacuum world, Missionaries and cannibals, simple route
finding
• Real-world problem
– More difficult
– No single, agreed-upon specification (state, successor
function, edgecost)
– Examples: Route finding, VLSI layout, Robot navigation,
Assembly sequencing (read 3.2.2 about complexities)
8
Toy Problems
The vacuum world
• The vacuum world
– The world has only two
locations
– Each location may or
may not contain dirt
– The agent may be in one
location or the other
– 8 possible world states
– Three possible actions:
Left, Right, Suck
– Goal: clean up all the
dirt
1 2
4
3
5 6
7 8
9
Toy Problems
The vacuum world
– States: one of the 8 states given earlier
– Operators: move left, move right, suck
– Goal test: no dirt left in any square
– Path cost: each action costs one
S
R
L
S
S
S
R
R
R
L
L
L
10
Missionaries and cannibals
• Missionaries and cannibals
– Three missionaries and three
cannibals want to cross a river
– There is a boat that can hold two
people
– Cross the river, but make sure that
the missionaries are not
outnumbered by the cannibals on
either bank
• Lots of abstraction
– Crocodiles in the river, the weather
and so on
– Only the endpoints of the crossing
are important, etc.
11
Missionaries and cannibals
• http://www.novelgames.com/gametips/details.php?id=29
• [Problem formulation]
12
Real-world problems
• Route finding
– Defined in terms of locations and transitions along links between them
– Applications: routing in computer networks, automated travel advisory
systems, airline travel planning systems
• Touring and traveling salesperson problems
– “Visit every city on the map at least once and end in Bucharest”
– Needs information about the visited cities
– Goal: Find the shortest tour that visits all cities
– NP-hard, but a lot of effort has been spent on improving the
capabilities of TSP algorithms
– Applications: planning movements of automatic circuit board drills
13
Real-world problems
• VLSI layout
– Place cells on a chip so they don’t overlap and there is
room for connecting wires to be placed between the cells
• Robot navigation
– Generalization of the route finding problem
• No discrete set of routes
• Robot can move in a continuous space
• Infinite set of possible actions and states
• Assembly sequencing
– Automatic assembly of complex objects
– The problem is to find an order in which to assemble the
parts of some object
14
What is a Solution?
• A sequence of actions (a plan) which leads from the initial state
into a goal state (e.g., the sequence of actions that gets the
missionaries safely across the river)
• Or sometimes just the goal state (e.g., infer molecular structure
from mass spectrographic data)
15
Our Current Framework
• Backtracking state-space search
• Others:
– Constraint-based search
– Optimization search
– Adversarial search
State Space
Giurgiu
Urziceni
Hirsova
Eforie
Neamt
Oradea
Zerind
Arad
Timisoara
Lugoj
Mehadia
Drobeta
Craiova
Sibiu Fagaras
Pitesti
Vaslui
Iasi
Rimnicu Vilcea
Bucharest
71
75
118
111
70
75
120
151
140
99
80
97
101
211
138
146 85
90
98
142
92
87
86
16
Search Trees
(a) The initial state
(b) After expanding Arad
(c) After expanding Sibiu
Rimnicu Vilcea Lugoj
Arad Fagaras Oradea Arad
Arad Oradea
Rimnicu Vilcea Lugoj
Zerind
Sibiu
Arad Fagaras Oradea
Timisoara
Arad
Arad Oradea
Lugoj Arad
Arad Oradea
Zerind
Arad
Sibiu Timisoara
Arad
Rimnicu Vilcea
Zerind
Arad
Sibiu
Arad Fagaras Oradea
Timisoara
17
States vs. Nodes
• []
18
19
Generalized Search
Start by adding the initial state to a
list, called fringe
Loop
If there are no states left then fail
Otherwise remove a node from fringe, cur
If it’s a goal state return it
Otherwise expand it and add the resulting nodes to fringe
Expand a node = generate its successors
General Tree Search
• Code on course webpage
• Style of code: simple, for class
– Two versions; one simpler than the other. These slides: the simpler
one.
• The simpler one requires input for the successors, and is only good for
comparing depthfirst and breadthfirst search, and treesearch vs.
graphsearch.
• Look at it; if it isn’t trivial to you, get up to speed before the next class
(there is a link to a Python tutorial in the syllabus)
• The AIMA website has fully object-oriented code (Python, Java,
etc)
20
21
def treesearch (qfun,fringe):
while len(fringe) > 0:
cur = fringe[0]
fringe = fringe[1:]
if goalp(cur): return cur
fringe = qfun(makeNodes(cur,successors(cur)),fringe)
return []
Blind Search Strategies
[breadth-first, uniform-cost, and depth-first search; evaluation
criteria on next 3 slides; then iterative deepening search.]
22
State Space
Giurgiu
Urziceni
Hirsova
Eforie
Neamt
Oradea
Zerind
Arad
Timisoara
Lugoj
Mehadia
Drobeta
Craiova
Sibiu Fagaras
Pitesti
Vaslui
Iasi
Rimnicu Vilcea
Bucharest
71
75
118
111
70
75
120
151
140
99
80
97
101
211
138
146 85
90
98
142
92
87
86
23
24
Evaluation Criteria
• Space
– Maximum number of nodes in memory at one time
• Optimality
– Does it always find a least-cost solution?
– Cost considered: sum of the edgecosts of the path to the goal (the g-
val)
25
Evaluation Criteria
• Completeness
– Does it find a solution when one exists
• Time
– The number of nodes generated during search
26
Time and Space Complexity
Measured in Terms of
• b – maximum branching factor of the
search tree; we will assume b is finite
• d – depth of the shallowest goal
• m – maximum depth of any path in the state space (may be infinite)
27
def graphsearch (qfun,fringe):
expanded = {}
while len(fringe) > 0:
cur = fringe[0]
fringe = fringe[1:]
if goalp(cur): return cur
if not (expanded.has_key(cur.state) and
expanded[cur.state].gval <= cur.gval):
expanded[cur.state] = cur
fringe = qfun(makeNodes(cur,successors(cur)),fringe)
return []
28
def depthLimSearch (fringe,depthlim):
while len(fringe) > 0:
cur = fringe[0]
fringe = fringe[1:]
if goalp(cur): return cur
if cur.depth <= depthlim:
fringe = makeNodes(cur,successors(cur)) + fringe
return []
29
def depthLimSearch (fringe,depthlim):
while len(fringe) > 0:
cur = fringe[0]
fringe = fringe[1:]
if goalp(cur): return cur
if cur.depth <= depthlim:
fringe = makeNodes(cur,successors(cur)) + fringe
return []
def iterativeDeepening(start):
result = []
depthlim = 1
startnode = Node(start)
while not result:
result = depthLimSearch([startnode],depthlim)
depthlim = depthlim + 1
return result
Wrap Up
• Chapter 3.1-4
• Code under resources on the course webpage: simplesearch.py
• Notes (in response to questions asked in the past)
– The book writes separate code for breadth-first search, i.e., they don’t call
treesearch as in the class code. Their version applies the goal test to a
node when it is first generated, before it is added to the fringe. This can
save time and space: In the worst case, when the goal is on the right
frontier of the search tree, my version of breadth-first search generates,
and adds to the fringe, an extra level of nodes than their version does.
In figure 3.21 (time and space), breadth-first search is O(b^d) and uniform-
cost search is O(b^(d+1)) if all edge-costs are equal.
– For the exam, I won’t be concerned with this complexity distinction. We
are focusing on larger differences, such as whether the complexity is linear
versus exponential and whether the exponent is d or m (which may be quite
substantially different).
– However (please see the following slide) …
30
Wrap Up
– However, we are focusing on the behavior of the algorithms
– Possible exam questions are:
• Suppose we change tree search (or graph search) so that it applies the goal test to
a node when it is first generated, before it is added to the fringe, and return
immediately if the test is positive.
• Is breadth-first search, uniform-cost search, (or another algorithm) still optimal?
If so, explain why and list any conditions. If not, give a (small) counter example.
• As far as depth-first-search, there is a difference in the
implementation from simplesearch.py and search.py: simplesearch.py
(and these lecture notes) adds the results of the successor function to
the fringe in one step; search.py adds them one by one. Specifically
for depth-first search, this will affect whether the search proceeds
down the left or the right of the tree. For the exam, and in class, I’ll
be clear about this difference if it comes up.
• From a theoretical point of view, in this framework for AI problem
solving, the order of the successors is ignored, and not part of the
distinctions between the algorithms. That is, there is no metric by
which one successor can be judged better than another one.
31

More Related Content

Similar to AI Problem Solving Techniques

(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 aiRadhika Srinivasan
 
Nearest Neighbor Customer Insight
Nearest Neighbor Customer InsightNearest Neighbor Customer Insight
Nearest Neighbor Customer InsightMapR Technologies
 
Search algorithms master
Search algorithms masterSearch algorithms master
Search algorithms masterHossam Hassan
 
Data Analysis and Algorithms Lecture 1: Introduction
 Data Analysis and Algorithms Lecture 1: Introduction Data Analysis and Algorithms Lecture 1: Introduction
Data Analysis and Algorithms Lecture 1: IntroductionTayyabSattar5
 
Start From A MapReduce Graph Pattern-recognize Algorithm
Start From A MapReduce Graph Pattern-recognize AlgorithmStart From A MapReduce Graph Pattern-recognize Algorithm
Start From A MapReduce Graph Pattern-recognize AlgorithmYu Liu
 
1 chayes
1 chayes1 chayes
1 chayesYandex
 
AI 03 Solving Problems By Searching
AI 03 Solving Problems By SearchingAI 03 Solving Problems By Searching
AI 03 Solving Problems By SearchingJustin Knight
 

Similar to AI Problem Solving Techniques (20)

Clustering - ACM 2013 02-25
Clustering - ACM 2013 02-25Clustering - ACM 2013 02-25
Clustering - ACM 2013 02-25
 
(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai
 
Nearest Neighbor Customer Insight
Nearest Neighbor Customer InsightNearest Neighbor Customer Insight
Nearest Neighbor Customer Insight
 
Search algorithms master
Search algorithms masterSearch algorithms master
Search algorithms master
 
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)
 
Data Analysis and Algorithms Lecture 1: Introduction
 Data Analysis and Algorithms Lecture 1: Introduction Data Analysis and Algorithms Lecture 1: Introduction
Data Analysis and Algorithms Lecture 1: Introduction
 
Lecture 1 (bce-7)
Lecture   1 (bce-7)Lecture   1 (bce-7)
Lecture 1 (bce-7)
 
Intro_2.ppt
Intro_2.pptIntro_2.ppt
Intro_2.ppt
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
 
l2.pptx
l2.pptxl2.pptx
l2.pptx
 
Sudoku solver
Sudoku solverSudoku solver
Sudoku solver
 
Lecture 3 problem solving
Lecture 3   problem solvingLecture 3   problem solving
Lecture 3 problem solving
 
Start From A MapReduce Graph Pattern-recognize Algorithm
Start From A MapReduce Graph Pattern-recognize AlgorithmStart From A MapReduce Graph Pattern-recognize Algorithm
Start From A MapReduce Graph Pattern-recognize Algorithm
 
DAA Notes.pdf
DAA Notes.pdfDAA Notes.pdf
DAA Notes.pdf
 
Parallel search
Parallel searchParallel search
Parallel search
 
l2.pptx
l2.pptxl2.pptx
l2.pptx
 
1 chayes
1 chayes1 chayes
1 chayes
 
Chap11 slides
Chap11 slidesChap11 slides
Chap11 slides
 
AI 03 Solving Problems By Searching
AI 03 Solving Problems By SearchingAI 03 Solving Problems By Searching
AI 03 Solving Problems By Searching
 

More from ssuser99ca78

Introduction-Chapter-1.ppt
Introduction-Chapter-1.pptIntroduction-Chapter-1.ppt
Introduction-Chapter-1.pptssuser99ca78
 
chapter2-(Intelligent Agents).ppt
chapter2-(Intelligent Agents).pptchapter2-(Intelligent Agents).ppt
chapter2-(Intelligent Agents).pptssuser99ca78
 
Java PSkills Session-6 PNR.pptx
Java PSkills Session-6 PNR.pptxJava PSkills Session-6 PNR.pptx
Java PSkills Session-6 PNR.pptxssuser99ca78
 
stringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptxstringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptxssuser99ca78
 
Java PSkills-session2.pptx
Java PSkills-session2.pptxJava PSkills-session2.pptx
Java PSkills-session2.pptxssuser99ca78
 
DSP_Course_Contents.ppt
DSP_Course_Contents.pptDSP_Course_Contents.ppt
DSP_Course_Contents.pptssuser99ca78
 
26 Speech Lecture.ppt
26 Speech Lecture.ppt26 Speech Lecture.ppt
26 Speech Lecture.pptssuser99ca78
 
Java PSkills Session-4 PNR.pptx
Java PSkills Session-4 PNR.pptxJava PSkills Session-4 PNR.pptx
Java PSkills Session-4 PNR.pptxssuser99ca78
 
Java PSkills Session-3 PNR.pptx
Java PSkills Session-3 PNR.pptxJava PSkills Session-3 PNR.pptx
Java PSkills Session-3 PNR.pptxssuser99ca78
 

More from ssuser99ca78 (13)

Introduction-Chapter-1.ppt
Introduction-Chapter-1.pptIntroduction-Chapter-1.ppt
Introduction-Chapter-1.ppt
 
chapter2-(Intelligent Agents).ppt
chapter2-(Intelligent Agents).pptchapter2-(Intelligent Agents).ppt
chapter2-(Intelligent Agents).ppt
 
2.ppt
2.ppt2.ppt
2.ppt
 
Java PSkills Session-6 PNR.pptx
Java PSkills Session-6 PNR.pptxJava PSkills Session-6 PNR.pptx
Java PSkills Session-6 PNR.pptx
 
ARRAYS.ppt
ARRAYS.pptARRAYS.ppt
ARRAYS.ppt
 
stringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptxstringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptx
 
Java PSkills-session2.pptx
Java PSkills-session2.pptxJava PSkills-session2.pptx
Java PSkills-session2.pptx
 
OOPJ.pptx
OOPJ.pptxOOPJ.pptx
OOPJ.pptx
 
DSP_Course_Contents.ppt
DSP_Course_Contents.pptDSP_Course_Contents.ppt
DSP_Course_Contents.ppt
 
26 Speech Lecture.ppt
26 Speech Lecture.ppt26 Speech Lecture.ppt
26 Speech Lecture.ppt
 
Java PSkills Session-4 PNR.pptx
Java PSkills Session-4 PNR.pptxJava PSkills Session-4 PNR.pptx
Java PSkills Session-4 PNR.pptx
 
Java PSkills Session-3 PNR.pptx
Java PSkills Session-3 PNR.pptxJava PSkills Session-3 PNR.pptx
Java PSkills Session-3 PNR.pptx
 
UNIT1-JAVA.pptx
UNIT1-JAVA.pptxUNIT1-JAVA.pptx
UNIT1-JAVA.pptx
 

Recently uploaded

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 

Recently uploaded (20)

Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 

AI Problem Solving Techniques

  • 1. 1 CS 2710, ISSP 2160 Foundations of Artificial Intelligence Solving Problems by Searching
  • 2. Chapter 3 Part 1 • Problem solving by search • Uninformed search strategies • Chapter 3 through 3.4 2
  • 3. Setup • Perception/action cycle [board] • Goal-based agent: find a sequence of actions to achieve a goal – Search, then execute • The methods in this chapter are appropriate for problems for which the environment is observable, discrete, determininistic.[which means?] 3
  • 6. 6 Problem Solving [A problem is formally defined by 4 components]
  • 7. 7 Example Problems • Toy problems – Illustrate/test various problem-solving methods – Concise, exact description – Can be used to compare performance – Examples: 8-puzzle, 8-queens problem, Cryptarithmetic, Vacuum world, Missionaries and cannibals, simple route finding • Real-world problem – More difficult – No single, agreed-upon specification (state, successor function, edgecost) – Examples: Route finding, VLSI layout, Robot navigation, Assembly sequencing (read 3.2.2 about complexities)
  • 8. 8 Toy Problems The vacuum world • The vacuum world – The world has only two locations – Each location may or may not contain dirt – The agent may be in one location or the other – 8 possible world states – Three possible actions: Left, Right, Suck – Goal: clean up all the dirt 1 2 4 3 5 6 7 8
  • 9. 9 Toy Problems The vacuum world – States: one of the 8 states given earlier – Operators: move left, move right, suck – Goal test: no dirt left in any square – Path cost: each action costs one S R L S S S R R R L L L
  • 10. 10 Missionaries and cannibals • Missionaries and cannibals – Three missionaries and three cannibals want to cross a river – There is a boat that can hold two people – Cross the river, but make sure that the missionaries are not outnumbered by the cannibals on either bank • Lots of abstraction – Crocodiles in the river, the weather and so on – Only the endpoints of the crossing are important, etc.
  • 11. 11 Missionaries and cannibals • http://www.novelgames.com/gametips/details.php?id=29 • [Problem formulation]
  • 12. 12 Real-world problems • Route finding – Defined in terms of locations and transitions along links between them – Applications: routing in computer networks, automated travel advisory systems, airline travel planning systems • Touring and traveling salesperson problems – “Visit every city on the map at least once and end in Bucharest” – Needs information about the visited cities – Goal: Find the shortest tour that visits all cities – NP-hard, but a lot of effort has been spent on improving the capabilities of TSP algorithms – Applications: planning movements of automatic circuit board drills
  • 13. 13 Real-world problems • VLSI layout – Place cells on a chip so they don’t overlap and there is room for connecting wires to be placed between the cells • Robot navigation – Generalization of the route finding problem • No discrete set of routes • Robot can move in a continuous space • Infinite set of possible actions and states • Assembly sequencing – Automatic assembly of complex objects – The problem is to find an order in which to assemble the parts of some object
  • 14. 14 What is a Solution? • A sequence of actions (a plan) which leads from the initial state into a goal state (e.g., the sequence of actions that gets the missionaries safely across the river) • Or sometimes just the goal state (e.g., infer molecular structure from mass spectrographic data)
  • 15. 15 Our Current Framework • Backtracking state-space search • Others: – Constraint-based search – Optimization search – Adversarial search
  • 16. State Space Giurgiu Urziceni Hirsova Eforie Neamt Oradea Zerind Arad Timisoara Lugoj Mehadia Drobeta Craiova Sibiu Fagaras Pitesti Vaslui Iasi Rimnicu Vilcea Bucharest 71 75 118 111 70 75 120 151 140 99 80 97 101 211 138 146 85 90 98 142 92 87 86 16
  • 17. Search Trees (a) The initial state (b) After expanding Arad (c) After expanding Sibiu Rimnicu Vilcea Lugoj Arad Fagaras Oradea Arad Arad Oradea Rimnicu Vilcea Lugoj Zerind Sibiu Arad Fagaras Oradea Timisoara Arad Arad Oradea Lugoj Arad Arad Oradea Zerind Arad Sibiu Timisoara Arad Rimnicu Vilcea Zerind Arad Sibiu Arad Fagaras Oradea Timisoara 17
  • 19. 19 Generalized Search Start by adding the initial state to a list, called fringe Loop If there are no states left then fail Otherwise remove a node from fringe, cur If it’s a goal state return it Otherwise expand it and add the resulting nodes to fringe Expand a node = generate its successors
  • 20. General Tree Search • Code on course webpage • Style of code: simple, for class – Two versions; one simpler than the other. These slides: the simpler one. • The simpler one requires input for the successors, and is only good for comparing depthfirst and breadthfirst search, and treesearch vs. graphsearch. • Look at it; if it isn’t trivial to you, get up to speed before the next class (there is a link to a Python tutorial in the syllabus) • The AIMA website has fully object-oriented code (Python, Java, etc) 20
  • 21. 21 def treesearch (qfun,fringe): while len(fringe) > 0: cur = fringe[0] fringe = fringe[1:] if goalp(cur): return cur fringe = qfun(makeNodes(cur,successors(cur)),fringe) return []
  • 22. Blind Search Strategies [breadth-first, uniform-cost, and depth-first search; evaluation criteria on next 3 slides; then iterative deepening search.] 22
  • 23. State Space Giurgiu Urziceni Hirsova Eforie Neamt Oradea Zerind Arad Timisoara Lugoj Mehadia Drobeta Craiova Sibiu Fagaras Pitesti Vaslui Iasi Rimnicu Vilcea Bucharest 71 75 118 111 70 75 120 151 140 99 80 97 101 211 138 146 85 90 98 142 92 87 86 23
  • 24. 24 Evaluation Criteria • Space – Maximum number of nodes in memory at one time • Optimality – Does it always find a least-cost solution? – Cost considered: sum of the edgecosts of the path to the goal (the g- val)
  • 25. 25 Evaluation Criteria • Completeness – Does it find a solution when one exists • Time – The number of nodes generated during search
  • 26. 26 Time and Space Complexity Measured in Terms of • b – maximum branching factor of the search tree; we will assume b is finite • d – depth of the shallowest goal • m – maximum depth of any path in the state space (may be infinite)
  • 27. 27 def graphsearch (qfun,fringe): expanded = {} while len(fringe) > 0: cur = fringe[0] fringe = fringe[1:] if goalp(cur): return cur if not (expanded.has_key(cur.state) and expanded[cur.state].gval <= cur.gval): expanded[cur.state] = cur fringe = qfun(makeNodes(cur,successors(cur)),fringe) return []
  • 28. 28 def depthLimSearch (fringe,depthlim): while len(fringe) > 0: cur = fringe[0] fringe = fringe[1:] if goalp(cur): return cur if cur.depth <= depthlim: fringe = makeNodes(cur,successors(cur)) + fringe return []
  • 29. 29 def depthLimSearch (fringe,depthlim): while len(fringe) > 0: cur = fringe[0] fringe = fringe[1:] if goalp(cur): return cur if cur.depth <= depthlim: fringe = makeNodes(cur,successors(cur)) + fringe return [] def iterativeDeepening(start): result = [] depthlim = 1 startnode = Node(start) while not result: result = depthLimSearch([startnode],depthlim) depthlim = depthlim + 1 return result
  • 30. Wrap Up • Chapter 3.1-4 • Code under resources on the course webpage: simplesearch.py • Notes (in response to questions asked in the past) – The book writes separate code for breadth-first search, i.e., they don’t call treesearch as in the class code. Their version applies the goal test to a node when it is first generated, before it is added to the fringe. This can save time and space: In the worst case, when the goal is on the right frontier of the search tree, my version of breadth-first search generates, and adds to the fringe, an extra level of nodes than their version does. In figure 3.21 (time and space), breadth-first search is O(b^d) and uniform- cost search is O(b^(d+1)) if all edge-costs are equal. – For the exam, I won’t be concerned with this complexity distinction. We are focusing on larger differences, such as whether the complexity is linear versus exponential and whether the exponent is d or m (which may be quite substantially different). – However (please see the following slide) … 30
  • 31. Wrap Up – However, we are focusing on the behavior of the algorithms – Possible exam questions are: • Suppose we change tree search (or graph search) so that it applies the goal test to a node when it is first generated, before it is added to the fringe, and return immediately if the test is positive. • Is breadth-first search, uniform-cost search, (or another algorithm) still optimal? If so, explain why and list any conditions. If not, give a (small) counter example. • As far as depth-first-search, there is a difference in the implementation from simplesearch.py and search.py: simplesearch.py (and these lecture notes) adds the results of the successor function to the fringe in one step; search.py adds them one by one. Specifically for depth-first search, this will affect whether the search proceeds down the left or the right of the tree. For the exam, and in class, I’ll be clear about this difference if it comes up. • From a theoretical point of view, in this framework for AI problem solving, the order of the successors is ignored, and not part of the distinctions between the algorithms. That is, there is no metric by which one successor can be judged better than another one. 31