|
GeneticAlgoithm
Implementation of the genetic algorithm
|
Implements a population of parametric models. More...
#include <ParametricModelPopulation.h>


Public Member Functions | |
| ParametricModelPopulation () | |
| ~ParametricModelPopulation () | |
| void | setFormula (TF1 *formula) |
| void | setMutationSize (double relativeSize) |
Public Member Functions inherited from IPopulation | |
| IPopulation () | |
| virtual | ~IPopulation () |
| void | initialize (int n) |
| void | crossOver () |
| void | mutate () |
| void | score () |
| void | setRandomSeed (int seed) |
| void | setMutateRate (double rate) |
| void | setFigureOfMerit (IFigureOfMerit *fom) |
| IFigureOfMerit * | getFigureOfMerit () |
| IModel * | getBestFitted (int rank=0) |
| int | size () |
| double | getScoreMean () |
| double | getScoreRMS () |
| void | clear () |
Protected Member Functions | |
| virtual void | doInitialize (int n) |
| virtual void | doCrossOver (const std::vector< std::vector< IModel *> > &parents) |
| virtual void | doMutate (IModel *model) |
Protected Member Functions inherited from IPopulation | |
| virtual void | selectParents (int &p1, int &p2) |
| void | sort () |
| void | checkFigureOfMerit () |
Protected Attributes | |
| TF1 * | m_formula |
| Stores the formula for this population. | |
| double | m_mutationSize |
| Stores the relative size (sigma) of the gaussian noise applied during mutation. | |
Protected Attributes inherited from IPopulation | |
| double | m_mutateRate |
| Stores the mutate rate. | |
| bool | m_sorted |
| Stores whether the ranking is valid or needs to be redone. | |
| std::vector< IModel * > | m_individuals |
| Stores the individuals of this population. | |
| IFigureOfMerit * | m_fom |
| Stores the figure of merit to be used to calculate scores and perform the ranking. | |
| TRandom3 * | m_random |
| Stores a random number generator. | |
| double | m_scoreMean |
| Stores the mean score for the population. | |
| double | m_scoreRMS |
| Stores the score RMS for the population. | |
| std::vector< std::vector< IModel * > > | m_parents |
| Stores the list of parents about to be crossed-over. | |
Implements a population of parametric models.
The following behavior is implemented:
Definition at line 16 of file ParametricModelPopulation.h.
| ParametricModelPopulation::ParametricModelPopulation | ( | ) |
Default Constructor.
Definition at line 5 of file ParametricModelPopulation.cxx.
| ParametricModelPopulation::~ParametricModelPopulation | ( | ) |
Destructor.
Definition at line 12 of file ParametricModelPopulation.cxx.
| void ParametricModelPopulation::setFormula | ( | TF1 * | formula | ) |
Sets the formula for this population.
| formula | Formula to be used for this population. |
Definition at line 19 of file ParametricModelPopulation.cxx.
| void ParametricModelPopulation::setMutationSize | ( | double | relativeSize | ) |
Sets the relative size (sigma) of the gaussian noise applied during mutation.
| relativeSize | The relative size (sigma) of the gaussian noise applied during mutation. |
Definition at line 27 of file ParametricModelPopulation.cxx.
|
protectedvirtual |
Implements initialization.
Parameters for the individual models are randomly initialized following uniform distribution in the allowed range as defined in the population's formula.
| The | desired size of the population. |
Implements IPopulation.
Definition at line 38 of file ParametricModelPopulation.cxx.
|
protectedvirtual |
Implements cross-over.
Cross-over is implemented such that each parameter is passed from either parents chosen at random.
| parents | List of parents to be crossed-over. |
Implements IPopulation.
Definition at line 62 of file ParametricModelPopulation.cxx.
|
protectedvirtual |
Implements mutation.
Mutation is implemented such that a random parameter is chosen and then modified by adding a gaussian noise component. The size of the gaussian noise is controlled via setMutationSize().
| imodel | Model to be mutated. |
Implements IPopulation.
Definition at line 110 of file ParametricModelPopulation.cxx.
1.8.13