Written Homework #1

Solutions

1. [30pts, 5 each] Consider the following AI systems. For each, write a short P.E.A.S. (Performance, Environment, Actuators, Sensors) description. For each, characterize the environment [observable, deterministic, episodic, static, discrete, multi-agent].

Recognizing Auction Fraud
================================




Recognizing Spring Thaw
=======================
P: Recognize and distinguish snow, ice, and water from space, and track changes

E: Earth, cryosphere, atmosphere, satellite

A: Direct camera, take pictures, relay findings

S: Camera images, guidelines from scientists

Partially observable (the whole cryosphere is not always visible), stochastic, sequential, dynamic (although the evironment may change so slowly that you could argue it's nearly static), continuous, single-agent


Poker
=====


Detecting Cancer
================
P: Detect cancer, minimize false positives and false negatives

E: Patients' blood samples

A: Confirm or disconfirm

S: Scan proteins for patterns

Partially observable, stochastic, episodic, static, continuous, single-agent


Tackling Forest Fires
======================

 

Creating Art
======================

 

2. [10 pts] DOGCAT is a simple word game which you may have seen before. The player is given two words with the same number of letters (we will be using 3 letter words) in each. For example, DOG and CAT. He or she has to change the first word into the second (or goal) word by replacing one letter at a time with any other letter as long as the result is a proper English word. For example, we could change DOG to FOG but not to GOG (not a proper English word) or to GOD (two letters were changed). Thus, one way of getting from DOG to CAT might be: DOG => COG => COT => CAT. TO make it more interesting, if you replace a letter with a vowel it costs 2 points, otherwise it costs 1 point. Represent this as a search problem. What will a ``state'' be? What's the initial state, successor function, goal test, path cost?

State: a string ("DOG", "COG",...)
Initial state "DOG"
Sucessor function: for each letter in the current state, change it to each of the other 25 letters. Check the result with an english dictionary and keep the sucessors that pass the dictionary check.
goal test: that the state is string equal to "CAT"
path cost: 1 for change letter to consonant, 2 for changing letter to a vowel.

3. [10 pts] One famous AI problem is to find the possible molecular structures of known constituent atoms that match mass spectroscopic analysis data. This is called the ``structure-elucidation problem''.
This is a big problem in organic chemistry—you can easily find out the constituent atoms (i.e. the chemical formula, such as C6H12O4but these same 22 atoms can be arranged in many many ways to make different molecules, and the different arrangements matter a great deal. You can write the most important parts of the arranged structure by writing each atom as being connected to one or more of the others above, below, left, or right by a single or double bond (this is a simplification, of course). For example one arrangement of C3O3H3is:

H H
| |
C=O-C-O=C
|
O-H

The best information about the arrangement of the atoms is obtained by using a mass spectrometer (and other similar equipment). The mass spectrometer breaks apart the molecule and creates a histogram of particles of various masses. For example, the molecule above might have a mass spectrogram with 2 particles of mass 4, 18 particles of mass 7, 8 particles of mass 10, etc.

Assume you have a fast mass spectrogram computer simulator, which takes as input a chemical structure file like the ASCII picture above, and returns the mass spectrogram. You also have the actual mass spectrogram from the real substance. Now, characterize the structure-elucidation problem as a search problem. What will a ``state'' be? What's the start state, goal test, and operators?

HINT: Make SURE you understand what the goal test is for this problem.... The last paragraph is very important. Warning: I gave you more information that you really needed....

Intitial state: empty structure (or, with some constituent atoms or all the constituent atoms unconnected in the initial structure is also acceptable.)

Operator: add a single constituent atom to the structure with a single or double bond. The constraints are that the vacancy of the element should be satisfied with the linking bond.

Goal state: no constituent atoms left unconnected to the structure and the simulated histogram of the ASCII arrangement matches the histogram created from the spectrometer for the real molecule.

4. [20 or 10 pts] Consider that you have to color a map of Australia with only four colors in such a way that no two adjacent regions have the same color. 

Set up a state space search formulation for this that is precise enough to be implemented:

  • [5 pts] give the state and initial state description as a data structure and constant (any language)
    a state might be a list of colors representing the 7 Australian states. To be a little more general in Lisp you might use an assoc list of the Australian Name and Color. Initially no state is colored.

    (defconst *start*
      '((WA nil) (NT nil) (SA nil) (Q nil)
        (NSW nil) (V nil) (T nil))

     
  • [7 pts] give a goal test on states as some test on the data structure
    (defconst *constraints*
       '((neq WA NT) (neq WA SA) (neq NT SA) .....))
    (defun neq (x) (not (eq x)))
    (defun get-color (name state)
       (second (assoc name state)))
    (defun check-constraint? (constraint state)
       (apply (first constraint)
           (get-color (second constraint) state)
              (get-color (third constraint) state)))

    (defun goal? (state)
       (apply #'AND
          (mapcar #'(lambda (constraint)
                      (check-constraint?
                          constraint state))
                  *constraints*)))

     
  • [8 pts] define a sucessor function that takes a state and returns a list (or whatever) of the sucessor states in your formulation
    (defconst *colors* '(red blue green yellow))
    (defun expand (state)
       ;find first region with NIL color
       (let ((region (car (rassoc NIL state)))) 
          (mapcar #'(lambda (color)
                       (substitute (list region color)
                                   (list region NIL)
                                   state :TEST                                    #'EQUAL))
                  *colors*)))

grads: 10 pts. The straightforward solution here generates a tree with 7!(47) leaves, if drawn out completely. Formulate the problem as above so that the complete tree has only 47 leaves.

The idea is that the path doesn't matter---only the solution does. Coloring NSW blue and then Tasmania red is the same as coloring Tasmania red first and then NSW blue. The code above does this.

5. [30 pts, 10 each] After a football game, you are trying to get from South Campus back up to the Laird Campus with your pet golden fox, your pet blue hen, and a bushel of blue corn. The UDel bus rules only allow you to carry one pet with you at a time, and the bus drivers won't allow you to bring anything else with you when you carry that bushel basket of corn. Sad to say, while you love your pets, your fox would, if left to its own devices, devour your blue hen, and your hen would devour your blue corn if possible. Fortunately, you now know several blind search methods to calculate a sequence of steps that will get all four of you across campus undigested.

 

  • Formulate this as a search problem. What are the states, operators, goal test, path costs?
  • Of breadth- and depth-first search, which is guarenteed to find a safe plan in the fewest number of bus trips? Assume you do not check whether a node has been previously explored in the tree.
  • Trace the search tree produced by the method you named above. (you don't have to expand redundant nodes)

States: location of the 4 actors [You, Fox, Hen, Corn] in either South or Laird campus. Initial State: [YFHC---]. Goal State: [----YFHC]. Operators: Take-Bus-South(You, X), Take-Bus-North(You, X). (or, just one bussing operator that shuttles you and an optional pet to the other side). Path Cost: 1.

If you do not check for repeated states, depth first search may get caught in an infinite loop (take-bus-north(you,hen); take-bus-south(you,hen); take-bus-north(you,hen); ...) Therefore only breadth-first search is guarenteed to find a safe plan. Because the path cost is 1, breadth-first-search is also guarenteed to find an optimal plan.

end