EECS 391/491: PROBLEM SET #2 SOLUTIONS
by M.S. Branicky


Problem 2.1 [10 points]

(c) Autonomous Mars Rover
      P: territory explored, lifetime, samples collected, data communicated home
      E: Martian surface, communication channel back to Earth
      A: wheels, sample tools (arm, shovel, etc.) , transceivers, move antennas/solar panels
      S: cameras, distance, speed, acceleration, orientation, temperature, lights, chemicals, water

(d) Theorem-proving assistant
      P: number of theorems proved, conciseness (min. steps) of proofs, time for proofs
      E: axioms, number theory, rules of logic and deduction, existing theorems and proofs,
         proof techniques (contradiction, induction, pigeon-hole principle, ...)
      A: display proof steps, logic, source of citations
      S: keyboard/mouse entry
The above is due to Aaron Cederquist, Phil Alverson, and myself.

Problem 2.2 [10 points]

(c) Autonomous Mars Rover: partially obs, stochastic, sequential, dynamic, continuous, single-agent
(d) Theorem-proving asst.: fully obs, deterministic, episodic*, static, discrete, single-agent*
* Could be argued the other way

Problem 2.3 [10 points]

In general, there are |A||P| S/R agents. This is because each possible percept is a row in the LUT and there are |A| choices for each row.

The vacuum-cleaner agent in Figure 2.2 and described on page 36 has actions A={Right, Left, Suck, NoOp}, so |A|=4. It has P={A,B}x{Clean,Dirty}, so |P|=4. Thus, there are 44=256 different S/R agents possible.

Problem 2.4 [10 points]

My state machine (C=caterpillar):
DigBurrow
   |
   | [burrow done]
   v
GoOut/FindC
   |
   | [C found]
   v
StingC
   |
   | [C subdued]
   v
DragCtoNEst <--------|
   |                 |
   | [C at nest]     |
   v                 |
CheckBurrow          | [C not present]
   |                 |
   | [burrow OK}     |
   v                 |
GoOutside ------------
   |
   | [C present]
   v
DragCInside
   |
   | [C inside]
   v
LayEggs

Problem 2.5 [10 points]

The following two agents both tend to circle at a fixed distance:

Problem 2.6 [10 points]

Note that in my circuit I stimulated both reciprocal elements at once to ensure that each is firing at all instants. Other solutions are possible.

Problem 2.7 [10 points]

 t |   s_t   v_t   w_t   x_t   y_t   z_t
===+=====================================
 0 |    1     0     0     0     0     0
 1 |    1     1     1     0     0     0
 2 |    1     1     0     1     0     0
 3 |    0     1     0     0     1     0
 4 |    0     0     0     0     0     1
 5 |    1     0     0     0     0     0
 6 |    1     1     1     0     0     0
 7 |    1     1     0     1     0     0
 8 |    0     1     0     0     1     0
 9 |    -     0     0     0     0     1

Note that the output z does "fire" as advertised (there is the requisite a delay after the required pause). I computed the above using the Matlab program below. I show it because it solves the problem using a matrix formulation you might find interesting:

Outputs=[0 0 0 0 0],
Threshs=[1 1 2 2 1];
Weights=[ ...
   0 -1 0 0 0; ...
   0  0 1 0 0; ...
   0  0 0 1 0; ...
   0  0 0 0 1; ...
   0  0 0 0 0];

for s=[1 1 1 0 0 1 1 1 0],
  Outputs=(Outputs*Weights+[1 1 1 1 -1]*s)>=Threshs,
end;

Problem 2.8 [10 points]

I wrote the following Matlab program simulator, which encodes my S/R agent:
% NOTE: A=1, B=2; Clean=0, Dirty=1; Actions: Left=1, Right=2, Suck=3

% all 8 environments
envs=[0 0 1; 0 1 1; 1 0 1; 1 1 1; 0 0 2; 0 1 2; 1 0 2; 1 1 2];

P=zeros(1,8);
for e=1:8,
  % initialize environment
  env=envs(e,:);
  for t=1:1000,
    % compute performance measure
    P(e) = P(e) + (env(1)==0) + (env(2)==0);

    % compute percept
    Percept=[env(3) env(env(3))];

    % compute agent function
    if Percept==[1 1], Action=3; end;
    if Percept==[1 0], Action=2; Loc=2; end;
    if Percept==[2 1], Action=3; end;
    if Percept==[2 0], Action=1; Loc=1; end;

    % update environment
    if Action==1, env(3)=1; end;
    if Action==2, env(3)=2; end;
    if Action==3, env(env(3))=0; end;
  end;
end;
P
avgP=mean(P)
The output was as follows:
P =   2000    1998    1999    1996    2000    1999    1998    1996

avgP = 1998.2

Problem 2.9 [10 points]

  1. No, because any S/R agent that cleans all squares must continually move back and forth forever. State is required to solved the problem without infinite negative cost.
  2. A reflex agent that has state can be optimal. Here is one with two states:
    [PerceptDimension1, PerceptDimension2, State]: Action, NextState
    
    [A,Dirty,0]: Suck,  0
    [A,Dirty,1]: Suck,  1
    [A,Clean,0]: Right, 1
    [A,Clean,1]: NoOp,  1
    [B,Dirty,0]: Suck,  0
    [B,Dirty,1]: Suck,  1
    [B,Clean,0]: Left,  1
    [B,Clean,1]: NoOp,  1
    
    The state represents whether you have moved or not (which is equivalent to whether the other square is clean given other table entries).
  3. In this case, there is a rational S/R agent with no internal state, as follows:
    [A, AClean, BClean]: NoOp
    [A, ADirty, *     ]: Suck
    [A, AClean, BDirty]: Right
    [B, AClean, BClean]: NoOp
    [B, *     , BDirty]: Suck
    [B, ADirty, BClean]: Right
    
    * denotes "don't care"; so the action is done regardless of this dimension's reading
    


Created: 2008-02-05. Modified: 2008-02-05.