AI Lecture 04
AI Lecture 04
Search… (continued)
Lecture 4
• Short quiz
Problem 3.6b
Given a complete problem formulation for each of the following. Choose a
formulation that is precise enough to be implemented.
A 3-foot tall monkey is in a room where some bananas are suspended from
the 8-foot ceiling. He would like to get the bananas. The room contains
two stackable, movable, climbable 3 foot-high crates.
Initial state: As described (monkey, bananas suspended from ceiling, 2 crates
on the floor in a room)
Goal state: Monkey has bananas.
Successor Hop on crate, hop off crate, move/push crate, place crate on top of a
function: stack of crates, walk from a spot to another spot, grab bananas.
Cost function: Number of actions.
Problem 3.6d
Given a complete problem formulation for each of the following. Choose a
formulation that is precise enough to be implemented.
You have three jugs, measuring 12 gallons, 8 gallons, and 3 gallons, and a
water faucet. You can fill the jugs up, empty them out from one to another
or onto the ground. You need to measure out exactly one gallon.
Initial state: Jugs empty [0, 0, 0]
Goal state: [x, y, 1] or [x, 1, z] or [1, y, z] (if too many states, we could state as
one of the 3 jugs has exactly 1 gallon of water)
Fill([x, y, z],(1 || 2|| 3)) → [12, y, z] or [x, 8, z] or [x, y, 3]
Successor Empty([x, y, z], (1 || 2 || 3)) → [0, y, z] or [x, 0, z] or [x, y, 0]
function:
Transfer (x,y) transfer the contains of y into x until either y is empty OR
x is at capacity.
Cost function: Number of actions.
Properties of Breadth-first Search (BFS)
Problems:
• If the path cost is a non-decreasing function of the depth of the goal node, BFS is optimal
(uniform cost search a generalization).
• A graph with no weights can be considered to have edges of weight 1, in this case, BFS is
optimal.
• BFS will find the shallowest goal after expanding all shallower nodes (if branching factor
is finite). Hence, BFS is complete.
• BFS is not very popular because time and space complexity are exponential (with respect
to d).
• Memory requirements of BFS are a bigger problem.
Time and Memory Requirements for BFS
Depth Nodes Time Memory
2 110 .11 milliseconds 107 KB
4 11,110 11 milliseconds 10.6 MB
6 106 1.1 seconds 1 GB
8 108 2 minutes 103 GB
10 1010 3 hours 10 TB
12 1012 13 days 1 PB
14 1014 3.5 years 99 PB
16 1016 350 years 10 EB
For a branching factor of b = 10; 1 million nodes/second and 1,000 byte nodes.
Properties of Search Strategies
Optimal? No