ECF 1.7

State class - backbone of the framework. More...

#include <State.h>

Inheritance diagram for State:

Public Member Functions

 State ()
 Construct the one and only State object.
bool initialize (int, char **)
 Initialize the whole system.
bool run ()
 Driver of the evolution process - serial version.
FitnessP getFitnessObject ()
 get one initial Fitness object (create on demand)
RandomizerP getRandomizer ()
 get current Randomizer
void setRandomizer (RandomizerP randomizer)
 set Randomizer to be used
RegistryP getRegistry ()
 get access to parameter repository
LoggerP getLogger ()
 get Logger
StatCalcP getStats ()
 get population statistics
HallOfFameP getHoF ()
 get population hall of fame
CommunicatorP getCommunicator ()
 access current process communicator mechanism
uint getGenerationNo ()
 get current generation number
uint getElapsedTime ()
 get elapsed time (in seconds)
bool getBatchMode ()
 get batch mode info (yes or no)
void setTerminateCond ()
 set termination condition (evolution ends with current generation)
uint increaseEvaluations (uint nEval=1)
 increase and return number of evaluations (local deme)
uint getEvaluations ()
 get number of evaluations (global population)
bool getTerminateCond ()
 is termination condition set
EvolutionContextP getContext ()
 get evolutionary context
IndividualP getIndividualObject ()
 get one initial Individual object
std::vector< GenotypeP > getGenotypes ()
 access all active (currently used) genotypes
PopulationP getPopulation ()
 get Population
AlgorithmP getAlgorithm ()
 access current active Algorithm
EvaluateOpP getEvalOp ()
 access evaluation operator
bool isImplicitParallel ()
 Is the algorithm executed implicitly parallel.
bool isAlgorithmParallel ()
 Is current algorithm parallel.
uint setGenotype (GenotypeP)
 Set a genotype to be used in individuals.
void setAlgorithm (AlgorithmP)
 Set the desired algorithm (overrides the current choice).
void setEvalOp (EvaluateOpP)
 Set user defined evaluation operator.
void setEvalOp (EvaluateOp *)
 Set user defined evaluation operator (without a smart pointer).
bool addGenotype (GenotypeP gen)
 Add user-defined or user customized genotype. (The genotype can then be specified and used in config file.) Replaces the existing genotype with the same name (if there is one). Must be called before State::initialize.
bool addAlgorithm (AlgorithmP alg)
 Add user-defined or user customized algorithm. (It can then be specified and used in config file.) Replaces the existing algorithm with the same name (if there is one). Must be called before State::initialize.
bool addOperator (OperatorP op)
 Add user-defined operator. (Its parameters can now be specified and used in config file.) Must be called before State::initialize.

Detailed Description

State class - backbone of the framework.

State class handles user communication, component repository and evolution process. State is also the entry point for access to system parameters and functionality.

Definition at line 37 of file State.h.

Constructor & Destructor Documentation

◆ State()

State::State ( )

Construct the one and only State object.

Also register all known algorithms, genotypes and termination operators, create the population and some other elements of the system.

Definition at line 12 of file State.cpp.

◆ ~State()

virtual State::~State ( )
inlinevirtual

Definition at line 112 of file State.h.

Member Function Documentation

◆ addAlgorithm()

bool State::addAlgorithm ( AlgorithmP alg)

Add user-defined or user customized algorithm. (It can then be specified and used in config file.) Replaces the existing algorithm with the same name (if there is one). Must be called before State::initialize.

Parameters
gennew algorithm

Definition at line 1025 of file State.cpp.

◆ addGenotype()

bool State::addGenotype ( GenotypeP gen)

Add user-defined or user customized genotype. (The genotype can then be specified and used in config file.) Replaces the existing genotype with the same name (if there is one). Must be called before State::initialize.

Parameters
gennew genotype

Definition at line 1010 of file State.cpp.

◆ addOperator()

bool State::addOperator ( OperatorP op)

Add user-defined operator. (Its parameters can now be specified and used in config file.) Must be called before State::initialize.

Parameters
gennew operator

Definition at line 1038 of file State.cpp.

◆ getAlgorithm()

AlgorithmP State::getAlgorithm ( )
inline

access current active Algorithm

Definition at line 191 of file State.h.

◆ getBatchMode()

bool State::getBatchMode ( )
inline

get batch mode info (yes or no)

Definition at line 155 of file State.h.

◆ getCommunicator()

CommunicatorP State::getCommunicator ( )
inline

