Please change directory to 'PERLGP_BASE/demos/pi' and look at the README file before running this demo.
Find a integer arithmetic approximation to , for example 3 + 1/7
Arithetic operations allowed: plus, minus, multiply and protected division
Integers allowed: 1,2,3,5,7
Fitness function: absolute error from defined as 2*atan2(2,0) (small is good)
In this case the training and testing data structures (TrainingData, TestingData), and the output from evaluateOutput() are simple scalar numbers. Usually, as discussed in Section 2.4, they would be scalar references to larger data structures. There is no input variable in this situation (unlike the more familiar regression problem). There is also no meaningful concept of ``testing''; because no data is sampled, there can also be no out-of-sample data. Hence loadSet() returns just the ``true'' value of pi for both training and testing instances. This value is only accessed by fitnessFunction() of course, not by the evolved code.
There's not much more to explain, except of course that when the fitness reaches around 1e-15 it can go no further because the limit of double precision floating point numbers has been reached.
In this example, self-adapting mutation and crossover probabilities (NodeMutationProb and NodeXoverProb) are used. You can follow the evolution of these attributes with the gnuplot script plot-evparams.gp.