GEPAlg of < GEP::Population, GEP::Statistics> >. Executes consecutive independent runs of GEP algorithm by running the Population for a given number of generations Population statistics operators are calculated by _stats. More...
#include <GEPAlg.h>


Public Member Functions | |
| GEPAlg (const std::string &path, const std::vector< IDataSample > trainingSet=std::vector< IDataSample >(), const std::vector< IDataSample > testingSet=std::vector< IDataSample >()) | |
| virtual | ~GEPAlg () |
| void | runGEPAlg () |
| virtual bool | isOptimum () |
| virtual void | readConfig (const std::string &path) |
| virtual void | readConfig (const ConfigArgs &cfg) |
| void | evaluate (const std::vector< IDataSample > &samples, const bool &evaluateElite=false) |
| void | evaluateIndividual (IndividualType &individual, const std::vector< IDataSample > &samples) |
| bool | evaluateTestWithRollback () |
| void | removeUnviables () |
| double | avgFitness (const std::vector< IndividualType > &inds) |
| void | addToHallOfFame (const IndividualType &add) |
| void | updateHallOfFame (const double &max) |
| void | updateHallOfFame (const IndividualType &max) |
| void | clearHallOfFame () |
| Population & | getPopulation () |
| const Population & | getPopulation () const |
| std::vector< IndividualType > & | getHallOfFame () |
| const std::vector < IndividualType > & | getHallOfFame () const |
| std::vector< IDataSample > & | getTrainingSet () |
| const std::vector< IDataSample > & | getTrainingSet () const |
| std::vector< IDataSample > & | getTestingSet () |
| const std::vector< IDataSample > & | getTestingSet () const |
| Statistics< Population > & | getStatistics () |
| const Statistics< Population > & | getStatistics () const |
| size_t | getGenerations () const |
| size_t | getIndependentRuns () const |
| size_t | getLogInterval () const |
| size_t | getRecordInterval () const |
| size_t | getVerboseInterval () const |
| size_t | getReevaluations () const |
| size_t | getInitializationPath () const |
| IReturnType | getOptimum () const |
| double | getSuccessRate () const |
| char | getEliteMode () const |
| bool | isBreakOnOptimum () const |
| bool | getVerboseGeneration () const |
| bool | getVerboseRun () const |
| bool | getVerboseTotal () const |
| std::string | getHoFPath () const |
| void | setPopulation (const Population &pop_pointer) |
| void | setHallOfFame (const std::vector< IndividualType > &hof) |
| void | setTrainingSet (const std::vector< IDataSample > &train) |
| void | setTestingSet (const std::vector< IDataSample > &test) |
| void | setStatistics (const Statistics< Population > &stats) |
| void | setGenerations (const size_t &gens) |
| void | setTestRuns (const size_t &runs) |
| void | setLogInterval (const size_t &inter) |
| void | setRecordInterval (const size_t &inter) |
| void | setInitializationPath (const std::string &path) |
| void | setSuccessRate (const double &succes) |
| void | setEliteMode (const char &mode) |
| void | setVerboseInterval (const size_t &verbose) |
| void | setReevaluations (const size_t &ats) |
| void | setBreakOnOptimum (const bool &break_) |
| void | setTest (const bool &test) |
| void | setVerboseGeneration (const bool &vg) |
| void | setVerboseRun (const bool &vr) |
| void | setVerboseTotal (const bool &vt) |
| void | setHoFPath (const std::string &path) |
| void | setOptimum (const IReturnType &opt) |
Protected Member Functions | |
| virtual void | logPopulation (const size_t &genNum, const size_t &runNum) |
| virtual void | recordPopulation (const size_t &genNum, const size_t &runNum) |
| virtual void | runStart (const size_t &run) |
| virtual void | runEnd (const size_t &run, const bool &breaked=false) |
| virtual void | genStart (const size_t &run, const size_t &gen) |
| virtual void | genEnd (const size_t &run, const size_t &gen, const bool &breaked=false) |
| void | updatePrefix () |
Protected Attributes | |
| Population | _population |
| std::vector< IndividualType > | _hallOfFame |
| std::vector< IDataSample > | _trainingSet |
| std::vector< IDataSample > | _testingSet |
| size_t | _generations |
| size_t | _independentRuns |
| size_t | _logInterval |
| size_t | _recordInterval |
| size_t | _verboseInterval |
| size_t | _removeUnviablesAttempts |
| IReturnType | _optimum |
| double | _successRate |
| char | _eliteMode |
| bool | _breakOnOptimum |
| bool | _test |
| bool | _verboseGeneration |
| bool | _verboseRun |
| bool | _verboseTotal |
| bool | _evaluateOverride |
| std::string | _hofPath |
| std::string | _recordPath |
| std::string | _recordPrefix |
| std::string | _recordPrefixBase |
| std::string | _initializationPath |
| Stats | _stats |
Private Types | |
| typedef Population::comparator | Comparator |
| typedef Population::ind_type | IndividualType |
| typedef IndividualType::chromo_type | IChromoType |
| typedef IndividualType::ret_type | IReturnType |
| typedef IndividualType::base_type | IBaseType |
| typedef IndividualType::eval_type | IEvalType |
| typedef IndividualType::data_type | IDataSample |
GEPAlg of < GEP::Population, GEP::Statistics> >. Executes consecutive independent runs of GEP algorithm by running the Population for a given number of generations Population statistics operators are calculated by _stats.
typedef Population::comparator GEP::GEPAlg< Population, Stats >::Comparator [private] |
Reimplemented in GEP::MOGEPAlg< MOPopulation, MOStats >.
typedef IndividualType::base_type GEP::GEPAlg< Population, Stats >::IBaseType [private] |
Reimplemented in GEP::MOGEPAlg< MOPopulation, MOStats >.
typedef IndividualType::chromo_type GEP::GEPAlg< Population, Stats >::IChromoType [private] |
Reimplemented in GEP::MOGEPAlg< MOPopulation, MOStats >.
typedef IndividualType::data_type GEP::GEPAlg< Population, Stats >::IDataSample [private] |
Reimplemented in GEP::MOGEPAlg< MOPopulation, MOStats >.
typedef IndividualType::eval_type GEP::GEPAlg< Population, Stats >::IEvalType [private] |
typedef Population::ind_type GEP::GEPAlg< Population, Stats >::IndividualType [private] |
typedef IndividualType::ret_type GEP::GEPAlg< Population, Stats >::IReturnType [private] |
| GEP::GEPAlg< Population, Stats >::GEPAlg | ( | const std::string & | path, | |
| const std::vector< IDataSample > | trainingSet = std::vector<IDataSample>(), |
|||
| const std::vector< IDataSample > | testingSet = std::vector<IDataSample>() | |||
| ) | [inline] |
| virtual GEP::GEPAlg< Population, Stats >::~GEPAlg | ( | ) | [inline, virtual] |
| void GEP::GEPAlg< Population, Stats >::addToHallOfFame | ( | const IndividualType & | add | ) | [inline] |
| double GEP::GEPAlg< Population, Stats >::avgFitness | ( | const std::vector< IndividualType > & | inds | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::clearHallOfFame | ( | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::evaluate | ( | const std::vector< IDataSample > & | samples, | |
| const bool & | evaluateElite = false | |||
| ) | [inline] |
Evaluates a population against provided data.
| samples | - data samples for evaluation. | |
| evaluateElite | - if true, _population.evaluate() will be called with elite = true. |
| void GEP::GEPAlg< Population, Stats >::evaluateIndividual | ( | IndividualType & | individual, | |
| const std::vector< IDataSample > & | samples | |||
| ) | [inline] |
Evaluates a single individual against provided data.
| individual | - individual to be evaluated | |
| samples | - data samples for evaluation. |
| bool GEP::GEPAlg< Population, Stats >::evaluateTestWithRollback | ( | ) | [inline] |
Evaluates the population against the testing set and if optimum is not met, reverts fitness to the previous state (evaluates against the training set).
| void GEP::GEPAlg< Population, Stats >::genEnd | ( | const size_t & | run, | |
| const size_t & | gen, | |||
| const bool & | breaked = false | |||
| ) | [inline, protected, virtual] |
Performs operations at the end of any generation.
Reimplemented in GEP::MOGEPAlg< MOPopulation, MOStats >.
| void GEP::GEPAlg< Population, Stats >::genStart | ( | const size_t & | run, | |
| const size_t & | gen | |||
| ) | [inline, protected, virtual] |
Performs operations at the beginning of any generation.
| char GEP::GEPAlg< Population, Stats >::getEliteMode | ( | ) | const [inline] |
| size_t GEP::GEPAlg< Population, Stats >::getGenerations | ( | ) | const [inline] |
| const std::vector<IndividualType>& GEP::GEPAlg< Population, Stats >::getHallOfFame | ( | ) | const [inline] |
| std::vector<IndividualType>& GEP::GEPAlg< Population, Stats >::getHallOfFame | ( | ) | [inline] |
| std::string GEP::GEPAlg< Population, Stats >::getHoFPath | ( | ) | const [inline] |
| size_t GEP::GEPAlg< Population, Stats >::getIndependentRuns | ( | ) | const [inline] |
| size_t GEP::GEPAlg< Population, Stats >::getInitializationPath | ( | ) | const [inline] |
| size_t GEP::GEPAlg< Population, Stats >::getLogInterval | ( | ) | const [inline] |
| IReturnType GEP::GEPAlg< Population, Stats >::getOptimum | ( | ) | const [inline] |
| const Population& GEP::GEPAlg< Population, Stats >::getPopulation | ( | ) | const [inline] |
| Population& GEP::GEPAlg< Population, Stats >::getPopulation | ( | ) | [inline] |
| size_t GEP::GEPAlg< Population, Stats >::getRecordInterval | ( | ) | const [inline] |
| size_t GEP::GEPAlg< Population, Stats >::getReevaluations | ( | ) | const [inline] |
| const Statistics<Population>& GEP::GEPAlg< Population, Stats >::getStatistics | ( | ) | const [inline] |
| Statistics<Population>& GEP::GEPAlg< Population, Stats >::getStatistics | ( | ) | [inline] |
| double GEP::GEPAlg< Population, Stats >::getSuccessRate | ( | ) | const [inline] |
| const std::vector<IDataSample>& GEP::GEPAlg< Population, Stats >::getTestingSet | ( | ) | const [inline] |
| std::vector<IDataSample>& GEP::GEPAlg< Population, Stats >::getTestingSet | ( | ) | [inline] |
| const std::vector<IDataSample>& GEP::GEPAlg< Population, Stats >::getTrainingSet | ( | ) | const [inline] |
| std::vector<IDataSample>& GEP::GEPAlg< Population, Stats >::getTrainingSet | ( | ) | [inline] |
| bool GEP::GEPAlg< Population, Stats >::getVerboseGeneration | ( | ) | const [inline] |
| size_t GEP::GEPAlg< Population, Stats >::getVerboseInterval | ( | ) | const [inline] |
| bool GEP::GEPAlg< Population, Stats >::getVerboseRun | ( | ) | const [inline] |
| bool GEP::GEPAlg< Population, Stats >::getVerboseTotal | ( | ) | const [inline] |
| bool GEP::GEPAlg< Population, Stats >::isBreakOnOptimum | ( | ) | const [inline] |
| bool GEP::GEPAlg< Population, Stats >::isOptimum | ( | ) | [inline, virtual] |
Returns true if optimum defined by _optimum variable, is met.
Reimplemented in GEP::MOGEPAlg< MOPopulation, MOStats >.
| void GEP::GEPAlg< Population, Stats >::logPopulation | ( | const size_t & | genNum, | |
| const size_t & | runNum | |||
| ) | [inline, protected, virtual] |
Performs logging of the Population to Util::verbose() console.
Reimplemented in GEP::MOGEPAlg< MOPopulation, MOStats >.
| void GEP::GEPAlg< Population, Stats >::readConfig | ( | const ConfigArgs & | cfg | ) | [inline, virtual] |
Reimplemented in GEP::MOGEPAlg< MOPopulation, MOStats >.
| void GEP::GEPAlg< Population, Stats >::readConfig | ( | const std::string & | path | ) | [inline, virtual] |
Parses config file for fields specific to the Population
Reimplemented in GEP::MOGEPAlg< MOPopulation, MOStats >.
| void GEP::GEPAlg< Population, Stats >::recordPopulation | ( | const size_t & | genNum, | |
| const size_t & | runNum | |||
| ) | [inline, protected, virtual] |
Performs recording of the population every _recordInterval generation.
Reimplemented in GEP::MOGEPAlg< MOPopulation, MOStats >.
| void GEP::GEPAlg< Population, Stats >::removeUnviables | ( | ) | [inline] |
Function responsible for finding unviable individuals and generating random correct ones in their place. Newly generated individuals are already evaluated. The function works in an infinite loop (while any unviable in the population), use with care, probably to be set as optional by bool value.
| void GEP::GEPAlg< Population, Stats >::runEnd | ( | const size_t & | run, | |
| const bool & | breaked = false | |||
| ) | [inline, protected, virtual] |
Performs operations at the end of any run.
Reimplemented in GEP::MOGEPAlg< MOPopulation, MOStats >.
| void GEP::GEPAlg< Population, Stats >::runGEPAlg | ( | ) | [inline] |
Handles population dynamics over gnerations. It runs for the number of times defined with _independentRuns parameter.
| void GEP::GEPAlg< Population, Stats >::runStart | ( | const size_t & | run | ) | [inline, protected, virtual] |
Performs operations at the beginning of any run.
| void GEP::GEPAlg< Population, Stats >::setBreakOnOptimum | ( | const bool & | break_ | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setEliteMode | ( | const char & | mode | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setGenerations | ( | const size_t & | gens | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setHallOfFame | ( | const std::vector< IndividualType > & | hof | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setHoFPath | ( | const std::string & | path | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setInitializationPath | ( | const std::string & | path | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setLogInterval | ( | const size_t & | inter | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setOptimum | ( | const IReturnType & | opt | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setPopulation | ( | const Population & | pop_pointer | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setRecordInterval | ( | const size_t & | inter | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setReevaluations | ( | const size_t & | ats | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setStatistics | ( | const Statistics< Population > & | stats | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setSuccessRate | ( | const double & | succes | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setTest | ( | const bool & | test | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setTestingSet | ( | const std::vector< IDataSample > & | test | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setTestRuns | ( | const size_t & | runs | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setTrainingSet | ( | const std::vector< IDataSample > & | train | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setVerboseGeneration | ( | const bool & | vg | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setVerboseInterval | ( | const size_t & | verbose | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setVerboseRun | ( | const bool & | vr | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::setVerboseTotal | ( | const bool & | vt | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::updateHallOfFame | ( | const IndividualType & | max | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::updateHallOfFame | ( | const double & | max | ) | [inline] |
| void GEP::GEPAlg< Population, Stats >::updatePrefix | ( | ) | [inline, protected] |
bool GEP::GEPAlg< Population, Stats >::_breakOnOptimum [protected] |
char GEP::GEPAlg< Population, Stats >::_eliteMode [protected] |
bool GEP::GEPAlg< Population, Stats >::_evaluateOverride [protected] |
size_t GEP::GEPAlg< Population, Stats >::_generations [protected] |
std::vector<IndividualType> GEP::GEPAlg< Population, Stats >::_hallOfFame [protected] |
The best individuals (with maximum fitness) recorded over the test runs.
std::string GEP::GEPAlg< Population, Stats >::_hofPath [protected] |
size_t GEP::GEPAlg< Population, Stats >::_independentRuns [protected] |
std::string GEP::GEPAlg< Population, Stats >::_initializationPath [protected] |
size_t GEP::GEPAlg< Population, Stats >::_logInterval [protected] |
IReturnType GEP::GEPAlg< Population, Stats >::_optimum [protected] |
Population GEP::GEPAlg< Population, Stats >::_population [protected] |
Population used by GEP Algorithm
size_t GEP::GEPAlg< Population, Stats >::_recordInterval [protected] |
std::string GEP::GEPAlg< Population, Stats >::_recordPath [protected] |
std::string GEP::GEPAlg< Population, Stats >::_recordPrefix [protected] |
std::string GEP::GEPAlg< Population, Stats >::_recordPrefixBase [protected] |
size_t GEP::GEPAlg< Population, Stats >::_removeUnviablesAttempts [protected] |
Stats GEP::GEPAlg< Population, Stats >::_stats [protected] |
double GEP::GEPAlg< Population, Stats >::_successRate [protected] |
bool GEP::GEPAlg< Population, Stats >::_test [protected] |
std::vector<IDataSample> GEP::GEPAlg< Population, Stats >::_testingSet [protected] |
std::vector<IDataSample> GEP::GEPAlg< Population, Stats >::_trainingSet [protected] |
bool GEP::GEPAlg< Population, Stats >::_verboseGeneration [protected] |
size_t GEP::GEPAlg< Population, Stats >::_verboseInterval [protected] |
bool GEP::GEPAlg< Population, Stats >::_verboseRun [protected] |
bool GEP::GEPAlg< Population, Stats >::_verboseTotal [protected] |
1.6.1