Complex Systems, Spring 1998
Bio 367: Computational Models of Biological Organization
CS 246: Programming Paradigms


Paul Grobstein, Bryn Mawr College Department of Biology
Clare Congdon, Bryn Mawr College Computer Science Program
______________________________________________________________________

Lab 8: Working with Genetic Algorithms

Your work with neural nets has no doubt convinced you that the ability to adapt gives a computer system a great deal of problem-solving potential, allowing relatively simple mechanisms to find solutions to complex problems.

This week, we will look at another form of adaptation, using another approach that is inspired by a biological process. Genetic Algorithms model a solution to a problem as a bit string (a series of 1's and 0's) that exists in a population of other bit-string solutions. The population is then allowed to "evolve": solutions "mate" with other solutions to produce new solutions, and there is a selection pressure (called the fitness function) towards better solutions to the problem. Over a series of "generations", the population contains better and better solutions.

The assignment: Read the Scientific American articles by Holland and Riolo. We will be working with a program called "sa2", written by Riolo as an accompaniment to the article.

Alas, this is not as "user-friendly" software as the tlearn package, so you will have to read the instructions for using sa2, and spend some time familiarizing yourself with how you interact with the software. This is entirely a "command-line" interface, meaning that you have to type (correctly) one of the commands that the software is expecting, or you'll get a "huh?" type response. (We will try to ignore many of the options.)

The sa2 program has been modified for this lab, so that we can try a few different fitness functions without having to recompile the program. (You can switch functions while the program is running; see the instructions.) The four built-in functions are:

Lab exercises:
  1. Try the "all 1's" fitness function, and watch the evolution of strings
    try this with different "seeds" to the random number generator
    try this with strings of different lengths

    for beginners: pay attention to the mechanisms

  2. Try the other fitness functions:
    notice how long it takes (on average) to find the best each time
    notice how this changes as bitstrings get longer
    notice how this changes with different crossover rates and mutation rates

  3. Which is easier to find: a string of all 1's, or a string of every other 1?
    try strings of different lengths (16, 32, 64), and different seeds
    get a sense for average generation number that the max is found on

    How do you explain the difference?

  4. For programmers: write a function of your own to do something interesting (nonlinear)

    For non-programmers: play with the 8 functions -- change them, recompile the program, and run again

    How do your results differ from your intuitions?

______________________________________________________________________
Maintained by:
Clare Bates Congdon (ccongdon@brynmawr.edu)
Paul Grobstein (pgrobste@brynmawr.edu)
______________________________________________________________________