ECF 1.7
AlgGEP Class Reference

Generational algorithm with roulette wheel selection operator and unique operators and chromosome representation. More...

#include <AlgGEP.h>

Inheritance diagram for AlgGEP:
Algorithm

Public Member Functions

void registerParameters (StateP state)
 Register algorithm's parameters (if any).
bool initialize (StateP state)
 Initialize the algorithm, read parameters from the system, do a sanity check.
bool advanceGeneration (StateP state, DemeP deme)
 Perform a single generation on a single deme.
void invert (StateP state, const std::vector< IndividualP > &pool)
void invertDc (StateP state, const std::vector< IndividualP > &pool)
void transpose (StateP state, const std::vector< IndividualP > &pool)
void transposeIS (StateP state, const std::vector< IndividualP > &pool)
void transposeRIS (StateP state, const std::vector< IndividualP > &pool)
void transposeGene (StateP state, const std::vector< IndividualP > &pool)
void transposeDc (StateP state, const std::vector< IndividualP > &pool)
Public Member Functions inherited from Algorithm
std::string getName ()
 Get algorithm name. Each algorithm is uniquely identified with its name.
virtual bool isParallel ()
 Is algorithm parallel (false by default for all algorithms not inheriting ParallelAlgorithm class).
bool isImplicitParallel ()
 Is algorithm run in implicit parallel mode (in development, see tutorial).
virtual bool initializePopulation (StateP)
 Evaluate initial population (called by State::run before evolution starts).
virtual void read ()
virtual bool advanceGeneration (StateP state)
 Perform one generation of the algorithm on the whole population.
void evaluate (IndividualP ind)
 Helper function: evaluate an individual.
uint mutate (const std::vector< IndividualP > &pool)
 Helper function: send a vector of individuals to mutation.
uint mutate (const IndividualP victim)
 Helper function: send a single individual to mutation.
void replaceWith (IndividualP oldInd, IndividualP newInd)
 Helper function: replace an individual in current deme.
void replaceWith (uint oldIndId, IndividualP newInd)
 Helper function: replace an individual at given position in current deme.
void registerParallelParameters (StateP state)
 used only in parallel ECF
bool initializeParallel (StateP state)
 used only in parallel ECF
virtual bool advanceGeneration (StateP state)
 Parallel ECF: Perform one generation of the algorithm.
virtual void bcastTermination (StateP state)
 Parallel ECF: broadcast termination to worker processes.
void registerParallelParameters (StateP state)
 Parallel ECF: Register parameters for implicit parallel algorithm version.
bool initializeParallel (StateP state)
 Parallel ECF: Initialize implicit parallel algorithm.
void initializeImplicit (StateP state)
 Parallel ECF: Initialize implicit parallel mode.
bool implicitParallelOperate (StateP state)
 Parallel ECF: Worker processes in implicit parallel algorithm.
void evaluate (IndividualP ind)
 Parallel ECF: evaluate an individual.
void implicitEvaluate (IndividualP ind)
 Parallel ECF: implicitly evaluate an individual (store for later evaluation in implicit parallel version).
uint mutate (const IndividualP victim)
 Parallel ECF: immediately mutate an individual.
uint mutate (const std::vector< IndividualP > &pool)
 Parallel ECF: mutate a vector of individuals.
uint implicitMutate (IndividualP ind)
 Parallel ECF: implicitly mutate an individual (store for later mutation in implicit parallel version).
void replaceWith (IndividualP oldInd, IndividualP newInd)
 Parallel ECF: replace an individual in a deme.
void replaceWith (uint oldIndId, IndividualP newInd)
 Parallel ECF: replace an individual at given position in a deme.
bool mate (IndividualP p1, IndividualP p2, IndividualP child)
 Helper function: crossover two individuals.
IndividualP copy (IndividualP source)
 Helper function: make a copy of an individual.
