CS 4600
Introduction to Intelligent Systems
Project #3
Randomized Local Search

Numbers

Due: October 30, 2003 23:59:59 EST
Please email your code and explanations to Steve Marlowe with the subject line "cs4600 project #3". Also, be certain to include your name in your message.

The assignment is worth 6% of your final grade.

Why?

The purpose of this project is to explore local search, including some of the algorithms we ignored in the first few chapters of the textbook. It is important to realize that understanding an algorithm or technique requires more than reading about that algorithm or even implementing it. One should actually have experience seeing how it behaves under a variety of circumstances.

As such, you will be asked to implement genetic algorithms, simulated annealing and a version of the MIMIC algorithm. In addition, you will be asked to exercise your creativity in coming up with problems that exercise the strengths of each.

Naturally, all of this will be done in LISP, for reasons that are intuitively obvious, even to the most casual observer.

Read everything below carefully!

The Problems Given to You

You must implement three local search algorithms. They are:

The first two are described in detail in your textbook. The last is described in the Randomized Search / MIMIC handout.

In addition, you must implement three problem domains. They are:

Each problem is described in detail in the MIMIC handout. For the purpose of this assignment a "problem" is just a fitness function one is trying to maximize (as opposed to a cost function one is trying to minimize).

In addition to the handout, we will provide you with:

The Problems You Give Us

Finally, you must create three problem domains on your own. The first problem should highlight advantages of your genetic algorithm, the second of simulated annealing, and the third of MIMIC. Be creative and thoughtful.

What to Turn In

You must email the TA two attachments.

  1. The first is a lisp file named yourgtaccount.lisp containing functions named:

    If your LISP code contains any helper functions or variables, please suffix those functions and variables with -yourgtaccount.

    The signatures of 4p and 6p are the same:

      (defun prob (candidate T-value) ...)
    

    while the signature of kc is:

      (defun kc (candidate tree) ...)
    

    ...where candidate is the candidate solution to be evaluated. Please note: for uniformity's sake, we require that candidate be a vector (as opposed to, say, a list). You can look up how to do this and in fact you should, but it will involve a call to (make-array).

    For 4p and 6p, T-value is a parameter needed by the fitness function. For kc tree is a list of pairs of connected nodes. For example the list ((0 1) (0 2) (0 3) (1 2)) indicates that node 0 is connected to nodes 1, 2 and 3; and node 1 is connected to node 2. The graph is undirected so there is no reason to also list (1 0), (2 0), (3 0), and (2 1).

    The signatures of ga, sa and mm are the same:

      (defun alg (problem numelems numvals maxtime &rest args) ...)
    

    ...where problem is the fitness function of the problem domain, numelems is the number of elements in a candidate, numvals is the number of values that each of the elements may take (by convention a value of N indicates that an element can take on any value from 0 to N-1), maxtime is the maximum time you should allow alg to iterate (in milliseconds)--it does not count against whatever set up and completion time you need--and args would be any additional arguments that should be passed to the evalution function.

    Please note that the algorithm is not required to iterate for all of maxtime; however, if maxtime has passed, the algorithm should stop iterating and return a value. You may use the functions given to you in Project #2 to detect this condition. Also, if you are not familar with the &rest keyword in LISP, please grab a LISP book (or website) and look it up.

    Each algorithm must return a list. The first element is the number of iterations taken by the algorithm. The rest of the list contains all of the optimal solutions the algorithm found.

    An example ga function would look like:

      (defun ga (problem numelems numvals maxtime &rest args)
        ...
        (setf fitness (apply problem (cons current args)))
        ...)
    

    and might be invoked by:

      (let* ((ans  (ga #'4p 20 2 10000 9))
             (iters (first ans))
             (sols (rest ans)))
         (format t "ga took ~a iterations to find:~%" iters)
         (dolist (sol sols)
           (format t "  ~a: ~a~%" sol (4p sol 9))))
    

  2. Second, you should include a text file with an analysis of:

    Please name the text file yourgtaccount.txt with your name and gt account at the top.

Compiling code

As always you should compile your functions. See Project #2 for information on how.