CS 188, Spring 2004, Introduction to Artificial Intelligence
Assignment 1, due 2/11, total value 5% of grade
To be done individually
 An agent is placed in an environment containing two
slot machines, each of which costs $1 to play. The expected payoffs
are p and q and the agent can play each machine as many times as it likes. Describe, in qualitative terms, how a rational
agent should behave in each of the following cases:
(a) p = 1.5 and q = 0.8.
(b) p = 1.5 and q is unknown.
(c) p = 0.95 and q is unknown.
(d) p and q are unknown.
(Hint: Remember your PEAS!)
 Let us examine the rationality of various vacuumcleaner agent functions.
(a) Show that the simple vacuumcleaner agent function described in
Figure 2.3 of AIMA2e is indeed rational
under the assumptions listed on page 36.
(b) Describe a rational agent function for the modified
performance measure that deducts one point for each movement.
Does the corresponding agent program require internal state?
(c) Discuss possible agent designs for
the cases in which clean squares can become dirty and the geography
of the environment is unknown. Does it make sense for the agent to
learn from its experience in these cases? If so, what should it learn?
 For each of the following agents, develop a PEAS description
of the task environment and characterize the environment along the
six dimensions given in lecture:
(a) Robot soccer player.
(b) Spelling and grammar assistant for Word.
(c) Autonomous Mars rover.
(d) Mathematician's theoremproving assistant.
 Give the initial state, goal test, successor function, and cost
function for each of the following.
Choose a formulation that is precise enough to be implemented.
(a) You have to color a planar map using only four
colors, with no two adjacent regions having the same color.
(b) A 3foottall monkey is in a room where some bananas are suspended
from the 8foot ceiling. He would like to get the bananas. The room contains
two stackable, movable, climbable 3foot high crates.
(c) You have a program that outputs the message ``illegal input line''
when fed a certain input file. You want to determine what line in the
input file is causing the problem.
(d) You have three jugs measuring 12 gallons, 8 gallons, and 3 gallons, and
a water faucet. You need to measure out exactly one gallon.
 Consider a state space where the start state is number 1, and the successor
function for state n returns two states labelled 2n and 2n+1.
(a) Draw the portion of the state space for states 1 to 15.
(b) Suppose
that the goal state is 11. List the order in which nodes will be visited for
breadthfirst search, depthlimited search with depth limit 3, and iterative
deepening search.
(c) Can you apply bestfirst search to this problem? What would be a good
heuristic? List the order in which nodes are visited in searching for the
goal of 11 using your heuristic.
(d) Would bidirectional search be appropriate for this problem? If so,
describe how it would work. What is the branching factor in each direction
of the bidirectional search? Does this suggest a reformulation of the problem
that would allow you to solve the problem of getting from state 1 to a given
goal state with almost no search at all?

Consider the problem of constructing crossword puzzles: fitting words into a grid
of intersecting horizontal and vertical squares.
Assume that a list of words (i.e., a dictionary)
is provided, and that the task is to fill in the squares using
any subset of this list. Go through a complete goal and problem
formulation for this domain, and choose a search strategy to solve it.
Specify the heuristic function, if you think one is needed.

Prove that if a heuristic is consistent, it must be admissible.
Construct an admissible heuristic that is not consistent.

A knight moves on a chessboard two squares up, down, left, or right
followed by one square in one of the two directions perpendicular to
the first part of the move. (I.e., the move is Lshaped.) Suppose the knight
is on an unbounded board at square (0,0) and we wish to move it to
square (x,y) in the smallest number of moves. (For example, to move from (0,0) to (1,1) requires two moves.)
(a) Explain how to decide whether the required number of moves is even or odd
without constructing a solution.
(b) Design an admissible heuristic function for estimating the
minimum number of moves required; it should be as accurate as you can make it.
Prove rigorously that your heuristic is admissible.
(c) (Extra credit) Implement the problem and your heuristic
using the AIMA code; measure and plot the required computation time as
a function of solution length for randomly generated problem instances
of increasing distance.
 On page 108 of AIMA2e, the authors define a relaxation of the 8puzzle
in which a tile can move in one step from square A to square B if B is blank.
The exact solution of this problem defines Gaschnig's
heuristic (Gaschnig, 1979). Explain why Gaschnig's heuristic is
at least as accurate as h1 (misplaced tiles), and show cases where
it is more accurate than both h1 and h2 (Manhattan
distance). Can you suggest a way to calculate Gaschnig's heuristic
efficiently?

In this exercise, we will examine hillclimbing in the context of
planar robot navigation among polygonal obstacles (as in Figure 3.22 of AIMA2e).
(a) Explain how hillclimbing would work as a method of reaching a particular
point goal.
(b) Show how nonconvex obstacles can result in a local maximum for
the hillclimber, using an example.
(c) Is it possible for it to get stuck with convex
obstacles?
(d) Would simulated annealing always escape local maxima on this family of problems?