bpp-core3  3.0.0
bpp::ParametersStopCondition Class Reference

Stop condition on parameters. More...

#include <Bpp/Numeric/Function/OptimizationStopCondition.h>

+ Inheritance diagram for bpp::ParametersStopCondition:
+ Collaboration diagram for bpp::ParametersStopCondition:

Public Member Functions

 ParametersStopCondition (const Optimizer *optimizer)
 
 ParametersStopCondition (const Optimizer *optimizer, double tolerance)
 
 ParametersStopCondition (const Optimizer *optimizer, int burnin)
 
 ParametersStopCondition (const Optimizer *optimizer, double tolerance, int burnin)
 
virtual ~ParametersStopCondition ()
 
ParametersStopConditionclone () const
 Create a copy of this object and send a pointer to it. More...
 
void init ()
 Initialize the condition. More...
 
bool isToleranceReached () const
 Tell if the we reached the desired tolerance with a given new set of estimates. More...
 
double getCurrentTolerance () const
 Get the current tolerance. More...
 
const OptimizergetOptimizer () const
 
void setOptimizer (const Optimizer *optimizer)
 Set the optimizer attached to this instance. More...
 
void setTolerance (double tolerance)
 Set the tolerance parameter. More...
 
double getTolerance () const
 Get the tolerance parameter. More...
 
virtual void resetCounter ()
 
virtual void setBurnin (int burnin)
 
virtual int getBurnin () const
 

Protected Attributes

const Optimizeroptimizer_
 
double tolerance_
 
double callCount_
 Count the number of times the isToleranceReached() function has been called. More...
 
int burnin_
 

Private Attributes

ParameterList lastParametersEstimates_
 The last estimates of the parameters. More...
 
ParameterList newParametersEstimates_
 The new estimates of the parameters. More...
 

Detailed Description

Stop condition on parameters.

This stops the optimization when $\forall i\; |\lambda_{i,t}-\lambda_{i,t-1}| \leq \mbox{tolerance}$, where $\lambda_{i, t}$ is the value of the ith parameter at iteration $t$, and $\lambda_{i, t-1}$ is the value of the ith parameter at iteration $t-1$.

Definition at line 218 of file OptimizationStopCondition.h.

Constructor & Destructor Documentation

◆ ParametersStopCondition() [1/4]

ParametersStopCondition::ParametersStopCondition ( const Optimizer optimizer)

◆ ParametersStopCondition() [2/4]

ParametersStopCondition::ParametersStopCondition ( const Optimizer optimizer,
double  tolerance 
)

◆ ParametersStopCondition() [3/4]

ParametersStopCondition::ParametersStopCondition ( const Optimizer optimizer,
int  burnin 
)

◆ ParametersStopCondition() [4/4]

ParametersStopCondition::ParametersStopCondition ( const Optimizer optimizer,
double  tolerance,
int  burnin 
)

◆ ~ParametersStopCondition()

virtual bpp::ParametersStopCondition::~ParametersStopCondition ( )
inlinevirtual

Definition at line 242 of file OptimizationStopCondition.h.

Member Function Documentation

◆ clone()

ParametersStopCondition* bpp::ParametersStopCondition::clone ( ) const
inlinevirtual

Create a copy of this object and send a pointer to it.

Returns
A pointer toward the copy object.

Implements bpp::OptimizationStopCondition.

Definition at line 244 of file OptimizationStopCondition.h.

◆ getBurnin()

virtual int bpp::AbstractOptimizationStopCondition::getBurnin ( ) const
inlinevirtualinherited

Definition at line 206 of file OptimizationStopCondition.h.

◆ getCurrentTolerance()

double ParametersStopCondition::getCurrentTolerance ( ) const
virtual

◆ getOptimizer()

const Optimizer* bpp::AbstractOptimizationStopCondition::getOptimizer ( ) const
inlinevirtualinherited
Returns
The optimizer to which this instance belongs to.

Implements bpp::OptimizationStopCondition.

Definition at line 199 of file OptimizationStopCondition.h.

◆ getTolerance()

double bpp::AbstractOptimizationStopCondition::getTolerance ( ) const
inlinevirtualinherited

Get the tolerance parameter.

Returns
The tolerance parameter.

Implements bpp::OptimizationStopCondition.

Definition at line 202 of file OptimizationStopCondition.h.

Referenced by bpp::GoldenSectionSearch::GSSStopCondition::isToleranceReached().

◆ init()

◆ isToleranceReached()

bool ParametersStopCondition::isToleranceReached ( ) const
virtual

Tell if the we reached the desired tolerance with a given new set of estimates.

The new parameter list is compared to the last estimates, and the lastParameterEstimates list is actulaized with the newParameters list.

Returns
True if the tolerance level is reached.

Implements bpp::OptimizationStopCondition.

Definition at line 123 of file OptimizationStopCondition.cpp.

References bpp::AbstractOptimizationStopCondition::burnin_, bpp::AbstractOptimizationStopCondition::callCount_, bpp::Parameter::getName(), bpp::ParameterList::getParameter(), bpp::Optimizer::getParameters(), bpp::Parameter::getValue(), lastParametersEstimates_, newParametersEstimates_, bpp::AbstractOptimizationStopCondition::optimizer_, bpp::ParameterList::size(), and bpp::AbstractOptimizationStopCondition::tolerance_.

◆ resetCounter()

virtual void bpp::AbstractOptimizationStopCondition::resetCounter ( )
inlinevirtualinherited

Definition at line 204 of file OptimizationStopCondition.h.

◆ setBurnin()

virtual void bpp::AbstractOptimizationStopCondition::setBurnin ( int  burnin)
inlinevirtualinherited

Definition at line 205 of file OptimizationStopCondition.h.

◆ setOptimizer()

void bpp::AbstractOptimizationStopCondition::setOptimizer ( const Optimizer optimizer)
inlinevirtualinherited

Set the optimizer attached to this instance.

Parameters
optimizerThe optimizer to which this instance belongs to.

Implements bpp::OptimizationStopCondition.

Definition at line 200 of file OptimizationStopCondition.h.

◆ setTolerance()

void bpp::AbstractOptimizationStopCondition::setTolerance ( double  tolerance)
inlinevirtualinherited

Set the tolerance parameter.

Parameters
toleranceThe tolerance parameter.

Implements bpp::OptimizationStopCondition.

Definition at line 201 of file OptimizationStopCondition.h.

Member Data Documentation

◆ burnin_

◆ callCount_

◆ lastParametersEstimates_

ParameterList bpp::ParametersStopCondition::lastParametersEstimates_
mutableprivate

The last estimates of the parameters.

This is used by the isToleranceReached() method.

Definition at line 227 of file OptimizationStopCondition.h.

Referenced by getCurrentTolerance(), and isToleranceReached().

◆ newParametersEstimates_

ParameterList bpp::ParametersStopCondition::newParametersEstimates_
mutableprivate

The new estimates of the parameters.

This is used by the isToleranceReached() method.

Definition at line 234 of file OptimizationStopCondition.h.

Referenced by getCurrentTolerance(), init(), isToleranceReached(), and ParametersStopCondition().

◆ optimizer_

◆ tolerance_


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