Darren Lewis
CS426/BMI226/EE392K
Using LIL-GP for Genetic Programming
Downloading and installing the software
- Go to your cs426 directory on Leland AFS:
cd cs426
- Copy the files to your space:
cp -r /afs/ir/class/cs426/lilgp .
This will create a directory called lilgp in your
cs426 directory.
- Change to your new lilgp directory:
cd lilgp
You should have one file: lilgp.tar
- 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.
Dont 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:
- Compile and build with the command make.
- 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.
- 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.
- Write the code. You will need to provide five files:
- app.h - This file defines the global data structure used to pass information back and forth between files.
- app.c - Defines all the user callback functions initialization, fitness evaluation, etc.
- 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.).
- function.h - Prototypes for the functions that your genetic program will use.
- function.c - Implementation of the functions whose prototypes are in function.h.
- 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.
- 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.
- Run the code. Run your code simply by typing gp -f input.file where input.file
is the parameter file created in step 3.
- Examine the output files. LIL-GP generates a number of interesting output files for each run. They are:
- .sys general info about the run
- .gen stats on tree size and depth
- .prg stats on fitness and hits
- .bst info about current best individual
- .his history of the .bst file
- .stt unreadable version of all stats
You will want the .bst and .his files.
Hints
- Once again, there is not a lot of code to write for this assignment. In fact, two of the sample applications provided with LIL-GP are
symbolic regression of a simple function, and symbolic regression of a boolean-11 multiplexer. For problem 1, simply modify the provided
files in the "regression" directory. Not very many modifications will need to be made to solve the homework problem. For problem 2,
just modify the "multiplexer" code to work for even-3-parity. You will only need to add a few functions and change the fitness measure. For
problem 3, simply modify your working code from problem 2. Follow the "lawnmower" example for defining function sets for
automatically defined functions.
- Don't change any code in the "kernel" directory.
- We're serious about not having to write much code - just modify the existing code. There is absolutely no need to rewrite all the callback
functions in app.c. If it ain't broke, don't fix it.
- Don't change any code in the "kernel" directory.
- If you get stuck, read the documentation. It is honestly helpful, well-indexed, and very clear.
Good luck!