SlideShare a Scribd company logo
1 of 35
Cooperating Intelligent Systems
Uninformed search
Chapter 3, AIMA
(freely available in the internet with the name
AMIA_Ch3_L2.ppt, Sweden)
Complement to the 8-puzzle and missionaries
and cannibals problems
A ”problem” consists of
• An initial state, q(0)
• A list of possible actions, a, for the agent
• A goal test (there can be many goal states)
• A path cost
One way to solve this is to search for a path
q(0)  q(1)  q(2)  ...  q(N)
such that q(N) is a goal state.
Example: 8-puzzle
• State: Specification of each of
the eight tiles in the nine
squares (the blank is in the
remaining square).
• Initial state: Any state.
• Successor function
(actions): Blank moves Left,
Right, Up, or Down.
• Goal test: Check whether the
goal state has been reached.
• Path cost: Each move costs 1.
The path cost = the number of
moves.
2 8 3
1 6 4
7 5
1 2 3
8
6
4
7 5
Start State Goal State
Example: 8-puzzle
• State: Specification of each of
the eight tiles in the nine
squares (the blank is in the
remaining square).
• Initial state: Any state.
• Successor function
(actions): Blank moves Left,
Right, Up, or Down.
• Goal test: Check whether the
goal state has been reached.
• Path cost: Each move costs 1.
The path cost = the number of
moves.
2 8 3
1 6 4
7 5
1 2 3
8
6
4
7 5
Start State Goal State
Examples:
q = {7, 2, 4, 5, 0, 6, 8, 3, 1}
q = {2, 8, 3, 1, 6, 4, 7, 0, 5}
Example: 8-puzzle
• State: Specification of each of
the eight tiles in the nine
squares (the blank is in the
remaining square).
• Initial state: Any state.
• Successor function
(actions): Blank moves Left,
Right, Up, or Down.
• Goal test: Check whether the
goal state has been reached.
• Path cost: Each move costs 1.
The path cost = the number of
moves.
2 8 3
1 6 4
7 5
1 2 3
8
6
4
7 5
Start State Goal State
Expanding 8-puzzle
2 8 3
1 6 4
7 5
2 8 3
1 6 4
7 5
2 8 3
1
6
4
7 5
2 8 3
1 6 4
7 5
Blank moves left Blank moves right
Blank moves up
q = {2, 8, 3, 1, 6, 4, 7, 0, 5}
q = {2, 8, 3, 1, 6, 4, 0, 7, 5}
q = {2, 8, 3, 1, 0, 4, 7, 6, 5}
q = {2, 8, 3, 1, 6, 4, 7, 5, 0}
Uninformed search
Searching for the goal without knowing in which direction it
is.
– Breadth-first
– Depth-first
– Iterative deepening
(Depth and breadth refers to the search tree)
We evaluate the algorithms by their:
– Completeness (do they explore all possibilities)
– Optimality (do they find the solution with minimum path cost)
– Time complexity (number of nodes expanded during search)
– Space complexity (maximum number of nodes in memory)
Breadth-first
• Breadth-first finds the solution that is closest (in the graph) to the start
node (always expands the shallowest node).
• Keeps O(bd) nodes in memory  exponential memory requirement!
• Complete (finds a solution if there is one)
• Not necessarily optimal (optimal if cost is the same for each step)
• Exponential space complexity (very bad)
• Exponential time complexity
b = branching factor, d = depth
Image from Russel & Norvig, AIMA, 2003
Nodes marked with open circles = fringe = in the memory
Image from N. J. Nilsson, Artificial Intelligence – A New Synthesis, 1998
Breadth-first search for 8-
puzzle.
The path marked by bold
arrows is the solution.
Note: This assumes that
you apply goal test
immediately after
expansion
(not the case for AIMA
implementation)
If we keep track of visited
states  Graph search
(rather than tree search)
Solution in node # 46
Depth-first
• Keeps O(bd) nodes in memory.
• Requires a depth limit to avoid
infinite paths
(limit is 3 in the figure).
• Incomplete (is not guaranteed to
find a solution)
• Not optimal
• Linear space complexity (good)
• Exponential time complexity
Image from Russel & Norvig, AIMA, 2003
Black nodes are removed from memory
b = branching factor, d = depth
Image from N. J. Nilsson, Artificial Intelligence – A New Synthesis, 1998
Depth-first on the 8-puzzle
example.
Depth = 5
Solution in node # 31
Iterative deepening
• Keeps O(bd) nodes in
memory.
• Iteratively increases the depth
limit.
• Complete (like BFS)
• Not optimal
• Linear space complexity
(like DFS)
• Exponential time complexity
• The preferred search method
for large search spaces with
unknown depth.
Image from Russel & Norvig, AIMA, 2003
Black nodes are removed from memory b = branching factor, d = depth
Exercise
Exercise 3.4: Show that the 8-puzzle states
are divided into two disjoint sets, such that
no state in one set can be transformed into
a state in the other set by any number of
moves. Devise a procedure that will tell
you which class a given state is in, and
explain why this is a good thing to have for
generating random states.
Proof for exercise 3.4:
Definition: Define the order of
counting from the upper left corner
to the lower right corner (see
figure).
Let N denote the number of lower
numbers following a number (so-
called ”inversions”) when counting
in this fashion.
N = 11 in the figure.
2 8 3
1 6 4
7 5
2 8 3
1 6 4
7 5
Yellow tiles are inverted
relative to the tile with
”8” in the top row.
2 8 3
1 6 4
7 5
2 8 3
1 6 4
7 5
2 8 3
1 6 4
7 5
2 8 3
1 6 4
7 5
6 1 2 1
2 8 3
1 6 4
7 5
1 + + + + = 11
Proof for exercise 3.4:
Proposition: N is either always even or odd
(i.e. Nmod2 is conserved).
Proof:
(1) Sliding the blank along a row does not change the row
number and not the internal order of the tiles, i.e. N (and
thus also Nmod2) is conserved.
(2) Sliding the blank between rows does not change
Nmod2 either, as shown on the following slide.
Proof for exercise 3.4:
We only need to consider tiles B, C, and D since
the relative order of the other tiles remains the
same.
• If B > C and B > D, then the move removes
two inversions.
• If B > C and B < D, then the move adds one
inversion and removes one (sum = 0).
• If B < C and B < D, then the move adds two
inversions.
The number of inversions changes in steps of 2.
A B C
D
G
E
F H
A
B
C
D
G
E
F H
Observation
The upper state has N = 0
The lower (goal) state has N = 7
We cannot go from one to the other.
1 2 3
8
6
4
7 5
1 2 3
4 5 6
7 8
Exercise
Exercise 3.9: The missionaries and cannibals: Three missionaries and three cannibals are on one
side of a river, along with a boat that can hold one or two people (one for rowing). Find a way to
get everyone to the other side, without ever leaving a group of missionaries in one place
outnumbered by the cannibals in that place (the cannibals eat the missionaries then).
a. Formulate the problem precisely, making only those distinctions necessary to ensure a valid
solution. Draw a diagram of the complete state space.
b. Implement and solve the problem optimally using an appropriate search algorithm. Is it a good
idea to check for repeated states?
c. Why do you think people have a hard time solving this puzzle, given that the state space is so
simple?
Image from http://www.cse.msu.edu/~michmer3/440/Lab1/cannibal.html
Missionaries & Cannibals
State: q = (M,C,B) signifying the number of missionaries, cannibals, and boats on the left
bank. The start state is (3,3,1) and the goal state is (0,0,0).
Actions (successor function): (10 possible but only 5 available each move due to boat)
• One cannibal/missionary crossing L  R: subtract (0,1,1) or (1,0,1)
• Two cannibals/missionaries crossing L  R: subtract (0,2,1) or (2,0,1)
• One cannibal/missionary crossing R  L: add (1,0,1) or (0,1,1)
• Two cannibals/missionaries crossing R  L: add (2,0,1) or (0,2,1)
• One cannibal and one missionary crossing: add/subtract (1,1,1)
Image from http://www.cse.msu.edu/~michmer3/440/Lab1/cannibal.html
Missionaries & Cannibals states
Assumes that passengers have to get out of the boat after the trip.
Red states = missionaries get eaten.
Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states
Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states
Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states
Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states

Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states

Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states

Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states

Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states

Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states

Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states

Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states

