GeneticAlgoithm
Implementation of the genetic algorithm
|
Abstract class representing a figure of merit. More...
#include <IFigureOfMerit.h>
Public Member Functions | |
IFigureOfMerit () | |
virtual | ~IFigureOfMerit () |
virtual double | evaluate (IModel *model) const =0 |
Evaluate the fittness of a model. More... | |
virtual bool | accept (IModel *model) const |
virtual bool | isBetterThan (IModel *scoreToTest, IModel *referenceModel) const |
void | setAcceptThreshold (double acceptThreshold) |
double | getAcceptThreshold () const |
Protected Member Functions | |
virtual bool | accept (double scrore) const |
virtual bool | isBetterThan (double scoreToTest, double referenceScore) const |
Protected Attributes | |
double | m_acceptThreshold |
Stores the score threshold to accept a model as a final answer. | |
Abstract class representing a figure of merit.
A figure of merit should implement three functionalities:
Deriving from this class:
evaluate()
method if the score handling behavior is adequate.accept()
and/or isBetterThan()
versions that take scores as input to modify the handling of the scores, e.g. a lower score is may be better.accept()
and isBetterThan()
that take a IModel as input. In this case, the fuction evaluate()
may simply return a dummy value. Definition at line 25 of file IFigureOfMerit.h.
IFigureOfMerit::IFigureOfMerit | ( | ) |
Default Constructor
Definition at line 5 of file IFigureOfMerit.cxx.
|
virtual |
Destructor
Definition at line 10 of file IFigureOfMerit.cxx.
|
pure virtual |
Evaluate the fittness of a model.
Derived classes should implement this method.
Implemented in Chi2FitFigureOfMerit.
|
virtual |
Decide if a model can be accepted as a final answer.
This is an overloaded function. The default behavior is to apply a threshold on the score.
Derived classes can override this method if the decision is not based solely on the score.
model | The model to be tested. |
Definition at line 36 of file IFigureOfMerit.cxx.
Compares two Models
This is an overloaded function. The default behavior is: higher score is better.
Derived classes can override this method if the comparison is not based solely on the score.
modelToTest | The model to be tested. |
referenceModel | The model to compare to. |
Definition at line 65 of file IFigureOfMerit.cxx.
void IFigureOfMerit::setAcceptThreshold | ( | double | threshold | ) |
Sets the score threshold to accept a model as a final answer.
threshold | score threshold to accept a model as a final answer. |
Definition at line 73 of file IFigureOfMerit.cxx.
double IFigureOfMerit::getAcceptThreshold | ( | ) | const |
Returns the score threshold to accept a model as a final answer.
Definition at line 81 of file IFigureOfMerit.cxx.
|
protectedvirtual |
Decide if a model's score can be accepted as a final answer.
The default behavior is to apply a threshold on the score.
Derived classes can override this method if the default behaviour is not adequate.
score | The score of the model to be tested. |
Definition at line 22 of file IFigureOfMerit.cxx.
|
protectedvirtual |
Compares two scores
The default behavior is: higher score is better.
Derived classes can override this method if the default behaviour is not adequate.
scoreToTest | The score of the model to be tested. |
referenceScore | The score of the model to compare to. |
Reimplemented in Chi2FitFigureOfMerit.
Definition at line 50 of file IFigureOfMerit.cxx.