Modernized GAlib
3.0.0 current
|
Public Types | |
enum | ReplacementScheme { RANDOM = GAPopulation::RANDOM , BEST = GAPopulation::BEST , WORST = GAPopulation::WORST , CUSTOM = -30 , CROWDING = -30 , PARENT = -10 } |
using | ReplacementFunction = GAGenome &(*)(GAGenome &, GAPopulation &) |
![]() | |
enum | { MINIMIZE = -1 , MAXIMIZE = 1 } |
using | Terminator = bool(*)(GAGeneticAlgorithm &) |
![]() | |
enum | { BaseGA = 0 , SimpleGA , SteadyStateGA , IncrementalGA , DemeGA , Population = 10 , Scaling = 15 , NoScaling , LinearScaling , SigmaTruncationScaling , PowerLawScaling , Sharing , Selection = 40 , RankSelection , RouletteWheelSelection , TournamentSelection , UniformSelection , SRSSelection , DSSelection , Genome = 50 , BinaryStringGenome , BinaryStringGenome2D , BinaryStringGenome3D , Bin2DecGenome , ListGenome , TreeGenome , ArrayGenome , ArrayGenome2D , ArrayGenome3D , ArrayAlleleGenome , ArrayAlleleGenome2D , ArrayAlleleGenome3D , StringGenome , FloatGenome , IntGenome , DoubleGenome } |
Public Member Functions | |
GADefineIdentity ("GAIncrementalGA", GAID::IncrementalGA) | |
GAIncrementalGA (const GAGenome &) | |
GAIncrementalGA (const GAPopulation &) | |
GAIncrementalGA (const GAIncrementalGA &) | |
GAIncrementalGA & | operator= (const GAIncrementalGA &) |
void | copy (const GAGeneticAlgorithm &) override |
void | initialize (unsigned int seed=0) override |
Undefined for the base class. More... | |
void | step () override |
Evolve by one generation. More... | |
GAIncrementalGA & | operator++ () |
int | setptr (const std::string &name, const void *value) override |
int | get (const char *name, void *value) const override |
void | objectiveFunction (GAGenome::Evaluator f) override |
void | objectiveData (const GAEvalData &v) override |
int | nOffspring () const |
int | nOffspring (unsigned int) |
ReplacementScheme | replacement () const |
ReplacementScheme | replacement (ReplacementScheme, ReplacementFunction f=nullptr) |
![]() | |
GADefineIdentity ("GAIncrementalGA", GAID::BaseGA) | |
GAGeneticAlgorithm (const GAGenome &) | |
GAGeneticAlgorithm (const GAPopulation &) | |
GAGeneticAlgorithm (const GAGeneticAlgorithm &) | |
bool | done () |
Calls the completion measure routine to tell whether or not the GA is done. | |
virtual void | evolve (unsigned int seed=0) |
This method is provided as a convenience so that you don't have to increment the GA generation-by-generation by hand. More... | |
virtual int | write (const char *) const |
virtual int | write (std::ostream &) const |
virtual int | read (const char *) |
virtual int | read (std::istream &) |
void * | userData () const |
void * | userData (void *d) |
Terminator | terminator () const |
Terminator | terminator (Terminator f) |
const GAParameterList & | parameters () const |
const GAParameterList & | parameters (const GAParameterList &) |
const GAParameterList & | parameters (int &, char **, bool flag=false) |
const GAParameterList & | parameters (const std::string &filename, bool f=false) |
const GAParameterList & | parameters (std::istream &, bool flag=false) |
int | set (const std::string &s, int v) |
int | set (const std::string &s, unsigned int v) |
int | set (const std::string &s, char v) |
int | set (const std::string &s, const char *v) |
int | set (const std::string &s, const void *v) |
int | set (const std::string &name, double v) |
virtual int | minimaxi () const |
virtual int | minimaxi (int m) |
int | minimize () |
int | maximize () |
int | nGenerations () const |
int | nGenerations (unsigned int n) |
int | nConvergence () const |
int | nConvergence (unsigned int n) |
float | pConvergence () const |
float | pConvergence (float p) |
float | pCrossover () const |
float | pCrossover (float p) |
float | pMutation () const |
float | pMutation (float p) |
GAGenome::SexualCrossover | crossover (GAGenome::SexualCrossover f) |
GAGenome::SexualCrossover | sexual () const |
GAGenome::AsexualCrossover | crossover (GAGenome::AsexualCrossover f) |
GAGenome::AsexualCrossover | asexual () const |
const GAStatistics & | statistics () const |
float | convergence () const |
int | generation () const |
void | flushScores () |
int | scoreFrequency () const |
int | scoreFrequency (unsigned int x) |
int | flushFrequency () const |
int | flushFrequency (unsigned int x) |
std::string | scoreFilename () const |
std::string | scoreFilename (const std::string &fn) |
int | selectScores () |
int | selectScores (int w) |
bool | recordDiversity () const |
bool | recordDiversity (bool f) |
virtual const GAPopulation & | population () const |
virtual const GAPopulation & | population (const GAPopulation &) |
virtual int | populationSize () const |
virtual int | populationSize (unsigned int value) |
virtual int | nBestGenomes () const |
virtual int | nBestGenomes (unsigned int n) |
virtual GAScalingScheme & | scaling () const |
virtual GAScalingScheme & | scaling (const GAScalingScheme &s) |
virtual GASelectionScheme & | selector () const |
virtual GASelectionScheme & | selector (const GASelectionScheme &s) |
![]() | |
bool | sameClass (const GAID &b) const |
virtual const char * | className () const |
virtual int | classID () const |
Static Public Member Functions | |
static GAParameterList & | registerDefaultParameters (GAParameterList &) |
![]() | |
static GAParameterList & | registerDefaultParameters (GAParameterList &) |
static bool | TerminateUponGeneration (GAGeneticAlgorithm &) |
static bool | TerminateUponConvergence (GAGeneticAlgorithm &) |
static bool | TerminateUponPopConvergence (GAGeneticAlgorithm &) |
Protected Attributes | |
GAGenome * | child1 |
GAGenome * | child2 |
ReplacementScheme | rs |
ReplacementFunction | rf |
unsigned int | noffspr |
![]() | |
GAStatistics | stats |
GAParameterList | params |
GAPopulation * | pop |
Terminator | cf |
function for determining done-ness | |
void * | ud |
pointer to user data structure | |
int | d_seed |
unsigned int | ngen |
unsigned int | nconv |
float | pconv |
float | pcross |
float | pmut |
int | minmax |
GAGenome::SexualCrossover | scross |
sexual crossover to use | |
GAGenome::AsexualCrossover | across |
asexual crossover to use | |
|
overridevirtual |
Undefined for the base class.
The initialization routine typically calls the population initializer (which typically calls the genome initializers). It should also reset the statistics.
Implements GAGeneticAlgorithm.
|
overridevirtual |
Evolve by one generation.
'generation' can be defined different ways for different genetic algorithms, but in the traditional formulation a generation mean creation of a new population (or portion thereof).
Implements GAGeneticAlgorithm.