aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::IApproximationSchemeConfiguration Class Referenceabstract

Approximation Scheme. More...

#include <IApproximationSchemeConfiguration.h>

Inheritance diagram for gum::IApproximationSchemeConfiguration:

Public Types

enum class  ApproximationSchemeSTATE : char {
  Undefined , Continue , Epsilon , Rate ,
  Limit , TimeLimit , Stopped
}
 The different state of an approximation scheme. More...

Public Member Functions

Constructor and destructor
 IApproximationSchemeConfiguration ()
 Class constructors.
virtual ~IApproximationSchemeConfiguration ()
 Class destructor.
Getters and setters
std::string messageApproximationScheme () const
 Returns the approximation scheme message.
virtual void setEpsilon (double eps)=0
 Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|.
virtual double epsilon () const =0
 Returns the value of epsilon.
virtual void disableEpsilon ()=0
 Disable stopping criterion on epsilon.
virtual void enableEpsilon ()=0
 Enable stopping criterion on epsilon.
virtual bool isEnabledEpsilon () const =0
 Returns true if stopping criterion on epsilon is enabled, false otherwise.
virtual void setMinEpsilonRate (double rate)=0
 Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|).
virtual double minEpsilonRate () const =0
 Returns the value of the minimal epsilon rate.
virtual void disableMinEpsilonRate ()=0
 Disable stopping criterion on epsilon rate.
virtual void enableMinEpsilonRate ()=0
 Enable stopping criterion on epsilon rate.
virtual bool isEnabledMinEpsilonRate () const =0
 Returns true if stopping criterion on epsilon rate is enabled, false otherwise.
virtual void setMaxIter (Size max)=0
 Stopping criterion on number of iterations.
virtual Size maxIter () const =0
 Returns the criterion on number of iterations.
virtual void disableMaxIter ()=0
 Disable stopping criterion on max iterations.
virtual void enableMaxIter ()=0
 Enable stopping criterion on max iterations.
virtual bool isEnabledMaxIter () const =0
 Returns true if stopping criterion on max iterations is enabled, false otherwise.
virtual void setMaxTime (double timeout)=0
 Stopping criterion on timeout.
virtual double maxTime () const =0
 Returns the timeout (in seconds).
virtual double currentTime () const =0
 Returns the current running time in second.
virtual void disableMaxTime ()=0
 Disable stopping criterion on timeout.
virtual void enableMaxTime ()=0
 Enable stopping criterion on timeout.
virtual bool isEnabledMaxTime () const =0
 Returns true if stopping criterion on timeout is enabled, false otherwise.
virtual void setPeriodSize (Size p)=0
 How many samples between two stopping is enable.
virtual Size periodSize () const =0
 Returns the period size.
virtual void setVerbosity (bool v)=0
 Set the verbosity on (true) or off (false).
virtual bool verbosity () const =0
 Returns true if verbosity is enabled.
virtual ApproximationSchemeSTATE stateApproximationScheme () const =0
 Returns the approximation scheme state.
virtual Size nbrIterations () const =0
 Returns the number of iterations.
virtual const std::vector< double > & history () const =0
 Returns the scheme history.

Public Attributes

Signaler3< Size, double, doubleonProgress
 Progression, error and time.
Signaler1< const std::string & > onStop
 Criteria messageApproximationScheme.

Detailed Description

Approximation Scheme.

Warning
Doxygen does not like spanning command on multiple line, so we could not configure it with the correct include directive. Use the following code snippet to include this file.
This file contains getters and setters definition for ApproximationScheme settings.

An interface for configuration of approximation scheme.

Definition at line 77 of file IApproximationSchemeConfiguration.h.

Member Enumeration Documentation

◆ ApproximationSchemeSTATE

The different state of an approximation scheme.

Enumerator
Undefined 
Continue 
Epsilon 
Rate 
Limit 
TimeLimit 
Stopped 

Definition at line 86 of file IApproximationSchemeConfiguration.h.

86 : char {
87 Undefined,
88 Continue,
89 Epsilon,
90 Rate,
91 Limit,
92 TimeLimit,
93 Stopped
94 };

Constructor & Destructor Documentation

◆ IApproximationSchemeConfiguration()

gum::IApproximationSchemeConfiguration::IApproximationSchemeConfiguration ( )

Class constructors.

Definition at line 56 of file IApproximationSchemeConfiguration.cpp.

56 {
57 GUM_CONSTRUCTOR(IApproximationSchemeConfiguration);
58 }

References IApproximationSchemeConfiguration().

Referenced by IApproximationSchemeConfiguration(), gum::learning::IBNLearner::IBNLearner(), and ~IApproximationSchemeConfiguration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~IApproximationSchemeConfiguration()

gum::IApproximationSchemeConfiguration::~IApproximationSchemeConfiguration ( )
virtual

Class destructor.

