devolve



class  BaseGA(T, uint PopSize, alias comp);

Abstract class to be used as the base for GAs.


const(T)  evolve(uint generations);

Evolution function works as follows.

  1. The population is created using the supplied `generator`
  2. Crossing-over is preformed to created missing population
  3. The population is mutated with probability `mutation_rate`
  4. The parents of the next generation are selected
  5. Statistics are recorded for the best individual
  6. Terminate if criteria is met, otherwise go to 2.


float  mutationRate(float rate);
const float  mutationRate();

Set the mutation rate of the algorithm


float  crossoverRate(float rate);
const float  crossoverRate();

Set the crossover rate


uint  statFrequency(uint freq);
const uint  statFrequency();

Set the number of generations between printing statistics


uint  randomSeed(uint seed);
const uint  randomSeed();

Set the random seed to be used by the algorithm


double  terminationValue(double termination);
const double  terminationValue();

Set the value at which the evolution will terminate


const const(StatCollector!(T, comp))  statRecord();

Get a handle to the recorded statistics for this genome


T[]  population;

Stores the  population being evolved


void  registerTerminationCallback(void delegate(uint) callback);

Register a function to call when the evolution is ended.


void  registerGenerationCallback(void delegate(uint, T[]) callback);

Register a function to be called every generation


void  generation();

Method invoked to create the initial population


void  selection();

Method invoked to select the individuals to be parents to the next generation


void  crossingOver();

Method invoked to create the next generation of the population


void  mutation();

Method invoked to create variation in the population


const void  showStatistics(int generation);

Prints the statistics of the last generation


const void  showFinalStatistics(string cause);

Print the score of the historically best individual as well as the individual if it is printable