aGrUM  0.14.1
IApproximationSchemeConfiguration.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
30 #ifndef GUM_APPROXIMATION_SCHEME_CONFIGURATION_H
31 #define GUM_APPROXIMATION_SCHEME_CONFIGURATION_H
32 
33 #include <agrum/agrum.h>
34 #include <agrum/core/math/math.h>
36 #include <agrum/core/timer.h>
37 
38 namespace gum {
39 
55  public:
57  Signaler3< Size, double, double > onProgress;
58 
60  Signaler1< std::string > onStop;
61 
63  enum class ApproximationSchemeSTATE : char {
64  Undefined,
65  Continue,
66  Epsilon,
67  Rate,
68  Limit,
69  TimeLimit,
70  Stopped
71  };
72 
73  // ======================================================================
75  // ======================================================================
77 
81 
87 
88  // ======================================================================
90  // ======================================================================
92 
97  std::string messageApproximationScheme() const;
98 
108  virtual void setEpsilon(double eps) = 0;
109 
114  virtual double epsilon() const = 0;
115 
119  virtual void disableEpsilon() = 0;
120 
124  virtual void enableEpsilon() = 0;
125 
132  virtual bool isEnabledEpsilon() const = 0;
133 
143  virtual void setMinEpsilonRate(double rate) = 0;
144 
149  virtual double minEpsilonRate() const = 0;
150 
154  virtual void disableMinEpsilonRate() = 0;
155 
159  virtual void enableMinEpsilonRate() = 0;
160 
167  virtual bool isEnabledMinEpsilonRate() const = 0;
168 
177  virtual void setMaxIter(Size max) = 0;
178 
183  virtual Size maxIter() const = 0;
184 
188  virtual void disableMaxIter() = 0;
189 
193  virtual void enableMaxIter() = 0;
194 
201  virtual bool isEnabledMaxIter() const = 0;
202 
211  virtual void setMaxTime(double timeout) = 0;
212 
217  virtual double maxTime() const = 0;
218 
223  virtual double currentTime() const = 0;
224 
229  virtual void disableMaxTime() = 0;
230 
234  virtual void enableMaxTime() = 0;
235 
242  virtual bool isEnabledMaxTime() const = 0;
243 
249  virtual void setPeriodSize(Size p) = 0;
250 
255  virtual Size periodSize() const = 0;
256 
261  virtual void setVerbosity(bool v) = 0;
262 
267  virtual bool verbosity() const = 0;
268 
274 
280  virtual Size nbrIterations() const = 0;
281 
288  virtual const std::vector< double >& history() const = 0;
289  };
290 } // namespace gum
291 
292 #ifndef GUM_NO_INLINE
294 #endif
295 
296 #endif // GUM_APPROXIMATION_SCHEME_CONFIGURATION_H
Useful macros for maths.
virtual double epsilon() const =0
Returns the value of epsilon.
virtual void setMaxTime(double timeout)=0
Stopping criterion on timeout.
virtual bool isEnabledMaxTime() const =0
Returns true if stopping criterion on timeout is enabled, false otherwise.
Signaler3< Size, double, double > onProgress
Progression, error and time.
virtual void disableMaxTime()=0
Disable stopping criterion on timeout.
This file contains getters and setters definition for ApproximationScheme settings.
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 bool isEnabledMinEpsilonRate() const =0
Returns true if stopping criterion on epsilon rate is enabled, false otherwise.
virtual ApproximationSchemeSTATE stateApproximationScheme() const =0
Returns the approximation scheme state.
Class used to compute response times for benchmark purposes.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
virtual Size nbrIterations() const =0
Returns the number of iterations.
virtual Size periodSize() const =0
Returns the period size.
Classes of signaler.
virtual void disableMinEpsilonRate()=0
Disable stopping criterion on epsilon rate.
virtual const std::vector< double > & history() const =0
Returns the scheme history.
virtual void enableMaxTime()=0
Enable stopping criterion on timeout.
Signaler1< std::string > onStop
Criteria messageApproximationScheme.
virtual double maxTime() const =0
Returns the timeout (in seconds).
virtual void setMaxIter(Size max)=0
Stopping criterion on number of iterations.
virtual void setVerbosity(bool v)=0
Set the verbosity on (true) or off (false).
virtual Size maxIter() const =0
Returns the criterion on number of iterations.
virtual double currentTime() const =0
Returns the current running time in second.
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 minEpsilonRate() const =0
Returns the value of the minimal epsilon rate.
virtual void setMinEpsilonRate(double rate)=0
Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|).
virtual bool isEnabledMaxIter() const =0
Returns true if stopping criterion on max iterations is enabled, false otherwise. ...
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
virtual void disableEpsilon()=0
Disable stopping criterion on epsilon.
ApproximationSchemeSTATE
The different state of an approximation scheme.
virtual void setPeriodSize(Size p)=0
How many samples between two stopping is enable.
virtual void disableMaxIter()=0
Disable stopping criterion on max iterations.
virtual void enableMinEpsilonRate()=0
Enable stopping criterion on epsilon rate.
virtual void enableMaxIter()=0
Enable stopping criterion on max iterations.
virtual bool verbosity() const =0
Returns true if verbosity is enabled.