ECF 1.5
Public Member Functions | List of all members

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

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 38 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 113 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 1015 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 1000 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 1028 of file State.cpp.

◆ getAlgorithm()

AlgorithmP State::getAlgorithm ( )
inline

access current active Algorithm

Definition at line 192 of file State.h.

◆ getBatchMode()

bool State::getBatchMode ( )
inline

get batch mode info (yes or no)

Definition at line 156 of file State.h.

◆ getCommunicator()

CommunicatorP State::getCommunicator ( )
inline

access current process communicator mechanism

Definition at line 144 of file State.h.

◆ getContext()

EvolutionContextP State::getContext ( )
inline

get evolutionary context

Definition at line 176 of file State.h.

◆ getElapsedTime()

uint State::getElapsedTime ( )
inline

get elapsed time (in seconds)

Definition at line 152 of file State.h.

◆ getEvalOp()

EvaluateOpP State::getEvalOp ( )
inline

access evaluation operator

Definition at line 196 of file State.h.

◆ getEvaluations()

uint State::getEvaluations ( )
inline

get number of evaluations (global population)

Definition at line 168 of file State.h.

◆ getFitnessObject()

FitnessP State::getFitnessObject ( )

get one initial Fitness object (create on demand)

Definition at line 569 of file State.cpp.

◆ getGenerationNo()

uint State::getGenerationNo ( )
inline

get current generation number

Definition at line 148 of file State.h.

◆ getGenotypes()

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

access all active (currently used) genotypes

Definition at line 184 of file State.h.

◆ getHoF()

HallOfFameP State::getHoF ( )
inline

get population hall of fame

Definition at line 140 of file State.h.

◆ getIndividualObject()

IndividualP State::getIndividualObject ( )
inline

get one initial Individual object

Definition at line 180 of file State.h.

◆ getLogger()

LoggerP State::getLogger ( )
inline

get Logger

Definition at line 132 of file State.h.

◆ getPopulation()

PopulationP State::getPopulation ( )
inline

get Population

Definition at line 188 of file State.h.

◆ getRandomizer()

RandomizerP State::getRandomizer ( )
inline

get current Randomizer

Definition at line 120 of file State.h.

◆ getRegistry()

RegistryP State::getRegistry ( )
inline

get access to parameter repository

Definition at line 128 of file State.h.

◆ getStats()

StatCalcP State::getStats ( )
inline

get population statistics

Definition at line 136 of file State.h.

◆ getTerminateCond()

bool State::getTerminateCond ( )
inline

is termination condition set

Definition at line 172 of file State.h.

◆ increaseEvaluations()

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

increase and return number of evaluations (local deme)

Definition at line 164 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 707 of file State.cpp.

◆ isAlgorithmParallel()

bool State::isAlgorithmParallel ( )

Is current algorithm parallel.

Definition at line 845 of file State.cpp.

◆ isImplicitParallel()

bool State::isImplicitParallel ( )

Is the algorithm executed implicitly parallel.

Definition at line 838 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 1047 of file State.cpp.

◆ setAlgorithm()

void State::setAlgorithm ( AlgorithmP  algorithm)

Set the desired algorithm (overrides the current choice)

Definition at line 957 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 981 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 969 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 930 of file State.cpp.

◆ setRandomizer()

void State::setRandomizer ( RandomizerP  randomizer)
inline

set Randomizer to be used

Definition at line 124 of file State.h.

◆ setTerminateCond()

void State::setTerminateCond ( )
inline

set termination condition (evolution ends with current generation)

Definition at line 160 of file State.h.


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