GeneticAlgoithm
Implementation of the genetic algorithm
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
IFigureOfMerit Class Referenceabstract

Abstract class representing a figure of merit. More...

#include <IFigureOfMerit.h>

Inheritance diagram for IFigureOfMerit:
Inheritance graph
[legend]

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.
 

Detailed Description

Abstract class representing a figure of merit.

A figure of merit should implement three functionalities:

Deriving from this class:

Definition at line 25 of file IFigureOfMerit.h.

Constructor & Destructor Documentation

◆ IFigureOfMerit()

IFigureOfMerit::IFigureOfMerit ( )

Default Constructor

Definition at line 5 of file IFigureOfMerit.cxx.

◆ ~IFigureOfMerit()

IFigureOfMerit::~IFigureOfMerit ( )
virtual

Destructor

Definition at line 10 of file IFigureOfMerit.cxx.

Member Function Documentation

◆ evaluate()

virtual double IFigureOfMerit::evaluate ( IModel model) const
pure virtual

Evaluate the fittness of a model.

Derived classes should implement this method.

Implemented in Chi2FitFigureOfMerit.

◆ accept() [1/2]

bool IFigureOfMerit::accept ( IModel model) const
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.

Parameters
modelThe model to be tested.
Returns
true if the model can be accepted.

Definition at line 36 of file IFigureOfMerit.cxx.

◆ isBetterThan() [1/2]

bool IFigureOfMerit::isBetterThan ( IModel modelToTest,
IModel referenceModel 
) const
virtual

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.

Parameters
modelToTestThe model to be tested.
referenceModelThe model to compare to.
Returns
true if modelToTest is better than referenceModel, false otherwise.

Definition at line 65 of file IFigureOfMerit.cxx.

◆ setAcceptThreshold()

void IFigureOfMerit::setAcceptThreshold ( double  threshold)

Sets the score threshold to accept a model as a final answer.

Parameters
thresholdscore threshold to accept a model as a final answer.

Definition at line 73 of file IFigureOfMerit.cxx.

◆ getAcceptThreshold()

double IFigureOfMerit::getAcceptThreshold ( ) const

Returns the score threshold to accept a model as a final answer.

Returns
the score threshold to accept a model as a final answer.

Definition at line 81 of file IFigureOfMerit.cxx.

◆ accept() [2/2]

bool IFigureOfMerit::accept ( double  score) const
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.

Parameters
scoreThe score of the model to be tested.
Returns
true if the score can be accepted.

Definition at line 22 of file IFigureOfMerit.cxx.

◆ isBetterThan() [2/2]

bool IFigureOfMerit::isBetterThan ( double  scoreToTest,
double  referenceScore 
) const
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.

Parameters
scoreToTestThe score of the model to be tested.
referenceScoreThe score of the model to compare to.
Returns
true if scoreToTest is better than referenceScore, false otherwise.

Reimplemented in Chi2FitFigureOfMerit.

Definition at line 50 of file IFigureOfMerit.cxx.


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