GeneticAlgoithm
Implementation of the genetic algorithm
ParametricModelPopulation.h
1 #ifndef PARAMETRICMODELPOPULATION_H
2 #define PARAMETRICMODELPOPULATION_H
3 
4 #include "IPopulation.h"
5 
6 #include <TF1.h>
7 
8 /**
9  * @brief Implements a population of parametric models.
10  *
11  * The following behavior is implemented:
12  * - Initialization: parameters are randomly initialized following uniform distribution in the allowed range.
13  * - Cross-over: each parameter is passed from either parents chosen at random.
14  * - Mutation: a random parameter is chosen and then modified by adding a gaussian noise component.
15  */
17 {
18 
19 public:
20 
21  /** Default Constructor. */
23 
24  /** Destructor. */
26 
27  /** Sets the formula for this population. */
28  void setFormula(TF1 *formula);
29 
30  /** Sets the relative size (sigma) of the gaussian noise applied during mutation. */
31  void setMutationSize(double relativeSize);
32 
33 protected:
34 
35  /** Implements initialization. */
36  virtual void doInitialize(int n);
37 
38  /** Implements cross-over. */
39  virtual void doCrossOver(const std::vector<std::vector<IModel*> > &parents);
40 
41  /** Implements mutation. */
42  virtual void doMutate(IModel *model);
43 
44  TF1 *m_formula; //!< Stores the formula for this population.
45  double m_mutationSize; //!< Stores the relative size (sigma) of the gaussian noise applied during mutation.
46 };
47 
48 #endif
void setMutationSize(double relativeSize)
Abstract class describing a population of models.
Definition: IPopulation.h:27
double m_mutationSize
Stores the relative size (sigma) of the gaussian noise applied during mutation.
Implements a population of parametric models.
virtual void doMutate(IModel *model)
TF1 * m_formula
Stores the formula for this population.
virtual void doCrossOver(const std::vector< std::vector< IModel *> > &parents)
Abstract class describing the interface for a model.
Definition: IModel.h:13