HOMEWORK FOUR
out 9/28, due 10/??

Informed State Space Search

This short assignment will give you a bit of experience in developing heuristics for Algorithm A and A*.

1 The DOGCAT Game

DOGCAT is a simple word game that I leared from Jeff Shrager, who was my TA when I first taught an AI course in 1980. We used it for a Lisp programming assignment.

You are given two words with the same number of letters (we will be using 3 letter words) in each, e.g. DOG and CAT. Your goal is to transform the first wod into the second 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

There are many ways to make most translations. Here is another way:

DOG => HOG => HOT => HAT => CAT

Some examples are very hard to do. Try changing WHY to ASK.

To make the problem more interesting, we will assume that there is a cost associated with using a letter as a replacement. The cost of replacing any letter of a word by A, E, I, L, N, O, R, S, T or U is 1, the cost of replacement by B, D, G, C, M, P, F, H, V, W or Y is 2 and the replacement cost for K, J, X, Q or Z is 4. For example, the following transformation has a total cost of 8:

DOG => JOG => JOT => COT => CAT

You can find a list of NNN three letter English words here.

2. What to do

Write a generic version of a DC class that solves instances of the dog_cat problem given an initial and final word using the aima code for astar search. If the initial and/or final words are not give, select them randomly from the universe of N letter words. Create subclasses DC1, DC2 and DC3 that use different Heuristic functions. DC1 should use a null heuristic, i.e. one that alwas returns zero. D2 should use a heuristic h2 that is admissable. D3 should use an admissable heuristic h3 that dominates h2.

3. An example

As an example, see simlar code for the eight puzzle: p8.py

What to hand in

Turn in your code for the two problems along with output showing them solving the standard problem for each.

Background reading

  • Python tutorial
  • Amarel, S. (1968). On representations of problems of reasoning about actions, Machine Intelligence.