34 #ifndef GUM_APPROXIMATION_SCHEME_H 35 #define GUM_APPROXIMATION_SCHEME_H 37 #include <agrum/agrum.h> 38 #include <agrum/tools/core/math/math_utils.h> 39 #include <agrum/tools/core/approximations/IApproximationSchemeConfiguration.h> 40 #include <agrum/tools/core/signal/signaler.h> 41 #include <agrum/tools/core/timer.h> 364 void stopScheme_(ApproximationSchemeSTATE new_state);
423 #ifndef GUM_NO_INLINE 424 # include <agrum/tools/core/approximations/approximationScheme_inl.h> double max_time_
The timeout.
double minEpsilonRate() const
Returns the value of the minimal epsilon rate.
Size burn_in_
Number of iterations before checking stopping criteria.
void disableMinEpsilonRate()
Disable stopping criterion on epsilon rate.
double maxTime() const
Returns the timeout (in seconds).
ApproximationSchemeSTATE current_state_
The current state.
void enableMinEpsilonRate()
Enable stopping criterion on epsilon rate.
INLINE void emplace(Args &&... args)
void stopScheme_(ApproximationSchemeSTATE new_state)
Stop the scheme given a new state.
void setPeriodSize(Size p)
How many samples between two stopping is enable.
Size remainingBurnIn()
Returns the remaining burn in.
bool startOfPeriod()
Returns true if we are at the beginning of a period (compute error is mandatory). ...
void initApproximationScheme()
Initialise the scheme.
bool enabled_max_iter_
If true, the maximum iterations stopping criterion is enabled.
void setMinEpsilonRate(double rate)
Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|).
void setVerbosity(bool v)
Set the verbosity on (true) or off (false).
ApproximationScheme(bool verbosity=false)
Size periodSize() const
Returns the period size.
void setMaxTime(double timeout)
Stopping criterion on timeout.
void disableEpsilon()
Disable stopping criterion on epsilon.
double last_epsilon_
Last epsilon value.
Size nbrIterations() const
Returns the number of iterations.
bool continueApproximationScheme(double error)
Update the scheme w.r.t the new error.
double eps_
Threshold for convergence.
double min_rate_eps_
Threshold for the epsilon rate.
bool enabled_max_time_
If true, the timeout is enabled.
bool isEnabledMinEpsilonRate() const
Returns true if stopping criterion on epsilon rate is enabled, false otherwise.
void disableMaxTime()
Disable stopping criterion on timeout.
double current_rate_
Current rate.
void enableMaxIter()
Enable stopping criterion on max iterations.
void stopApproximationScheme()
Stop the approximation scheme.
Size maxIter() const
Returns the criterion on number of iterations.
Size max_iter_
The maximum iterations.
double current_epsilon_
Current epsilon.
bool enabled_eps_
If true, the threshold convergence is enabled.
const std::vector< double > & history() const
Returns the scheme history.
bool verbosity_
If true, verbosity is enabled.
Size period_size_
Checking criteria frequency.
ApproximationSchemeSTATE stateApproximationScheme() const
Returns the approximation scheme state.
void setMaxIter(Size max)
Stopping criterion on number of iterations.
std::vector< double > history_
The scheme history, used only if verbosity == true.
bool isEnabledMaxIter() const
Returns true if stopping criterion on max iterations is enabled, false otherwise. ...
bool verbosity() const
Returns true if verbosity is enabled.
double epsilon() const
Returns the value of epsilon.
bool isEnabledEpsilon() const
Returns true if stopping criterion on epsilon is enabled, false otherwise.
bool isEnabledMaxTime() const
Returns true if stopping criterion on timeout is enabled, false otherwise.
void setEpsilon(double eps)
Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|.
double currentTime() const
Returns the current running time in second.
bool enabled_min_rate_eps_
If true, the minimal threshold for epsilon rate is enabled.
void disableMaxIter()
Disable stopping criterion on max iterations.
Size current_step_
The current step.
virtual ~ApproximationScheme()
void enableMaxTime()
Enable stopping criterion on timeout.
void updateApproximationScheme(unsigned int incr=1)
Update the scheme w.r.t the new error and increment steps.
void enableEpsilon()
Enable stopping criterion on epsilon.