# Clonalg Class Reference [Algorithms, Sequential algorithms]

Clonal Selection Algorithm (see e.g. http://en.wikipedia.org/wiki/Clonal_Selection_Algorithm).This CLONALG implements:

• cloning Versions:
• static cloning : n of the best antibodies are cloned beta*populationSize times
• proportional cloning: number of clones per antibody is proportional to that ab's fitness
• inversely proportional hypermutation : better antibodies are mutated less
• selectionSchemes:
• CLONALG1 - at new generation each antibody will be substituded by the best individual of its set of beta*population clones
• CLONALG2 - new generation will be formed by the best (1-d)*populationSize clones ( or all if the number of clones is less than that )
• birthPhase: where d * populationSize of new antibodies are randomly created and added to the population for diversification.
More...

`#include <AlgClonalg.h>`

Inheritance diagram for Clonalg:

List of all members.

## 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.
bool markAntibodies (DemeP deme)
mark antibodies so the alg can know which clone belongs to which parent Antibody
bool cloningPhase (StateP state, DemeP deme, std::vector< IndividualP > &clones)
bool hypermutationPhase (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 clones vector

## Static Protected Member Functions

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

## Protected Attributes

double ubound
double lbound
uint dimension
uint n
number of antibodies cloned every generation
double beta
parameter which determines the number of clones for every antibody
double c
mutation parameter
double d
fraction of population regenerated every generation
std::string cloningVersion
specifies whether to use static or proportional cloning
std::string selectionScheme
specifies which selection scheme to use CLONALG1 or CLONALG2

## Detailed Description

Clonal Selection Algorithm (see e.g. http://en.wikipedia.org/wiki/Clonal_Selection_Algorithm).

This CLONALG implements:

• cloning Versions:
• static cloning : n of the best antibodies are cloned beta*populationSize times
• proportional cloning: number of clones per antibody is proportional to that ab's fitness
• inversely proportional hypermutation : better antibodies are mutated less
• selectionSchemes:
• CLONALG1 - at new generation each antibody will be substituded by the best individual of its set of beta*population clones
• CLONALG2 - new generation will be formed by the best (1-d)*populationSize clones ( or all if the number of clones is less than that )
• birthPhase: where d * populationSize of new antibodies are randomly created and added to the population for diversification.

CLONALG algorithm accepts only a single FloatingPoint genotype. Additionally, if chosen, selectionScheme CLONALG1 adds a FloatingPoint genotype (parentAntibody) to mark which clone came from which antibodies.

Definition at line 24 of file AlgClonalg.h.

## Member Function Documentation

 bool Clonalg::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 125 of file AlgClonalg.cpp.

 bool Clonalg::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 33 of file AlgClonalg.cpp.

 void Clonalg::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 AlgClonalg.cpp.

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