This lab will look at a genetic programming program provided by Donna Meyers.
The program attempts to learn a function that takes a single variable, e.g.
f(x)
. The program is given a set of training data that consists
of the value of x
and the value of f(x)
. It creates
a population of parse trees that attempts to replicate the desired value of
f(x)
. At the end of the lifecycle, the best performing parse tree
is printed to standard out.
Perform the following steps to compile and test the code:
tar -xf gp.tar
make
cat t1 | ./gp cat t2 | ./gp cat 1.dat | ./gp cat 2.dat | ./gp cat 3.dat | ./gp cat 4.dat | ./gp
gp.cpp
and change the variable MAXTIME
.
Then recompile with make
and rerun the commands.
Each input file describes a different function. At the start of the input file is the training data in the form of:
number_of_training_examples x1 f(x1) x2 f(x2) . . . . . . xN f(xN)This is the only portion of the file read in by the program. Several of the input files have further information below the training examples that is for the benefit of the people reading the file. This may include the target function and example output. Not all input files have this additional data.