aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
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 55 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 64 of file IApproximationSchemeConfiguration.h.

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

Constructor & Destructor Documentation

◆ IApproximationSchemeConfiguration()

gum::IApproximationSchemeConfiguration::IApproximationSchemeConfiguration ( )

Class constructors.

Definition at line 36 of file IApproximationSchemeConfiguration.cpp.

References gum::Set< Key, Alloc >::emplace().

36  {
37  GUM_CONSTRUCTOR(IApproximationSchemeConfiguration);
38  }
+ Here is the call graph for this function:

◆ ~IApproximationSchemeConfiguration()

gum::IApproximationSchemeConfiguration::~IApproximationSchemeConfiguration ( )

Class destructor.

Definition at line 40 of file IApproximationSchemeConfiguration.cpp.

References gum::Set< Key, Alloc >::emplace().

40  {
41  GUM_DESTRUCTOR(IApproximationSchemeConfiguration);
42  }
+ 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::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.

◆ 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.

◆ 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.

◆ 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 gum::Set< Key, Alloc >::emplace().

38  {
39  std::stringstream s;
40 
41  switch (stateApproximationScheme()) {
43  s << "in progress";
44  break;
45 
47  s << "stopped with epsilon=" << epsilon();
48  break;
49 
51  s << "stopped with rate=" << minEpsilonRate();
52  break;
53 
55  s << "stopped with max iteration=" << maxIter();
56  break;
57 
59  s << "stopped with timeout=" << maxTime();
60  break;
61 
63  s << "stopped on request";
64  break;
65 
67  s << "undefined state";
68  break;
69  };
70 
71  return s.str();
72  }
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:

◆ 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.

◆ 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.

◆ 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

Signaler3< Size, double, double > gum::IApproximationSchemeConfiguration::onProgress

Progression, error and time.

Definition at line 58 of file IApproximationSchemeConfiguration.h.

◆ onStop

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

Criteria messageApproximationScheme.

Definition at line 61 of file IApproximationSchemeConfiguration.h.


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