#include <Algorithm.h>
Public Member Functions | |
| std::string | getName () |
| virtual bool | isParallel () |
| bool | isImplicitParallel () |
| virtual bool | advanceGeneration (StateP, DemeP)=0 |
| virtual bool | initialize (StateP) |
| virtual void | registerParameters (StateP) |
| virtual bool | initializePopulation (StateP) |
| virtual void | read () |
| virtual bool | advanceGeneration (StateP state) |
| 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 | registerParallelParameters (StateP state) |
| bool | initializeParallel (StateP state) |
| virtual bool | advanceGeneration (StateP state) |
| virtual void | bcastTermination (StateP state) |
| void | registerParallelParameters (StateP state) |
| bool | initializeParallel (StateP state) |
| void | initializeImplicit (StateP state) |
| bool | implicitParallelOperate (StateP state) |
| void | evaluate (IndividualP ind) |
| void | implicitEvaluate (IndividualP ind) |
| uint | mutate (const IndividualP victim) |
| uint | mutate (const std::vector< IndividualP > &pool) |
| uint | implicitMutate (IndividualP ind) |
| void | replaceWith (IndividualP oldInd, IndividualP newInd) |
| 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. | |
Public Attributes | |
| 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) | |
Protected Member Functions | |
| bool | registerParameter (StateP state, std::string name, voidP value, enum ECF::type T) |
| 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 | |
Protected Attributes | |
| DemeP | activeDeme_ |
| std::string | name_ |
| algorithm name | |
| bool | bImplicitParallel_ |
| implicit parallel flag | |
| std::vector< SelectionOperatorP > | selectionOp |
| sel. operators used by algorithm | |
| StateP | state_ |
| 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 | |
Algorithm base class.
All algorithms must inherit this one. An algorithm combines selection operators (SelectionOperator), crossover (Algorithm::mate), mutation (Algorithm::mutate) and additional logic to build an evolutionary procedure.
Definition at line 18 of file Algorithm.h.
| virtual bool Algorithm::advanceGeneration | ( | StateP | , | |
| DemeP | ||||
| ) | [pure virtual] |
Perform a single generation on a single deme.
Must be implemented by a specific algorithm class
Implemented in AlgAEliGpea, AlgAEliGpea2, Elimination, ParticleSwarmOptimization, RouletteWheel, AlgSGenGpea, and SteadyStateTournament.
| bool Algorithm::advanceGeneration | ( | StateP | state | ) | [inline, virtual] |
Perform one generation of the algorithm on the whole population.
Default if not reimplemented: algorithm advances one generation on each deme
Definition at line 135 of file Algorithm.h.
| virtual bool Algorithm::advanceGeneration | ( | StateP | state | ) | [virtual] |
Parallel ECF: Perform one generation of the algorithm.
| void Algorithm::bcastTermination | ( | StateP | state | ) | [virtual] |
Parallel ECF: broadcast termination to worker processes.
Reimplemented in AlgAEliGpea.
Definition at line 287 of file Algorithm.cpp.
| void Algorithm::evaluate | ( | IndividualP | ind | ) | [inline] |
Parallel ECF: evaluate an individual.
Definition at line 213 of file Algorithm.h.
| voidP Algorithm::getParameterValue | ( | StateP | state, | |
| std::string | name | |||
| ) | [inline, protected] |
Helper function: get parameter value from the system.
| state | pointer to State object | |
| name | parameter name |
Definition at line 46 of file Algorithm.h.
| void Algorithm::implicitEvaluate | ( | IndividualP | ind | ) |
Parallel ECF: evaluate an individual (store for later evaluation in implicit parallel version).
Definition at line 114 of file Algorithm.cpp.
| uint Algorithm::implicitMutate | ( | IndividualP | ind | ) |
Parallel ECF: mutate an individual (store for later mutation in implicit parallel version).
Definition at line 173 of file Algorithm.cpp.
| bool Algorithm::implicitParallelOperate | ( | StateP | state | ) |
Parallel ECF: Worker processes in implicit parallel algorithm.
Definition at line 236 of file Algorithm.cpp.
| virtual bool Algorithm::initialize | ( | StateP | ) | [inline, virtual] |
Initialize the algorithm, read parameters from the system, do a sanity check.
Called by the system before the algorithm starts (Algorithm::advanceGeneration)
Reimplemented in AlgAEliGpea, AlgAEliGpea2, Elimination, ParticleSwarmOptimization, RouletteWheel, AlgSGenGpea, and SteadyStateTournament.
Definition at line 111 of file Algorithm.h.
| bool Algorithm::initializeParallel | ( | StateP | state | ) | [inline] |
| state | used only in parallel ECF |
Definition at line 178 of file Algorithm.h.
| bool Algorithm::initializeParallel | ( | StateP | state | ) |
Parallel ECF: Initialize implicit parallel algorithm.
| bool Algorithm::initializePopulation | ( | StateP | state | ) | [virtual] |
Evaluate initial population (called by State::run before evolution starts).
Definition at line 335 of file Algorithm.cpp.
| uint Algorithm::mutate | ( | const std::vector< IndividualP > & | pool | ) | [inline] |
Parallel ECF: mutate a vector of individuals.
Definition at line 243 of file Algorithm.h.
| uint Algorithm::mutate | ( | const IndividualP | victim | ) | [inline] |
Parallel ECF: immediately mutate an individual.
Definition at line 233 of file Algorithm.h.
| void Algorithm::registerParallelParameters | ( | StateP | state | ) | [inline] |
| state | used only in parallel ECF |
Definition at line 175 of file Algorithm.h.
| void Algorithm::registerParallelParameters | ( | StateP | state | ) |
Parallel ECF: Register parameters for implicit parallel algorithm version.
| bool Algorithm::registerParameter | ( | StateP | state, | |
| std::string | name, | |||
| voidP | value, | |||
| enum ECF::type | T | |||
| ) | [inline, protected] |
Helper function: register a single parameter with the system.
| state | pointer to State object | |
| name | unique parameter name | |
| value | pointer to parameter value object (caller provides) | |
| T | parameter type (see Registry.h) |
Definition at line 35 of file Algorithm.h.
| virtual void Algorithm::registerParameters | ( | StateP | ) | [inline, virtual] |
Register algorithm's parameters (if any).
Called by the system before algorithm initialization (Algorithm::initialize)
Reimplemented in AlgAEliGpea, AlgAEliGpea2, Elimination, ParticleSwarmOptimization, RouletteWheel, AlgSGenGpea, and SteadyStateTournament.
Definition at line 119 of file Algorithm.h.
| void Algorithm::replaceWith | ( | IndividualP | oldInd, | |
| IndividualP | newInd | |||
| ) | [inline] |
Helper function: replace an individual in current deme.
| oldInd | individual to be replaced | |
| newInd | new individual |
Definition at line 172 of file Algorithm.h.
| void Algorithm::replaceWith | ( | IndividualP | oldInd, | |
| IndividualP | newInd | |||
| ) |
Parallel ECF: replace an individual in a deme.
1.7.1