Darren Lewis

Using LIL-GP for Genetic Programming

Downloading and installing the software

  1. Go to your cs426 directory on Leland AFS:

    cd cs426

  2. Copy the files to your space:

    cp -r /afs/ir/class/cs426/lilgp .

    This will create a directory called lilgp in your cs426 directory.
  3. Change to your new lilgp directory:

    cd lilgp

    You should have one file: lilgp.tar
  4. Uncompress with the following command:

    tar -xvf lilgp.tar

    You should now have a directory called lilgp1.1. Under this directory you only need to deal with the following subdirectories:

    1.1: This directory contains all the code and samples.
    htmlMan: This directory contains all the documentation.

    Don’t worry about the others.

Where to start

Now that you have the code, you might be wondering how to begin. I recommend browsing through the documentation first, because it is actually very clear and well-indexed. If you would like to look at the documentation from Windows, either use WS_FTP to copy the files from your AFS space back to your personal computer, or download the documentation directly from here.

Running the samples

After you have read through some of the documentation, you will want to ensure that you have installed everything properly. Five samples are provided, and are located in the app subdirectory. Run a sample by doing the following:
  1. Compile and build with the command make.
  2. Run with the command gp -f input.file.
Try running the regression problem first. It should take a few minutes to run - this is normal. If you cannot run this sample, there might be a problem with your installation. Fix this before continuing.

Implementing a problem with LIL-GP

There are a number of steps that must be taken to implement a problem with LIL-GP.
  1. Create a tableau for the problem. If any questions arise about terminology, see Genetic Programming (Koza 1992) Chapters 6 and 7, because LIL-GP was modeled after the format of genetic programming described in this book. For those of you who are wondering, that's the fat textbook.
  2. Write the code. You will need to provide five files:
    1. app.h - This file defines the global data structure used to pass information back and forth between files.
    2. app.c - Defines all the user callback functions – initialization, fitness evaluation, etc.
    3. appdef.h - This file contains two #defines: MAX_ARGS, and DATATYPE.
      MAX_ARGS: Maximum number of arguments your functions will take.
      DATATYPE: Type that all of your functions will return (ex: double, int, etc.).
    4. function.h - Prototypes for the functions that your genetic program will use.
    5. function.c - Implementation of the functions whose prototypes are in function.h.
  3. Create a parameter file for the run. For the sample applications that are provided, the parameter file is named input.file. You can modify these files to suit your problems. For more information about the extensive array of parameters that can be set, please refer to the documentation.
  4. Build and compile the code. Just type make from the directory where your files are. If there is a compile or link error, it will alert you at this step. Fix these errors before continuing.
  5. Run the code. Run your code simply by typing gp -f input.file where input.file is the parameter file created in step 3.
  6. Examine the output files. LIL-GP generates a number of interesting output files for each run. They are:
  7. You will want the .bst and .his files.


Good luck!