Breadth-first search on
Missionaries & Cannibals
States are generated by applying:
+/- (1,0,1)
+/- (0,1,1)
+/- (2,0,1)
+/- (0,2,1)
+/- (1,1,1)
In that order (left to right)
Red states = missionaries get eaten
Yellow states = repeated states

Breadth-first search on
Missionaries & Cannibals
-(0,2,1) [2 cannibals cross L  R]
+(0,1,1) [1 cannibal crosses R  L]
-(0,2,1) [2 cannibals cross L  R]
+(0,1,1) [1 cannibal crosses R  L]
-(2,0,1) [2 missionaries cross L  R]
+(1,1,1) [1 cannibal & 1 missionary
cross R  L]
-(2,0,1) [2 missionaries cross L  R]
+(0,1,1) [1 cannibal crosses R  L]
-(0,2,1) [2 cannibals cross L  R]
+(1,0,1) [1 missionary crosses R  L]
-(1,1,1) [1 cannibal & 1 missionary
cross L  R]
This is an optimal solution (minimum
number of crossings). [Why?]
Would Depth-first work?

Breadth-first search on
Missionaries & Cannibals
-(0,2,1) [2 cannibals cross L  R]
+(0,1,1) [1 cannibal crosses R  L]
-(0,2,1) [2 cannibals cross L  R]
+(0,1,1) [1 cannibal crosses R  L]
-(2,0,1) [2 missionaries cross L  R]
+(1,1,1) [1 cannibal & 1 missionary
cross R  L]
-(2,0,1) [2 missionaries cross L  R]
+(0,1,1) [1 cannibal crosses R  L]
-(0,2,1) [2 cannibals cross L  R]
+(1,0,1) [1 missionary crosses R  L]
-(1,1,1) [1 cannibal & 1 missionary
cross L  R]
This is an optimal solution (minimum
number of crossings).
Would Depth-first work?