Definition at line 60 of file IApproximationSchemeConfiguration.cpp.

60 {
62 }

References IApproximationSchemeConfiguration().

Here is the call graph for this function:

Member Function Documentation

◆ currentTime()

virtual double gum::IApproximationSchemeConfiguration::currentTime ( ) const
pure virtual

Returns the current running time in second.

Returns
Returns the current running time in second.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ disableEpsilon()

virtual void gum::IApproximationSchemeConfiguration::disableEpsilon ( )
pure virtual

Disable stopping criterion on epsilon.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ disableMaxIter()

virtual void gum::IApproximationSchemeConfiguration::disableMaxIter ( )
pure virtual

Disable stopping criterion on max iterations.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ disableMaxTime()

virtual void gum::IApproximationSchemeConfiguration::disableMaxTime ( )
pure virtual

Disable stopping criterion on timeout.

Returns
Disable stopping criterion on timeout.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ disableMinEpsilonRate()

virtual void gum::IApproximationSchemeConfiguration::disableMinEpsilonRate ( )
pure virtual

Disable stopping criterion on epsilon rate.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ enableEpsilon()

virtual void gum::IApproximationSchemeConfiguration::enableEpsilon ( )
pure virtual

Enable stopping criterion on epsilon.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ enableMaxIter()

virtual void gum::IApproximationSchemeConfiguration::enableMaxIter ( )
pure virtual

Enable stopping criterion on max iterations.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ enableMaxTime()

virtual void gum::IApproximationSchemeConfiguration::enableMaxTime ( )
pure virtual

Enable stopping criterion on timeout.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ enableMinEpsilonRate()

virtual void gum::IApproximationSchemeConfiguration::enableMinEpsilonRate ( )
pure virtual

Enable stopping criterion on epsilon rate.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ epsilon()

virtual double gum::IApproximationSchemeConfiguration::epsilon ( ) const
pure virtual

Returns the value of epsilon.

Returns
Returns the value of epsilon.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

Referenced by messageApproximationScheme().

Here is the caller graph for this function:

◆ history()

virtual const std::vector< double > & gum::IApproximationSchemeConfiguration::history ( ) const
pure virtual

Returns the scheme history.

Returns
Returns the scheme history.
Exceptions
OperationNotAllowedRaised if the scheme did not performed or if verbosity is set to false.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ isEnabledEpsilon()

virtual bool gum::IApproximationSchemeConfiguration::isEnabledEpsilon ( ) const
pure virtual

Returns true if stopping criterion on epsilon is enabled, false otherwise.

Returns
Returns true if stopping criterion on epsilon is enabled, false otherwise.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ isEnabledMaxIter()

virtual bool gum::IApproximationSchemeConfiguration::isEnabledMaxIter ( ) const
pure virtual

Returns true if stopping criterion on max iterations is enabled, false otherwise.

Returns
Returns true if stopping criterion on max iterations is enabled, false otherwise.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ isEnabledMaxTime()

virtual bool gum::IApproximationSchemeConfiguration::isEnabledMaxTime ( ) const
pure virtual

Returns true if stopping criterion on timeout is enabled, false otherwise.

Returns
Returns true if stopping criterion on timeout is enabled, false otherwise.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ isEnabledMinEpsilonRate()

virtual bool gum::IApproximationSchemeConfiguration::isEnabledMinEpsilonRate ( ) const
pure virtual

Returns true if stopping criterion on epsilon rate is enabled, false otherwise.

Returns
Returns true if stopping criterion on epsilon rate is enabled, false otherwise.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ maxIter()

virtual Size gum::IApproximationSchemeConfiguration::maxIter ( ) const
pure virtual

Returns the criterion on number of iterations.

Returns
Returns the criterion on number of iterations.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

Referenced by messageApproximationScheme().

Here is the caller graph for this function:

◆ maxTime()

virtual double gum::IApproximationSchemeConfiguration::maxTime ( ) const
pure virtual

Returns the timeout (in seconds).

Returns
Returns the timeout (in seconds).

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

Referenced by messageApproximationScheme().

Here is the caller graph for this function:

◆ messageApproximationScheme()

INLINE std::string gum::IApproximationSchemeConfiguration::messageApproximationScheme ( ) const

Returns the approximation scheme message.

Returns
Returns the approximation scheme message.

Definition at line 59 of file IApproximationSchemeConfiguration_inl.h.

