CS 470 Artificial Intelligence
Winter 2003, Instructor: Jeffrey Horn NAME: _______________________
HOMEWORK 2: Stimulus-Response
(S-R) versus Finite State Machines
Handed out/Assigned: | Tuesday, March 11, 2003 |
VEHICLE:
Let there be two input bits from the left and right sensors pictured (LS and RS): a "01" input vector (left sensor, right sensor) would mean something detected to the right, but nothing center or left, while "11" would mean something in the center (or something left and right!). Also assume a finite detector range, defined by an arc (not shown above) with its center at the robot's center.
Let there be a third sensor, "GO", (not shown) which indicates whether the object detected (if any!) is a Goal or an Obstacle (hence the name GO). Let us say you are seeking light sources, but avoiding obstacles, and you have these two combo detectors, LS and RS, that can detect both obstacles and light sources (if a detector detects both, it will register only the closest, so note that ONLY ONE OBJECT WILL BE DETECTED AT ANY ONE TIME!). The detectors will use the GO bit to indicate whether the nearest detected object is a light source (GO == "1") or an obstacle (GO == ")"). Note that if no obstacle is detected, then the value of GO is meaningless.
|
OUTPUTS | |||
GO |
LS |
|
|
RM |
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
FINITE STATE MACHINE: Now let's see if we can improve on the S-R behavior above by increasing the computational power of your brain. Let us add memory, two bits worth: M0 and M1. You can think of these as internal sensors that detect the state of two "internal environment" sensors. Furthermore, you can change of the state of these two bits each time step. Thus the state of the variables M0 and M1 in the INPUTS column below was read at time t, then the you specify the outputs M0 and M1 to be read in at time t+1 (i.e., the next time the truth table is read).
(2) FSM: Fill in a truth table for the same goal-seeking, obstacle-avoiding strategy as in (1) above, but now trying to take advantage of the "two-bit" memory you have!
INPUTS |
OUTPUTS |
||||||||
Num10 |
M0 |
M1 | GO |
LS |
RS | LM | RM | M0 | M1 |
0 | 0 | 0 | 0 | 0 | 0 | ||||
1 | 0 | 0 | 0 | 0 | 1 | ||||
2 | 0 | 0 | 0 | 1 | 0 | ||||
3 | 0 | 0 | 0 | 1 | 1 | ||||
4 | 0 | 0 | 1 | 0 | 0 | ||||
5 | 0 | 0 | 1 | 0 | 1 | ||||
6 | 0 | 0 | 1 | 1 | 0 | ||||
7 | 0 | 0 | 1 | 1 | 1 | ||||
8 | 0 | 1 | 0 | 0 | 0 | ||||
9 | 0 | 1 | 0 | 0 | 1 | ||||
10 | 0 | 1 | 0 | 1 | 0 | ||||
11 | 0 | 1 | 0 | 1 | 1 | ||||
12 | 0 | 1 | 1 | 0 | 0 | ||||
13 | 0 | 1 | 1 | 0 | 1 | ||||
14 | 0 | 1 | 1 | 1 | 0 | ||||
15 | 0 | 1 | 1 | 1 | 1 | ||||
16 | 1 | 0 | 0 | 0 | 0 | ||||
17 | 1 | 0 | 0 | 0 | 1 | ||||
18 | 1 | 0 | 0 | 1 | 0 | ||||
19 | 1 | 0 | 0 | 1 | 1 | ||||
20 | 1 | 0 | 1 | 0 | 0 | ||||
21 | 1 | 0 | 1 | 0 | 1 | ||||
22 | 1 | 0 | 1 | 1 | 0 | ||||
23 | 1 | 0 | 1 | 1 | 1 | ||||
24 | 1 | 1 | 0 | 0 | 0 | ||||
25 | 1 | 1 | 0 | 0 | 1 | ||||
26 | 1 | 1 | 0 | 1 | 0 | ||||
27 | 1 | 1 | 0 | 1 | 1 | ||||
28 | 1 | 1 | 1 | 0 | 0 | ||||
29 | 1 | 1 | 1 | 0 | 1 | ||||
30 | 1 | 1 | 1 | 1 | 0 | ||||
31 | 1 | 1 | 1 | 1 | 1 |