ECF 1.5
Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
OptIA Class Reference

Optimization Immune Algorithm (opt-IA, see e.g. http://www.artificial-immune-systems.org/algorithms.shtml). More...

#include <AlgOptIA.h>

Inheritance diagram for OptIA:
Algorithm

Public Member Functions

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

Static Protected Member Functions

static bool sortPopulationByFitness (IndividualP ab1, IndividualP ab2)
 sort vector of antibodies in regards to their fitness More...
 

Protected Attributes

double ubound
 
double lbound
 
uint dimension
 
bool areGenotypesAdded_
 
uint dup
 number of clones per antibody More...
 
double c
 mutation parameter More...
 
double tauB
 maximum number of generations without improvement More...
 
bool elitism
 specifies whether to use elitism or not More...
 
- Protected Attributes inherited from Algorithm
DemeP activeDeme_
 
std::string name_
 algorithm name More...
 
bool bImplicitParallel_
 implicit parallel flag More...
 
std::vector< SelectionOperatorP > selectionOp
 sel. operators used by algorithm More...
 
std::vector< IndividualP > requests_
 
std::vector< IndividualP > stored_
 individual vectors for implicit evaluation More...
 
std::vector< uint > requestIds_
 individual indexes for implicit evaluation More...
 
std::vector< IndividualP > demeCopy_
 
std::vector< IndividualP > myJob_
 worker's individual vector More...
 
CommunicatorP comm_
 
uint jobSize_
 
uint totalEvaluations_
 
uint wastedEvaluations_
 
bool bImplicitEvaluation_
 implicit evaluation flag More...
 
bool bImplicitMutation_
 implicit mutation flag More...
 
bool bSynchronized_
 is implicit paralelization synchronous More...
 
SelectionOperatorP selBestOp
 
std::vector< IndividualP > requestsMut_
 
std::vector< IndividualP > receivedMut_
 individual vectors for implicit mutation More...
 
std::vector< uint > requestMutIds_
 individual indexes for implicit mutation More...
 
IndividualP currentBest_
 
std::vector< IndividualP > storedInds_
 
std::vector< std::vector< IndividualP > > sentInds_
 individuals sent for evaluation More...
 
std::vector< bool > isConsistent_
 is individual (genotype-fitness pair) consistent More...
 

Additional Inherited Members

- Public Attributes inherited from Algorithm
CrossoverP crossover_
 sptr to container of crossover operators (set by the system) More...
 
MutationP mutation_
 sptr to container of mutation operators (set by the system) More...
 
EvaluateOpP evalOp_
 sptr to evaluation operator (set by the system) More...
 
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. More...
 
voidP getParameterValue (StateP state, std::string name)
 Helper function: get parameter value from the system. More...
 
void storeIndividual (IndividualP)
 stores the individual (if it is consistent), resets consistency flag More...
 
void storeGenotypes (std::vector< IndividualP > &)
 adds genotypes of individuals to 'sent' repository More...
 
void setConsistency (IndividualP)
 denotes current individual as consistent More...
 
void restoreIndividuals (std::vector< uint >)
 restores individuals whose fitness is received More...
 
void restorePopulation ()
 restores inconsistent individuals to last consistent state More...
 

Detailed Description

Optimization Immune Algorithm (opt-IA, see e.g. http://www.artificial-immune-systems.org/algorithms.shtml).

This opt-IA implements:

opt-IA algorithm accepts only a single FloatingPoint genotype. Additionally, opt-IA adds a FloatingPoint genotype (age).

Definition at line 22 of file AlgOptIA.h.

Constructor & Destructor Documentation

◆ OptIA()

OptIA::OptIA ( )

Definition at line 8 of file AlgOptIA.cpp.

Member Function Documentation

◆ advanceGeneration()

bool OptIA::advanceGeneration ( StateP  ,
DemeP   
)
virtual

Perform a single generation on a single deme.

Must be implemented by a specific algorithm class

Implements Algorithm.

Definition at line 96 of file AlgOptIA.cpp.

◆ agingPhase()

bool OptIA::agingPhase ( StateP  state,
DemeP  deme,
std::vector< IndividualP > &  clones 
)

Definition at line 176 of file AlgOptIA.cpp.

◆ birthPhase()

bool OptIA::birthPhase ( StateP  state,
DemeP  deme,
std::vector< IndividualP > &  clones 
)

Definition at line 216 of file AlgOptIA.cpp.

◆ cloningPhase()

bool OptIA::cloningPhase ( StateP  state,
DemeP  deme,
std::vector< IndividualP > &  clones 
)

Definition at line 111 of file AlgOptIA.cpp.

◆ hypermutationPhase()

bool OptIA::hypermutationPhase ( StateP  state,
DemeP  deme,
std::vector< IndividualP > &  clones 
)

Definition at line 129 of file AlgOptIA.cpp.

◆ initialize()

bool OptIA::initialize ( StateP  )
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 29 of file AlgOptIA.cpp.

◆ registerParameters()

void OptIA::registerParameters ( StateP  )
virtual

Register algorithm's parameters (if any).

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

Reimplemented from Algorithm.

Definition at line 16 of file AlgOptIA.cpp.

◆ replacePopulation()

bool OptIA::replacePopulation ( StateP  state,
DemeP  deme,
std::vector< IndividualP > &  clones 
)

replace population with the contents of the clones vector

Definition at line 245 of file AlgOptIA.cpp.

◆ selectionPhase()

bool OptIA::selectionPhase ( StateP  state,
DemeP  deme,
std::vector< IndividualP > &  clones 
)

Definition at line 203 of file AlgOptIA.cpp.

◆ sortPopulationByFitness()

static bool OptIA::sortPopulationByFitness ( IndividualP  ab1,
IndividualP  ab2 
)
inlinestaticprotected

sort vector of antibodies in regards to their fitness

Definition at line 37 of file AlgOptIA.h.

Member Data Documentation

◆ areGenotypesAdded_

bool OptIA::areGenotypesAdded_
protected

Definition at line 29 of file AlgOptIA.h.

◆ c

double OptIA::c
protected

mutation parameter

Definition at line 32 of file AlgOptIA.h.

◆ dimension

uint OptIA::dimension
protected

Definition at line 28 of file AlgOptIA.h.

◆ dup

uint OptIA::dup
protected

number of clones per antibody

Definition at line 31 of file AlgOptIA.h.

◆ elitism

bool OptIA::elitism
protected

specifies whether to use elitism or not

Definition at line 34 of file AlgOptIA.h.

◆ lbound

double OptIA::lbound
protected

Definition at line 27 of file AlgOptIA.h.

◆ tauB

double OptIA::tauB
protected

maximum number of generations without improvement

Definition at line 33 of file AlgOptIA.h.

◆ ubound

double OptIA::ubound
protected

Definition at line 26 of file AlgOptIA.h.


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