5#include "floatingpoint/FloatingPoint.h"
31 bool areGenotypesAdded_;
41 static bool sortPopulationByFitness (IndividualP ab1,IndividualP ab2) {
return ( ab1->fitness->isBetterThan(ab2->fitness)); }
46 FloatingPointP flp = boost::dynamic_pointer_cast<FloatingPoint::FloatingPoint> (ab1->getGenotype(1));
47 double &parentAb1 = flp->realValue[0];
48 flp = boost::dynamic_pointer_cast<FloatingPoint::FloatingPoint> (ab2->getGenotype(1));
49 double &parentAb2 = flp->realValue[0];
51 if (parentAb1 <parentAb2)
return true;
52 if (parentAb1 == parentAb2)
return (ab1->fitness->isBetterThan(ab2->fitness));
65 bool cloningPhase(StateP state, DemeP deme, std::vector<IndividualP> &clones);
66 bool hypermutationPhase(StateP state, DemeP deme, std::vector<IndividualP> &clones);
67 bool selectionPhase(StateP state, DemeP deme, std::vector<IndividualP> &clones);
68 bool birthPhase(StateP state, DemeP deme, std::vector<IndividualP> &clones);
69 bool replacePopulation(StateP state, DemeP deme, std::vector<IndividualP> &clones);
72typedef boost::shared_ptr<Clonalg> ClonalgP;
Clonal Selection Algorithm (see e.g. http://en.wikipedia.org/wiki/Clonal_Selection_Algorithm).
double d
fraction of population regenerated every generation
static bool sortPopulationByFitness(IndividualP ab1, IndividualP ab2)
sort vector of antibodies in regards to their fitness
static bool sortPopulationByParentAndFitness(IndividualP ab1, IndividualP ab2)
sort vector of antibodies first by their antibody parents and then by their fitness
std::string cloningVersion
specifies whether to use static or proportional cloning
bool initialize(StateP state)
Initialize the algorithm, read parameters from the system, do a sanity check.
bool markAntibodies(DemeP deme)
mark antibodies so the alg can know which clone belongs to which parent Antibody
uint n
number of antibodies cloned every generation
double beta
parameter which determines the number of clones for every antibody
bool advanceGeneration(StateP state, DemeP deme)
Perform a single generation on a single deme.
bool replacePopulation(StateP state, DemeP deme, std::vector< IndividualP > &clones)
replace population with the contents of clones vector
double c
mutation parameter
std::string selectionScheme
specifies which selection scheme to use CLONALG1 or CLONALG2
void registerParameters(StateP state)
Register algorithm's parameters (if any).