CS 371
Introduction to Artificial Intelligence
Homework #3
Due: Tuesday 9/19
Iterative Improvement: For this assignment, your challenge problem
will be to apply iterative improvement techniques to the constraint
optimization problem of class scheduling. You will first need
to download the class definitions in folder csp
of the class code repository. HTML browsable
documentation is in the doc folder
of csp.
new ClassSchedulingProblem(240, 5, 100, 12, 10.0) creates a new class
scheduling problem with 240 students, each taking 5 classes of 100 offered,
with classes being assign to one of 12 time slots. The first class
probabilistically will have 10.0 times the enrollment of the last class.
Students, classes, and time slots are represented as integers starting
with zero.
Your task is to implement two approaches to this problem from the choices
below. In addition, a steepest ascent approach is included with assignment
code. Compare each algorithm for average case behavior on randomly
generated problems with the parameters given above. At least one of your
two approaches must have a (*) to the right of its name:
Random Walk (Descending) with Random Restarts, % Ascending Moves
Accepted, or both: This need not be so computationally intensive
as the steepest descent approach supplied. In that approach, all
possible single class time slot changes are examined. For this approach,
you need only randomly generate a single possible change, evaluate it,
and decide whether to accept it as a next step. Random restarts are
random reassignments of class times at regular intervals (e.g. after 1000
steps). If strictly descending, refuse any "uphill" steps.
Alternately, you can choose to accept some small percentage of uphill steps.
Try a variety of parameter choices and try to achieve the best possible
behavior within about a minute of computation on triton at normal load.
Simulated Annealing(*): This is similar to hill descent with % random
moves. C code listings and documentation will be provided as an aid.
There is also pseudocode in our text. Experiment with different annealing
schedules. Simulated annealing with a fast annealing schedule is
called "simulated quenching" and is similar to hill descent with variable
% ascending moves and random restarts.
Genetic Algorithm(*): Encoding is simple for this problem.
An array of class time assignments serve as the "gene". The fitness
of the gene is the number of conflicts. Crossover and mutation are
similarly easy to define. Seek help if you need help in these design
decisions.
Required for grading:
Include a README file with honor pledge, name, student id#, and a description
of your implementations.
Each implementation should accept two integers from the command line:
number of trials run on a single problem generated with an...
initial random seed for ClassSchedulingProblem random number generator
rng
Each trial should run for no longer than one minute on triton under normal
load.
Each trial should print a line with a trial number (starting with 0) and
the final number of schedule conflicts. After completion of the trials,
print a line with "Average: " and the average schedule conflicts from each
trial result.
Describe the formal definition of a Constraint Satisfaction Problem (CSP)
as described in your readings. How does a constraint optimization
problem such as our Class Scheduling Problem differ from a CSP such as
a map coloring problem?
A CSP can be thought of as a search problem. How are CSPs different
from a search problem such as TripleCross? (Hint: What are we seeking
to have the search show us for each problem? Generalize the difference
in abstract terms.)
What is node consistency? What is arc consistency? How and
why would you enforce such consistency in solving a CSP?