Breadth-first search on
Missionaries & Cannibals
Expanded 48 nodes
Depth-first search on
Missionaries & Cannibals
Expanded 30 nodes
(if repeated states are
checked, otherwise we end
up in an endless loop)


More Related Content

Similar to AIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjek

Lec10-CS110 Computational Engineering
Lec10-CS110 Computational EngineeringLec10-CS110 Computational Engineering
Lec10-CS110 Computational EngineeringSri Harsha Pamu
 
State Space Representation and Search
State Space Representation and SearchState Space Representation and Search
State Space Representation and SearchHitesh Mohapatra
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesFahim Ferdous
 
AI problem solving.pptx
AI problem solving.pptxAI problem solving.pptx
AI problem solving.pptxSonam Mittal
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.pptMIT,Imphal
 
5.5 back track
5.5 back track5.5 back track
5.5 back trackKrish_ver2
 
(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
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cyclevarun arora
 
problem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , problomsproblem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , problomsSlimAmiri
 

Similar to AIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjek (20)

Unit 4 jwfiles
Unit 4 jwfilesUnit 4 jwfiles
Unit 4 jwfiles
 
Lec10-CS110 Computational Engineering
Lec10-CS110 Computational EngineeringLec10-CS110 Computational Engineering
Lec10-CS110 Computational Engineering
 
Stochastic Process Assignment Help
Stochastic Process Assignment HelpStochastic Process Assignment Help
Stochastic Process Assignment Help
 
l2.pptx
l2.pptxl2.pptx
l2.pptx
 
State Space Representation and Search
State Space Representation and SearchState Space Representation and Search
State Space Representation and Search
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
 
Back tracking
Back trackingBack tracking
Back tracking
 
AI problem solving.pptx
AI problem solving.pptxAI problem solving.pptx
AI problem solving.pptx
 
l2.pptx
l2.pptxl2.pptx
l2.pptx
 
1 blind search
1 blind search1 blind search
1 blind search
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.ppt
 
Mit6 006 f11_quiz1
Mit6 006 f11_quiz1Mit6 006 f11_quiz1
Mit6 006 f11_quiz1
 
Slope
SlopeSlope
Slope
 
5.5 back track
5.5 back track5.5 back track
5.5 back track
 
algorithm Unit 4
algorithm Unit 4 algorithm Unit 4
algorithm Unit 4
 
Lecture5.pptx
Lecture5.pptxLecture5.pptx
Lecture5.pptx
 
(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
 
Sudoku
SudokuSudoku
Sudoku
 
problem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , problomsproblem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , probloms
 

Recently uploaded

Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...nagunakhan
 
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up NumberCall Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up NumberMs Riya
 
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...Call Girls in Nagpur High Profile
 
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...anilsa9823
 
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...Pooja Nehwal
 
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /WhatsappsBeautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsappssapnasaifi408
 
Vip Noida Escorts 9873940964 Greater Noida Escorts Service
Vip Noida Escorts 9873940964 Greater Noida Escorts ServiceVip Noida Escorts 9873940964 Greater Noida Escorts Service
Vip Noida Escorts 9873940964 Greater Noida Escorts Serviceankitnayak356677
 
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...Suhani Kapoor
 
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样qaffana
 
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,Pooja Nehwal
 
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...nagunakhan
 
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一zul5vf0pq
 
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311  Call Girls in Thane , Independent Escort Service ThanePallawi 9167673311  Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service ThanePooja Nehwal
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一ga6c6bdl
 
Gaya Call Girls #9907093804 Contact Number Escorts Service Gaya
Gaya Call Girls #9907093804 Contact Number Escorts Service GayaGaya Call Girls #9907093804 Contact Number Escorts Service Gaya
Gaya Call Girls #9907093804 Contact Number Escorts Service Gayasrsj9000
 
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 

Recently uploaded (20)

Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
 
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up NumberCall Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
 
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
 
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
 
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...
 
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
 
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /WhatsappsBeautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
 
Vip Noida Escorts 9873940964 Greater Noida Escorts Service
Vip Noida Escorts 9873940964 Greater Noida Escorts ServiceVip Noida Escorts 9873940964 Greater Noida Escorts Service
Vip Noida Escorts 9873940964 Greater Noida Escorts Service
 
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
 
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
 
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
 
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
 
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
 
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311  Call Girls in Thane , Independent Escort Service ThanePallawi 9167673311  Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service Thane
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
 
Gaya Call Girls #9907093804 Contact Number Escorts Service Gaya
Gaya Call Girls #9907093804 Contact Number Escorts Service GayaGaya Call Girls #9907093804 Contact Number Escorts Service Gaya
Gaya Call Girls #9907093804 Contact Number Escorts Service Gaya
 
9953330565 Low Rate Call Girls In Jahangirpuri Delhi NCR
9953330565 Low Rate Call Girls In Jahangirpuri  Delhi NCR9953330565 Low Rate Call Girls In Jahangirpuri  Delhi NCR
9953330565 Low Rate Call Girls In Jahangirpuri Delhi NCR
 
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
young call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Service
young call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Service
young call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Service
 

AIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjek

  • 1. Cooperating Intelligent Systems Uninformed search Chapter 3, AIMA (freely available in the internet with the name AMIA_Ch3_L2.ppt, Sweden) Complement to the 8-puzzle and missionaries and cannibals problems
  • 2. A ”problem” consists of • An initial state, q(0) • A list of possible actions, a, for the agent • A goal test (there can be many goal states) • A path cost One way to solve this is to search for a path q(0)  q(1)  q(2)  ...  q(N) such that q(N) is a goal state.
  • 3. Example: 8-puzzle • State: Specification of each of the eight tiles in the nine squares (the blank is in the remaining square). • Initial state: Any state. • Successor function (actions): Blank moves Left, Right, Up, or Down. • Goal test: Check whether the goal state has been reached. • Path cost: Each move costs 1. The path cost = the number of moves. 2 8 3 1 6 4 7 5 1 2 3 8 6 4 7 5 Start State Goal State
  • 4. Example: 8-puzzle • State: Specification of each of the eight tiles in the nine squares (the blank is in the remaining square). • Initial state: Any state. • Successor function (actions): Blank moves Left, Right, Up, or Down. • Goal test: Check whether the goal state has been reached. • Path cost: Each move costs 1. The path cost = the number of moves. 2 8 3 1 6 4 7 5 1 2 3 8 6 4 7 5 Start State Goal State Examples: q = {7, 2, 4, 5, 0, 6, 8, 3, 1} q = {2, 8, 3, 1, 6, 4, 7, 0, 5}
  • 5. Example: 8-puzzle • State: Specification of each of the eight tiles in the nine squares (the blank is in the remaining square). • Initial state: Any state. • Successor function (actions): Blank moves Left, Right, Up, or Down. • Goal test: Check whether the goal state has been reached. • Path cost: Each move costs 1. The path cost = the number of moves. 2 8 3 1 6 4 7 5 1 2 3 8 6 4 7 5 Start State Goal State
  • 6. Expanding 8-puzzle 2 8 3 1 6 4 7 5 2 8 3 1 6 4 7 5 2 8 3 1 6 4 7 5 2 8 3 1 6 4 7 5 Blank moves left Blank moves right Blank moves up q = {2, 8, 3, 1, 6, 4, 7, 0, 5} q = {2, 8, 3, 1, 6, 4, 0, 7, 5} q = {2, 8, 3, 1, 0, 4, 7, 6, 5} q = {2, 8, 3, 1, 6, 4, 7, 5, 0}
  • 7. Uninformed search Searching for the goal without knowing in which direction it is. – Breadth-first – Depth-first – Iterative deepening (Depth and breadth refers to the search tree) We evaluate the algorithms by their: – Completeness (do they explore all possibilities) – Optimality (do they find the solution with minimum path cost) – Time complexity (number of nodes expanded during search) – Space complexity (maximum number of nodes in memory)
  • 8. Breadth-first • Breadth-first finds the solution that is closest (in the graph) to the start node (always expands the shallowest node). • Keeps O(bd) nodes in memory  exponential memory requirement! • Complete (finds a solution if there is one) • Not necessarily optimal (optimal if cost is the same for each step) • Exponential space complexity (very bad) • Exponential time complexity b = branching factor, d = depth Image from Russel & Norvig, AIMA, 2003 Nodes marked with open circles = fringe = in the memory
  • 9. Image from N. J. Nilsson, Artificial Intelligence – A New Synthesis, 1998 Breadth-first search for 8- puzzle. The path marked by bold arrows is the solution. Note: This assumes that you apply goal test immediately after expansion (not the case for AIMA implementation) If we keep track of visited states  Graph search (rather than tree search) Solution in node # 46
  • 10. Depth-first • Keeps O(bd) nodes in memory. • Requires a depth limit to avoid infinite paths (limit is 3 in the figure). • Incomplete (is not guaranteed to find a solution) • Not optimal • Linear space complexity (good) • Exponential time complexity Image from Russel & Norvig, AIMA, 2003 Black nodes are removed from memory b = branching factor, d = depth
  • 11. Image from N. J. Nilsson, Artificial Intelligence – A New Synthesis, 1998 Depth-first on the 8-puzzle example. Depth = 5 Solution in node # 31
  • 12. Iterative deepening • Keeps O(bd) nodes in memory. • Iteratively increases the depth limit. • Complete (like BFS) • Not optimal • Linear space complexity (like DFS) • Exponential time complexity • The preferred search method for large search spaces with unknown depth. Image from Russel & Norvig, AIMA, 2003 Black nodes are removed from memory b = branching factor, d = depth
  • 13. Exercise Exercise 3.4: Show that the 8-puzzle states are divided into two disjoint sets, such that no state in one set can be transformed into a state in the other set by any number of moves. Devise a procedure that will tell you which class a given state is in, and explain why this is a good thing to have for generating random states.
  • 14. Proof for exercise 3.4: Definition: Define the order of counting from the upper left corner to the lower right corner (see figure). Let N denote the number of lower numbers following a number (so- called ”inversions”) when counting in this fashion. N = 11 in the figure. 2 8 3 1 6 4 7 5 2 8 3 1 6 4 7 5 Yellow tiles are inverted relative to the tile with ”8” in the top row. 2 8 3 1 6 4 7 5 2 8 3 1 6 4 7 5 2 8 3 1 6 4 7 5 2 8 3 1 6 4 7 5 6 1 2 1 2 8 3 1 6 4 7 5 1 + + + + = 11
  • 15. Proof for exercise 3.4: Proposition: N is either always even or odd (i.e. Nmod2 is conserved). Proof: (1) Sliding the blank along a row does not change the row number and not the internal order of the tiles, i.e. N (and thus also Nmod2) is conserved. (2) Sliding the blank between rows does not change Nmod2 either, as shown on the following slide.
  • 16. Proof for exercise 3.4: We only need to consider tiles B, C, and D since the relative order of the other tiles remains the same. • If B > C and B > D, then the move removes two inversions. • If B > C and B < D, then the move adds one inversion and removes one (sum = 0). • If B < C and B < D, then the move adds two inversions. The number of inversions changes in steps of 2. A B C D G E F H A B C D G E F H
  • 17. Observation The upper state has N = 0 The lower (goal) state has N = 7 We cannot go from one to the other. 1 2 3 8 6 4 7 5 1 2 3 4 5 6 7 8
  • 18. Exercise Exercise 3.9: The missionaries and cannibals: Three missionaries and three cannibals are on one side of a river, along with a boat that can hold one or two people (one for rowing). Find a way to get everyone to the other side, without ever leaving a group of missionaries in one place outnumbered by the cannibals in that place (the cannibals eat the missionaries then). a. Formulate the problem precisely, making only those distinctions necessary to ensure a valid solution. Draw a diagram of the complete state space. b. Implement and solve the problem optimally using an appropriate search algorithm. Is it a good idea to check for repeated states? c. Why do you think people have a hard time solving this puzzle, given that the state space is so simple? Image from http://www.cse.msu.edu/~michmer3/440/Lab1/cannibal.html
  • 19. Missionaries & Cannibals State: q = (M,C,B) signifying the number of missionaries, cannibals, and boats on the left bank. The start state is (3,3,1) and the goal state is (0,0,0). Actions (successor function): (10 possible but only 5 available each move due to boat) • One cannibal/missionary crossing L  R: subtract (0,1,1) or (1,0,1) • Two cannibals/missionaries crossing L  R: subtract (0,2,1) or (2,0,1) • One cannibal/missionary crossing R  L: add (1,0,1) or (0,1,1) • Two cannibals/missionaries crossing R  L: add (2,0,1) or (0,2,1) • One cannibal and one missionary crossing: add/subtract (1,1,1) Image from http://www.cse.msu.edu/~michmer3/440/Lab1/cannibal.html
  • 20. Missionaries & Cannibals states Assumes that passengers have to get out of the boat after the trip. Red states = missionaries get eaten.
  • 21. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states
  • 22. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states
  • 23. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states
  • 24. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states 
  • 25. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states 
  • 26. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states 
  • 27. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states 
  • 28. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states 
  • 29. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states 
  • 30. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states 
  • 31. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states 
  • 32. Breadth-first search on Missionaries & Cannibals States are generated by applying: +/- (1,0,1) +/- (0,1,1) +/- (2,0,1) +/- (0,2,1) +/- (1,1,1) In that order (left to right) Red states = missionaries get eaten Yellow states = repeated states 
  • 33. Breadth-first search on Missionaries & Cannibals -(0,2,1) [2 cannibals cross L  R] +(0,1,1) [1 cannibal crosses R  L] -(0,2,1) [2 cannibals cross L  R] +(0,1,1) [1 cannibal crosses R  L] -(2,0,1) [2 missionaries cross L  R] +(1,1,1) [1 cannibal & 1 missionary cross R  L] -(2,0,1) [2 missionaries cross L  R] +(0,1,1) [1 cannibal crosses R  L] -(0,2,1) [2 cannibals cross L  R] +(1,0,1) [1 missionary crosses R  L] -(1,1,1) [1 cannibal & 1 missionary cross L  R] This is an optimal solution (minimum number of crossings). [Why?] Would Depth-first work? 
  • 34. Breadth-first search on Missionaries & Cannibals -(0,2,1) [2 cannibals cross L  R] +(0,1,1) [1 cannibal crosses R  L] -(0,2,1) [2 cannibals cross L  R] +(0,1,1) [1 cannibal crosses R  L] -(2,0,1) [2 missionaries cross L  R] +(1,1,1) [1 cannibal & 1 missionary cross R  L] -(2,0,1) [2 missionaries cross L  R] +(0,1,1) [1 cannibal crosses R  L] -(0,2,1) [2 cannibals cross L  R] +(1,0,1) [1 missionary crosses R  L] -(1,1,1) [1 cannibal & 1 missionary cross L  R] This is an optimal solution (minimum number of crossings). Would Depth-first work? 
  • 35. Breadth-first search on Missionaries & Cannibals Expanded 48 nodes Depth-first search on Missionaries & Cannibals Expanded 30 nodes (if repeated states are checked, otherwise we end up in an endless loop) 