 |
CS 371 - Introduction to Artificial Intelligence
Homework #3 |
Due: Thursday 9/23 at the beginning of class
Note: Work is to be done in pairs
Stochastic Local Optimization
1. The Channel Routing Problem (CRP):

For this exercise, you'll be given an Annealable class by C.S.
major and salutatorian David Hettlinger '04 from his research of summer 2002. This
class implements a complex combinatorial optimization problem concerning
VLSI circuit design. For this "Channel Routing Problem", horizontal
and vertical wires are on opposite side of and connected through a silicon
wafer. We seek to find a wiring layout between pins with corresponding
numbers that minimizes the number of necessary horizontal tracks.
All implementation of the Annealable interface is supplied for
you. Your task is to implement and collect data on optimization performance
with 10000 iterations for:
-
iterative improvement with 0%, 10%, 20%, 40%, and 100% uphill step acceptance,
and
-
simulated annealing with an initial temperature of 70 and a temperature
decay of .95 per iteration.
Construct each initial CRP state with "new CRState4("dde.txt")".
All other interaction with this class will be according to the Annealable
interface. Record the final energy (i.e. channel width) for each
optimization run, and perform a minimum of 3 runs for each method/setting
above (i.e. minimum 18 runs total). We will share results for this
problem on Tuesday 9/21 in class.
2. Choose Your Own Optimization Adventures: Implement
2 of
the 3 following problems using the Annealable interface and write a test program
that demonstrates the effectiveness of one of our stochastic local optimization
techniques for the problem. (If there are other optimization problems you
would like to try, please see me.) Print the energy of the minimum energy
state at intervals during and at the end of the optimization. Limit the
time for each run to 1 minute. You'll want to use even shorter runs as you
develop, test, and debug.
- Scheduling Problem: Apply simulated annealing
to the following problem: Given a number of students wishing to take
a number of classes which can be assigned to a number of time slots, assign
classes to time slots in such a way as to minimize schedule conflicts.
You will create a class SchedulingProblem which implements Annealable.
Its constructor will take a number of students, the number of classes a
student takes, a number of classes offered, and a number of time slots
(e.g. 240 students with 5 classes each, 100 classes offered, 12 time slots).
Each randomly generated instance of the problem will associate each student
with the given number of different random classes. Each class will
be associated with a random time slot. For the purposes of the Annealable
interface, next causes a class to be randomly reassigned to a different
time slot. Energy is the sum of the student conflicts. The
number of conflicts for a student is the number of their classes they cannot
attend given the current schedule. (For the example above, if all
of a student's classes are scheduled at the same time, the student has
4 conflicts.) With parameters that generate problems which will likely not have a
zero-conflict schedule, demonstrate the performance of simulated annealing
versus iterative improvement with only downhill steps.
- Traveling Salesman Problem with River: (From "Numerical Recipes in
C" by Press et al) Uniformly and randomly distribute n points
(i.e. "cities") within a unit square. Represent a circuit (or "tour") of
these cities as a permutation in an appropriate list data structure.
(Assume that one returns to the first city after visiting the last city.)
Compute the "energy" of a tour state as the total distance of the circuit plus
a fixed cost for each time the tour crosses a north-south "river" which
divides the square vertically in half. The initial state constructor
should take n as a parameter. Graphically display the solution,
with tour lines in black and the river line in blue. Hint:
Generate each next state by taking a random segment of the tour and reversing
the order (e.g. ABCDEF -> ADCBEF or ABCDEF -> FECDBA).
In doing so, one need not recompute the cost of the whole tour, but only
the paths that have changed.
- Tree Planting Problem: Suppose one has n trees and an plot
that is circular in which the trees should be planted. Further suppose
that it is desired that the trees should have maximal separation from each
other and from the borders of the plot. Construct the initial state with
n trees positioned randomly. Compute the next state by taking a
single tree and moving it by a small amount randomly (e.g. according to a
small Gaussian distribution; see java.util.Random.nextGaussian()). If a
tree moves outside of the plot, move it to the closest point within the plot.
Experiment with different energy function choices. For each tree,
compute the minimum distance to the plot borders and all other trees.
Then have the energy function return some function of these distances (e.g.
the negated minimum, the mean, etc.). Which energy function gives you the most
satisfactory result? Graphically display the solution, showing the plot
outline, and the trees as filled green circles with radii being the minimum of
all the minimum distances.
Hopefully, in looking at these problems, you'll see the wide applicability of
such optimization algorithms. Often, the most challenging aspect of such
optimization is devising a good, efficient next state generator that gives
beneficial structure to the state space, rather than merely bouncing randomly
from one state to another. Good next state generators both allow one to
traverse the entire state space, and immediately sample states that are similar
in quality to the current state.
Todd Neller