aGrUM  0.13.2
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 <cmath>
34 
35 #include <agrum/agrum.h>
37 #include <agrum/core/timer.h>
38 
39 namespace gum {
40 
56  public:
58  Signaler3< Size, double, double > onProgress;
59 
61  Signaler1< std::string > onStop;
62 
64  enum class ApproximationSchemeSTATE : char {
65  Undefined,
66  Continue,
67  Epsilon,
68  Rate,
69  Limit,
70  TimeLimit,
71  Stopped
72  };
73 
74  // ======================================================================
76  // ======================================================================
78 
82 
88 
89  // ======================================================================
91  // ======================================================================
93 
98  std::string messageApproximationScheme() const;
99 
109  virtual void setEpsilon(double eps) = 0;
110 
115  virtual double epsilon() const = 0;
116 
120  virtual void disableEpsilon() = 0;
121 
125  virtual void enableEpsilon() = 0;
126 
133  virtual bool isEnabledEpsilon() const = 0;
134 
144  virtual void setMinEpsilonRate(double rate) = 0;
145 
150  virtual double minEpsilonRate() const = 0;
151 
155  virtual void disableMinEpsilonRate() = 0;
156 
160  virtual void enableMinEpsilonRate() = 0;
161 
168  virtual bool isEnabledMinEpsilonRate() const = 0;
169 
178  virtual void setMaxIter(Size max) = 0;
179 
184  virtual Size maxIter() const = 0;
185 
189  virtual void disableMaxIter() = 0;
190 
194  virtual void enableMaxIter() = 0;
195 
202  virtual bool isEnabledMaxIter() const = 0;
203 
212  virtual void setMaxTime(double timeout) = 0;
213 
218  virtual double maxTime() const = 0;
219 
224  virtual double currentTime() const = 0;
225 
230  virtual void disableMaxTime() = 0;
231 
235  virtual void enableMaxTime() = 0;
236 
243  virtual bool isEnabledMaxTime() const = 0;
244 
250  virtual void setPeriodSize(Size p) = 0;
251 
256  virtual Size periodSize() const = 0;
257 
262  virtual void setVerbosity(bool v) = 0;
263 
268  virtual bool verbosity() const = 0;
269 
275 
281  virtual Size nbrIterations() const = 0;
282 
289  virtual const std::vector< double >& history() const = 0;
290  };
291 } // namespace gum
292 
293 #ifndef GUM_NO_INLINE
295 #endif
296 
297 #endif // GUM_APPROXIMATION_SCHEME_CONFIGURATION_H
unsigned long Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:50
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.
std::string messageApproximationScheme() const
Returns the approximation scheme message.
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.
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. ...
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.