bool removeFrom (IndividualP victim, std::vector< IndividualP > &pool)
 Helper function: remove victim from pool of individual pointers.
bool isMember (IndividualP single, std::vector< IndividualP > &pool)
 Helper function: check if individual is in the pool.

Protected Attributes

double crxRate_
 crossover rate
double selPressure_
 selection pressure
double invRate_
 inversion rate
double invDcRate_
 Constant domain inversion rate.
double invMaxLength_
 inversion maximum sequence length
double transISRate_
 IS transposition rate.
double transRISRate_
 RIS transposition rate.
double transGeneRate_
 gene transposition rate
double transDcRate_
 constant domain transposition rate
double transMaxLength_
 maximum sequence transposition length
SelRandomOpP selRandomOp
SelBestOpP selBestOp
SelFitnessProportionalOpP selFitPropOp
Protected Attributes inherited from Algorithm
DemeP activeDeme_
std::string name_
 algorithm name
bool bImplicitParallel_
 implicit parallel flag
std::vector< SelectionOperatorP > selectionOp
 sel. operators used by algorithm
std::vector< IndividualP > requests_
std::vector< IndividualP > stored_
 individual vectors for implicit evaluation
std::vector< uint > requestIds_
 individual indexes for implicit evaluation
std::vector< IndividualP > demeCopy_
std::vector< IndividualP > myJob_
 worker's individual vector
CommunicatorP comm_
uint jobSize_
uint totalEvaluations_
uint wastedEvaluations_
bool bImplicitEvaluation_
 implicit evaluation flag
bool bImplicitMutation_
 implicit mutation flag
bool bSynchronized_
 is implicit paralelization synchronous
SelectionOperatorP selBestOp
std::vector< IndividualP > requestsMut_
std::vector< IndividualP > receivedMut_
 individual vectors for implicit mutation
std::vector< uint > requestMutIds_
 individual indexes for implicit mutation
IndividualP currentBest_
std::vector< IndividualP > storedInds_
std::vector< std::vector< IndividualP > > sentInds_
 individuals sent for evaluation
std::vector< bool > isConsistent_
 is individual (genotype-fitness pair) consistent

Additional Inherited Members

Public Attributes inherited from Algorithm
CrossoverP crossover_
 sptr to container of crossover operators (set by the system)
MutationP mutation_
 sptr to container of mutation operators (set by the system)
EvaluateOpP evalOp_
 sptr to evaluation operator (set by the system)
StateP state_
Protected Member Functions inherited from Algorithm
bool registerParameter (StateP state, std::string name, voidP value, enum ECF::type T, std::string description="")
 Helper function: register a single parameter with the system.
voidP getParameterValue (StateP state, std::string name)
 Helper function: get parameter value from the system.
void storeIndividual (IndividualP)
 stores the individual (if it is consistent), resets consistency flag
void storeGenotypes (std::vector< IndividualP > &)
 adds genotypes of individuals to 'sent' repository
void setConsistency (IndividualP)
 denotes current individual as consistent
void restoreIndividuals (std::vector< uint >)
 restores individuals whose fitness is received
void restorePopulation ()
 restores inconsistent individuals to last consistent state

Detailed Description

Generational algorithm with roulette wheel selection operator and unique operators and chromosome representation.

This algorithm requires one GEPChromosome genotype.

The algorithm flow:

single generation {
select individuals to form the new generation (fitness proportional selection operator);
create new generation (make copies);
noCrx = (deme size) * <crxRate_> / 2;
repeat(<noCrx> times) {
randomly select two parents;
perform crossover, _replace_ parents with their children;
}
perform mutation on new generation;
perform transposition on new generation;
perform inversion on new generation
}

Definition at line 35 of file AlgGEP.h.

Constructor & Destructor Documentation

◆ AlgGEP()

AlgGEP::AlgGEP ( )

Definition at line 4 of file AlgGEP.cpp.

Member Function Documentation

◆ advanceGeneration()

