There are four steps involved when putting together the instances necessary for a VUWLGP run. They should be carried out in the order given below, and are each quite simple.
The values of the variables in a configuration object can either be specified on the command line or hard-coded into the application itself (in the current version these two can't really be mixed - this will be fixed in the next version). The template type of the config object should be the type of the registers in this run.
Once the configuration object has been created if the seedSpecified
of it is true then the Rand
namespace should be initialised with the seed in the config object, otherwise it should be initialised with a time-dependent seed.
Following the initialisation of the random number generator and the configuration objects the initial population should be created. This is done simply by creating a new instance of some IPopulation
subclass, passing to it as template parameters first the type of program out of which this population is built (itself parameterised with the type of the registers) and the type of the registers themselves as the second. Obviously the type of the registers specified for the program type and the type of the registers specified for the population itself should be the same. Unfortunately there was no way that this was possible in C++.
Creating a FitnessEnvironment
is relatively easy and involves instantiating an instance, with the type of the register as its template parameter. Individual fitness cases can then be added by either using the AddCaseFromFile
method and passing the address of the Generate
method from the right subclass of IFitnessCase
or by passing pointers to IFitnessCase
s directly to the AddCase
method. The memory for these pointers will be managed by the FitnessEnvironment
itself.
If test, validation etc. sets of fitness cases are needed then create different FitnessEnvironment
s for them.
Pass a FitnessEnvironment
to the Evolve
method of the IPopulation
-subclass instance.
Using GetFittestProgram
, get statistics, perhaps perform test evaluation, print and perhaps log to file the results of the run.
Christopher Fogelberg
fogelbchri@mcs.vuw.ac.nz or cgf.unimail@syntilect.com