aGrUM  0.14.3
gum::IApproximationSchemeConfiguration Class Referenceabstract

Approximation Scheme. More...

#include <IApproximationSchemeConfiguration.h>

+ Inheritance diagram for gum::IApproximationSchemeConfiguration:

Public Attributes

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

Public Member Functions

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

Public Types

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

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.

An interface for configuration of approximation scheme.

Definition at line 54 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 63 of file IApproximationSchemeConfiguration.h.

63  : char {
64  Undefined,
65  Continue,
66  Epsilon,
67  Rate,
68  Limit,
69  TimeLimit,
70  Stopped
71  };

Constructor & Destructor Documentation

◆ IApproximationSchemeConfiguration()

gum::IApproximationSchemeConfiguration::IApproximationSchemeConfiguration ( )

Class constructors.

Definition at line 35 of file IApproximationSchemeConfiguration.cpp.

35  {
36  GUM_CONSTRUCTOR(IApproximationSchemeConfiguration);
37  }

◆ ~IApproximationSchemeConfiguration()

gum::IApproximationSchemeConfiguration::~IApproximationSchemeConfiguration ( )

Class destructor.

Definition at line 39 of file IApproximationSchemeConfiguration.cpp.

39  {
40  GUM_DESTRUCTOR(IApproximationSchemeConfiguration);
41  }

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::learning::genericBNLearner, and gum::ApproximationScheme.

◆ disableEpsilon()

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

Disable stopping criterion on epsilon.

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

◆ disableMaxIter()

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

Disable stopping criterion on max iterations.

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

◆ disableMaxTime()

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

Disable stopping criterion on timeout.

Returns
Disable stopping criterion on timeout.

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

◆ disableMinEpsilonRate()

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

Disable stopping criterion on epsilon rate.

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

◆ enableEpsilon()

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

Enable stopping criterion on epsilon.

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

◆ enableMaxIter()

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

Enable stopping criterion on max iterations.

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

◆ enableMaxTime()

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

Enable stopping criterion on timeout.

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

◆ enableMinEpsilonRate()

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

Enable stopping criterion on epsilon rate.

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

◆ epsilon()

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

Returns the value of epsilon.

Returns
Returns the value of epsilon.

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

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::learning::genericBNLearner, and gum::ApproximationScheme.

◆ 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::learning::genericBNLearner, and gum::ApproximationScheme.

◆ 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::learning::genericBNLearner, and gum::ApproximationScheme.

◆ 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::learning::genericBNLearner, and gum::ApproximationScheme.

◆ 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::learning::genericBNLearner, and gum::ApproximationScheme.

◆ 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::learning::genericBNLearner, and gum::ApproximationScheme.

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::learning::genericBNLearner, and gum::ApproximationScheme.

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 38 of file IApproximationSchemeConfiguration_inl.h.

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

Referenced by gum::ApproximationScheme::_stopScheme(), gum::ApproximationScheme::continueApproximationScheme(), and gum::credal::InferenceEngine< GUM_SCALAR >::getApproximationSchemeMsg().

38  {
39  std::stringstream s;
40 
41  switch (stateApproximationScheme()) {
42  case ApproximationSchemeSTATE::Continue: s << "in progress"; break;
43 
45  s << "stopped with epsilon=" << epsilon();
46  break;
47 
49  s << "stopped with rate=" << minEpsilonRate();
50  break;
51 
53  s << "stopped with max iteration=" << maxIter();
54  break;
55 
57  s << "stopped with timeout=" << maxTime();
58  break;
59 
60  case ApproximationSchemeSTATE::Stopped: s << "stopped on request"; break;
61 
62  case ApproximationSchemeSTATE::Undefined: s << "undefined state"; break;
63  };
64 
65  return s.str();
66  }
virtual double epsilon() const =0
Returns the value of epsilon.
virtual ApproximationSchemeSTATE stateApproximationScheme() const =0
Returns the approximation scheme state.
virtual double maxTime() const =0
Returns the timeout (in seconds).
virtual Size maxIter() const =0
Returns the criterion on number of iterations.
virtual double minEpsilonRate() const =0
Returns the value of the minimal epsilon rate.
+ 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::learning::genericBNLearner, and gum::ApproximationScheme.

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::learning::genericBNLearner, and gum::ApproximationScheme.

◆ periodSize()

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

Returns the period size.

Returns
Returns the period size.

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

◆ 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
OutOfLowerBoundRaised if eps < 0.

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

◆ 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
OutOfLowerBoundRaised if max <= 1.

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

◆ 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
OutOfLowerBoundRaised if timeout <= 0.0.

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

◆ 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
OutOfLowerBoundif rate<0

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

◆ setPeriodSize()

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

How many samples between two stopping is enable.

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

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

◆ 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::learning::genericBNLearner, and gum::ApproximationScheme.

◆ stateApproximationScheme()

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

Returns the approximation scheme state.

Returns
Returns the approximation scheme state.

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

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::learning::genericBNLearner, and gum::ApproximationScheme.

Member Data Documentation

◆ onProgress

◆ onStop

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

Criteria messageApproximationScheme.

Definition at line 60 of file IApproximationSchemeConfiguration.h.

Referenced by gum::ApproximationScheme::_stopScheme(), and gum::learning::genericBNLearner::distributeStop().


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