59 {
60 std::stringstream s;
61
62 switch (stateApproximationScheme()) {
63 case ApproximationSchemeSTATE::Continue : s << "in progress"; break;
64
65 case ApproximationSchemeSTATE::Epsilon : s << "stopped with epsilon=" << epsilon(); break;
66
67 case ApproximationSchemeSTATE::Rate : s << "stopped with rate=" << minEpsilonRate(); break;
68
69 case ApproximationSchemeSTATE::Limit : s << "stopped with max iteration=" << maxIter(); break;
70
71 case ApproximationSchemeSTATE::TimeLimit : s << "stopped with timeout=" << maxTime(); break;
72
73 case ApproximationSchemeSTATE::Stopped : s << "stopped on request"; break;
74
75 case ApproximationSchemeSTATE::Undefined : s << "undefined state"; break;
76 };
77
78 return s.str();
79 }
virtual double epsilon() const =0
Returns the value of epsilon.
virtual ApproximationSchemeSTATE stateApproximationScheme() const =0
Returns the approximation scheme state.
virtual double minEpsilonRate() const =0
Returns the value of the minimal epsilon rate.
virtual Size maxIter() const =0
Returns the criterion on number of iterations.
virtual double maxTime() const =0
Returns the timeout (in seconds).

References Continue, Epsilon, epsilon(), Limit, maxIter(), maxTime(), minEpsilonRate(), Rate, stateApproximationScheme(), Stopped, TimeLimit, and Undefined.

Referenced by gum::credal::InferenceEngine< GUM_SCALAR >::getApproximationSchemeMsg(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::stateApproximationScheme().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ minEpsilonRate()

virtual double gum::IApproximationSchemeConfiguration::minEpsilonRate ( ) const
pure virtual

Returns the value of the minimal epsilon rate.

Returns
Returns the value of the minimal epsilon rate.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

Referenced by messageApproximationScheme().

Here is the caller graph for this function:

◆ nbrIterations()

virtual Size gum::IApproximationSchemeConfiguration::nbrIterations ( ) const
pure virtual

Returns the number of iterations.

Returns
Returns the number of iterations.
Exceptions
OperationNotAllowedRaised if the scheme did not perform.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ periodSize()

virtual Size gum::IApproximationSchemeConfiguration::periodSize ( ) const
pure virtual

Returns the period size.

Returns
Returns the period size.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ setEpsilon()

virtual void gum::IApproximationSchemeConfiguration::setEpsilon ( double eps)
pure virtual

Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|.

If the criterion was disabled it will be enabled.

Parameters
epsThe new epsilon value.
Exceptions
OutOfBoundsRaised if eps < 0.

Implemented in gum::ApproximationScheme, gum::learning::EMApproximationScheme, and gum::learning::IBNLearner.

◆ setMaxIter()

virtual void gum::IApproximationSchemeConfiguration::setMaxIter ( Size max)
pure virtual

Stopping criterion on number of iterations.

If the criterion was disabled it will be enabled.

Parameters
maxThe maximum number of iterations.
Exceptions
OutOfBoundsRaised if max <= 1.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ setMaxTime()

virtual void gum::IApproximationSchemeConfiguration::setMaxTime ( double timeout)
pure virtual

Stopping criterion on timeout.

If the criterion was disabled it will be enabled.

Parameters
timeoutThe timeout value in seconds.
Exceptions
OutOfBoundsRaised if timeout <= 0.0.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ setMinEpsilonRate()

virtual void gum::IApproximationSchemeConfiguration::setMinEpsilonRate ( double rate)
pure virtual

Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|).

If the criterion was disabled it will be enabled

Parameters
rateThe minimal epsilon rate.
Exceptions
OutOfBoundsif rate<0

Implemented in gum::ApproximationScheme, gum::learning::EMApproximationScheme, and gum::learning::IBNLearner.

◆ setPeriodSize()

virtual void gum::IApproximationSchemeConfiguration::setPeriodSize ( Size p)
pure virtual

How many samples between two stopping is enable.

Parameters
pThe new period value.
Exceptions
OutOfBoundsRaised if p < 1.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ setVerbosity()

virtual void gum::IApproximationSchemeConfiguration::setVerbosity ( bool v)
pure virtual

Set the verbosity on (true) or off (false).

Parameters
vIf true, then verbosity is turned on.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

◆ stateApproximationScheme()

virtual ApproximationSchemeSTATE gum::IApproximationSchemeConfiguration::stateApproximationScheme ( ) const
pure virtual

Returns the approximation scheme state.

Returns
Returns the approximation scheme state.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

Referenced by messageApproximationScheme().

Here is the caller graph for this function:

◆ verbosity()

virtual bool gum::IApproximationSchemeConfiguration::verbosity ( ) const
pure virtual

Returns true if verbosity is enabled.

Returns
Returns true if verbosity is enabled.

Implemented in gum::ApproximationScheme, and gum::learning::IBNLearner.

Member Data Documentation

◆ onProgress

◆ onStop

Signaler1< const std::string& > gum::IApproximationSchemeConfiguration::onStop

Criteria messageApproximationScheme.

Definition at line 83 of file IApproximationSchemeConfiguration.h.

Referenced by gum::learning::IBNLearner::distributeStop().


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