bool AlgGEP::advanceGeneration ( StateP state,
DemeP deme )
virtual

Perform a single generation on a single deme.

Must be implemented by a specific algorithm class

Implements Algorithm.

Definition at line 74 of file AlgGEP.cpp.

◆ initialize()

bool AlgGEP::initialize ( StateP state)
virtual

Initialize the algorithm, read parameters from the system, do a sanity check.

Called by the system before the algorithm starts (Algorithm::advanceGeneration)

Reimplemented from Algorithm.

Definition at line 27 of file AlgGEP.cpp.

◆ invert()

void AlgGEP::invert ( StateP state,
const std::vector< IndividualP > & pool )

Definition at line 143 of file AlgGEP.cpp.

◆ invertDc()

void AlgGEP::invertDc ( StateP state,
const std::vector< IndividualP > & pool )

Definition at line 191 of file AlgGEP.cpp.

◆ registerParameters()

void AlgGEP::registerParameters ( StateP state)
virtual

Register algorithm's parameters (if any).

Called by the system before algorithm initialization (Algorithm::initialize)

Reimplemented from Algorithm.

Definition at line 12 of file AlgGEP.cpp.

◆ transpose()

void AlgGEP::transpose ( StateP state,
const std::vector< IndividualP > & pool )

Definition at line 246 of file AlgGEP.cpp.

◆ transposeDc()

void AlgGEP::transposeDc ( StateP state,
const std::vector< IndividualP > & pool )

Definition at line 417 of file AlgGEP.cpp.

◆ transposeGene()

void AlgGEP::transposeGene ( StateP state,
const std::vector< IndividualP > & pool )

Definition at line 376 of file AlgGEP.cpp.

◆ transposeIS()

void AlgGEP::transposeIS ( StateP state,
const std::vector< IndividualP > & pool )

Definition at line 255 of file AlgGEP.cpp.

◆ transposeRIS()

void AlgGEP::transposeRIS ( StateP state,
const std::vector< IndividualP > & pool )

Definition at line 312 of file AlgGEP.cpp.

Member Data Documentation

◆ crxRate_

double AlgGEP::crxRate_
protected

crossover rate

Definition at line 50 of file AlgGEP.h.

◆ invDcRate_

double AlgGEP::invDcRate_
protected

Constant domain inversion rate.

Definition at line 53 of file AlgGEP.h.

◆ invMaxLength_

double AlgGEP::invMaxLength_
protected

inversion maximum sequence length

Definition at line 54 of file AlgGEP.h.

◆ invRate_

double AlgGEP::invRate_
protected

inversion rate

Definition at line 52 of file AlgGEP.h.

◆ selBestOp

SelBestOpP AlgGEP::selBestOp
protected

Definition at line 62 of file AlgGEP.h.

◆ selFitPropOp

SelFitnessProportionalOpP AlgGEP::selFitPropOp
protected

Definition at line 63 of file AlgGEP.h.

◆ selPressure_

double AlgGEP::selPressure_
protected

selection pressure

Definition at line 51 of file AlgGEP.h.

◆ selRandomOp

SelRandomOpP AlgGEP::selRandomOp
protected

Definition at line 61 of file AlgGEP.h.

◆ transDcRate_

double AlgGEP::transDcRate_
protected

constant domain transposition rate

Definition at line 58 of file AlgGEP.h.

◆ transGeneRate_

double AlgGEP::transGeneRate_
protected

gene transposition rate

Definition at line 57 of file AlgGEP.h.

◆ transISRate_

double AlgGEP::transISRate_
protected

IS transposition rate.

Definition at line 55 of file AlgGEP.h.

◆ transMaxLength_

double AlgGEP::transMaxLength_
protected

maximum sequence transposition length

Definition at line 59 of file AlgGEP.h.

◆ transRISRate_

double AlgGEP::transRISRate_
protected

RIS transposition rate.

Definition at line 56 of file AlgGEP.h.


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