access current process communicator mechanism

Definition at line 143 of file State.h.

◆ getContext()

EvolutionContextP State::getContext ( )
inline

get evolutionary context

Definition at line 175 of file State.h.

◆ getElapsedTime()

uint State::getElapsedTime ( )
inline

get elapsed time (in seconds)

Definition at line 151 of file State.h.

◆ getEvalOp()

EvaluateOpP State::getEvalOp ( )
inline

access evaluation operator

Definition at line 195 of file State.h.

◆ getEvaluations()

uint State::getEvaluations ( )
inline

get number of evaluations (global population)

Definition at line 167 of file State.h.

◆ getFitnessObject()

FitnessP State::getFitnessObject ( )

get one initial Fitness object (create on demand)

Definition at line 575 of file State.cpp.

◆ getGenerationNo()

uint State::getGenerationNo ( )
inline

get current generation number

Definition at line 147 of file State.h.

◆ getGenotypes()

std::vector< GenotypeP > State::getGenotypes ( )
inline

access all active (currently used) genotypes

Definition at line 183 of file State.h.

◆ getHoF()

HallOfFameP State::getHoF ( )
inline

get population hall of fame

Definition at line 139 of file State.h.

◆ getIndividualObject()

IndividualP State::getIndividualObject ( )
inline

get one initial Individual object

Definition at line 179 of file State.h.

◆ getLogger()

LoggerP State::getLogger ( )
inline

get Logger

Definition at line 131 of file State.h.

◆ getPopulation()

PopulationP State::getPopulation ( )
inline

get Population

Definition at line 187 of file State.h.

◆ getRandomizer()

RandomizerP State::getRandomizer ( )
inline

get current Randomizer

Definition at line 119 of file State.h.

◆ getRegistry()

RegistryP State::getRegistry ( )
inline

get access to parameter repository

Definition at line 127 of file State.h.

◆ getStats()

StatCalcP State::getStats ( )
inline

get population statistics

Definition at line 135 of file State.h.

◆ getTerminateCond()

bool State::getTerminateCond ( )
inline

is termination condition set

Definition at line 171 of file State.h.

◆ increaseEvaluations()

uint State::increaseEvaluations ( uint nEval = 1)
inline

increase and return number of evaluations (local deme)

Definition at line 163 of file State.h.

◆ initialize()

bool State::initialize ( int argc,
char ** argv )

Initialize the whole system.

Initialization steps:

  • parse command line arguments
  • register parameters of framework components
  • parse config file
  • initialize all components. Called by: main

Definition at line 713 of file State.cpp.

◆ isAlgorithmParallel()

bool State::isAlgorithmParallel ( )

Is current algorithm parallel.

Definition at line 855 of file State.cpp.

◆ isImplicitParallel()

bool State::isImplicitParallel ( )

Is the algorithm executed implicitly parallel.

Definition at line 848 of file State.cpp.

◆ run()

bool State::run ( )

Driver of the evolution process - serial version.

Driver of the evolution process - parallel version.

Runs the designated algorithm. Called by: main()

Definition at line 1057 of file State.cpp.

◆ setAlgorithm()

void State::setAlgorithm ( AlgorithmP algorithm)

Set the desired algorithm (overrides the current choice).

Definition at line 967 of file State.cpp.

◆ setEvalOp() [1/2]

void State::setEvalOp ( EvaluateOp * eval)

Set user defined evaluation operator (without a smart pointer).

Evaluation operator must be created and set before the call to State::initialize

Definition at line 991 of file State.cpp.

◆ setEvalOp() [2/2]

void State::setEvalOp ( EvaluateOpP eval)

Set user defined evaluation operator.

Evaluation operator must be created and set before the call to State::initialize

Definition at line 979 of file State.cpp.

◆ setGenotype()

uint State::setGenotype ( GenotypeP genotype)

Set a genotype to be used in individuals.

This actually adds new gentoype to be used in individuals (doesn't replace the ones already defined as active). Each genotype is given a unique index.

Parameters
genotypenew genotype to be included in each individual
Returns
new genotype's index

Definition at line 940 of file State.cpp.

◆ setRandomizer()

void State::setRandomizer ( RandomizerP randomizer)
inline

set Randomizer to be used

Definition at line 123 of file State.h.

◆ setTerminateCond()

void State::setTerminateCond ( )
inline

set termination condition (evolution ends with current generation)

Definition at line 159 of file State.h.


The documentation for this class was generated from the following files: