Exam 2

Exam 2
Choose 1 topic.
Choice 1: Prolog (A control algorithm for state space search)
Write a prolog program that implements the water jug problem. You will find the water jug problem
described on slides 6-8 on the presentation in the presentation, State Space Search Chapter 3, Part 1.
Your program will have (at least) these two predicates:
To run the program, the user will enter the predicate go(X,Y). X holds the final contents of the 4 gallon
jug and Y holds the contents of the 3 gallon jug. It is assumed that both jugs are empty to start. Your
program will display all paths to the solution. Thus, go(2,0) will display something like
buckets(4,0)
buckets(1,3)
buckets(1,0)
buckets(0,1)
buckets(4,1)
buckets(4,3)
buckets(0,3)
buckets(3,0)
buckets(3,3)
buckets(4,2)
buckets(0,2)
buckets(2,0)
plus other solutions corresponding to a press of the semicolon key (;).
Present your work to the class.
Choice 2: The Genetic Algorithm (An experiment)
You will find in /home/share/cpsc327_students /GA a working GA, in fact, a version of the GA you read
about in the assigned chapter on the class website.
The GA is particularly interesting for computationally intractable problems. One of the best-known of all
intractable problems is known as the Travelling Salesperson problem (The Hamiltonian Circuit Problem
to mathematicians). Given a set of cities (or points on a graph) and known distances between each city,
find the shortest tour from a designated starting city through all other cities and back to the starting
city. It is often argued that certain pairing algorithms, especially stochastic algorithms, perform better
than simple pairing of the type used in the code that is given. Your job is to conduct an experiment—
with your pairs—to find out just which one works best.
Here are the specs:
Notice that class WordGuess inherits from GA. Write an analogous class TSP that also inherits from
WordGuess.
1. Rewrite class Mate so that ordered crossover as described in Luger is added as a method.
2. Add a Mutate method to TSP that overrides the Mutate method in GA. Use the following
algorithm, known as reciprocal exchange:
a) Randomly choose a chromosome (i.e., a tour) to mutate
b) Randomly choose two cities, A and B, within the tour
c) Exchange the positions of cities A and B within the tour
To clarify, the mutation factor refers to the number of pairs of cities within a chromosome to
exchange. Suppose we have 64 chromosomes and a 15 city tour. That gives us 960 genes (i.e. ,
cities). A mutation factor of .01 is 9.6, which we round up to 10. In this case randomly choose
10 chromosomes and exchange 2 cities within each chromosome.
3. Rewrite Pair to use random and stochastic selection of the mating population. Truncation is
already in place.
4. Add these pairing algorithms to the top-down algorithm already in place:
a. Random pairing
b. Weighted random pairing
c. Tournament
5. For each of the three selection algorithms , each of the four pairing algorithms, and for mutation
factors of .01, .1 and 1% gather data about the performance of your system. You should have a
table with 36 entries, ranked from best to worst.
6. Use the data found here: Florida Mileage Chart. Imagine you are an IT manager at UPS. Your
task is to find a near-optimal tour beginning and ending in Boca Raton. Your tour will pass
through all cities on the chart from Clearwater to Orlando.
7. Write a method for TSP, GetData, that will read the mileage from the florida mileage chart into a
data structure of your choice.
8. Change nothing else.
9. Present your results to the class.
Choice 3: Automatic Theorem Proving (An exploration)
This choice is more exploratory than the previous two. Otter, developed at the Argonne National
Laboratories has been replaced by Prover9 and Mace4. These are now maintained at the University of
New Mexico.
1.
2.
3.
4.
Download/install Prover9-Mace4 http://www.cs.unm.edu/~mccune/mace4/
Learn how to use it
Run it on one of the many examples given on the website. Consult with me on this.
Present your results to the class
5. This examination offers three choices. One is a programming assignment. The second is a
carefully written research paper that must follow AAAI standards . The third is choice 3 from
exam 2.
Choice 4: Perceptron
The single layer perceptron, as we know, crashed with XOR. Nevertheless, it’s remarkable how a
simple learning algorithm could work as well as it did. Build the perceptron described in Luger, pp.
458-564. It should function much like the perceptron shown in class to solve logic problems in two
variables. To make thinks simple, pre-store the tables for AND, OR, NAND. The perceptron asks the
user:
1. Which problem of the three to solve
2. The learning rate
3. The number of iterations
It then trains itself using the rule for weight adjustment found on p. 458, outputting, at the end, the
weights for each input.
It then outputs each input and corresponding logical relationship like this:
X=0
Y=0
X NAND Y = 1
It follows this with the three others that define the function in question.
You could also, of course, do this with a GUI.
Choice 5: Research Paper(HMM, clustering, support vector machines)
1. Write research paper on an application described in AI Magazine that uses a hidden markov
model, clustering techniques, or a support vector machine. You must have at least five
references drawn either from peer-reviewed conferences or journals or books.
2. The paper must be 4 – 6 pages long, including references. It also must be in AAAI format. If
your submission is not in AAAI format, C is the highest grade you can receive. I have put an
MS-Word file containing AAAI specifications on the class website.