aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
IApproximationSchemeConfiguration.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
51#ifndef GUM_APPROXIMATION_SCHEME_CONFIGURATION_H
52#define GUM_APPROXIMATION_SCHEME_CONFIGURATION_H
53
54#include <agrum/agrum.h>
55
58
60
61namespace gum {
62
78 public:
80 Signaler3< Size, double, double > onProgress;
81
83 Signaler1< const std::string& > onStop;
84
95
96 // ======================================================================
98 // ======================================================================
100
104
110
111 // ======================================================================
113 // ======================================================================
115
120 std::string messageApproximationScheme() const;
121
131 virtual void setEpsilon(double eps) = 0;
132
137 virtual double epsilon() const = 0;
138
142 virtual void disableEpsilon() = 0;
143
147 virtual void enableEpsilon() = 0;
148
155 virtual bool isEnabledEpsilon() const = 0;
156
166 virtual void setMinEpsilonRate(double rate) = 0;
167
172 virtual double minEpsilonRate() const = 0;
173
177 virtual void disableMinEpsilonRate() = 0;
178
182 virtual void enableMinEpsilonRate() = 0;
183
190 virtual bool isEnabledMinEpsilonRate() const = 0;
191
200 virtual void setMaxIter(Size max) = 0;
201
206 virtual Size maxIter() const = 0;
207
211 virtual void disableMaxIter() = 0;
212
216 virtual void enableMaxIter() = 0;
217
224 virtual bool isEnabledMaxIter() const = 0;
225
234 virtual void setMaxTime(double timeout) = 0;
235
240 virtual double maxTime() const = 0;
241
246 virtual double currentTime() const = 0;
247
252 virtual void disableMaxTime() = 0;
253
257 virtual void enableMaxTime() = 0;
258
265 virtual bool isEnabledMaxTime() const = 0;
266
272 virtual void setPeriodSize(Size p) = 0;
273
278 virtual Size periodSize() const = 0;
279
284 virtual void setVerbosity(bool v) = 0;
285
290 virtual bool verbosity() const = 0;
291
297
303 virtual Size nbrIterations() const = 0;
304
311 virtual const std::vector< double >& history() const = 0;
312 };
313} // namespace gum
314
315#ifndef GUM_NO_INLINE
317#endif
318
319#endif // GUM_APPROXIMATION_SCHEME_CONFIGURATION_H
This file contains getters and setters definition for ApproximationScheme settings.
virtual bool isEnabledEpsilon() const =0
Returns true if stopping criterion on epsilon is enabled, false otherwise.
virtual double epsilon() const =0
Returns the value of epsilon.
virtual void disableEpsilon()=0
Disable stopping criterion on epsilon.
virtual void enableEpsilon()=0
Enable stopping criterion on epsilon.
virtual Size nbrIterations() const =0
Returns the number of iterations.
Signaler1< const std::string & > onStop
Criteria messageApproximationScheme.
virtual void setMaxTime(double timeout)=0
Stopping criterion on timeout.
virtual const std::vector< double > & history() const =0
Returns the scheme history.
virtual Size periodSize() const =0
Returns the period size.
virtual void disableMinEpsilonRate()=0
Disable stopping criterion on epsilon rate.
virtual double currentTime() const =0
Returns the current running time in second.
virtual void setVerbosity(bool v)=0
Set the verbosity on (true) or off (false).
ApproximationSchemeSTATE
The different state of an approximation scheme.
virtual bool verbosity() const =0
Returns true if verbosity is enabled.
virtual ApproximationSchemeSTATE stateApproximationScheme() const =0
Returns the approximation scheme state.
virtual double minEpsilonRate() const =0
Returns the value of the minimal epsilon rate.
virtual void enableMaxIter()=0
Enable stopping criterion on max iterations.
virtual void disableMaxIter()=0
Disable stopping criterion on max iterations.
virtual void enableMinEpsilonRate()=0
Enable stopping criterion on epsilon rate.
virtual Size maxIter() const =0
Returns the criterion on number of iterations.
std::string messageApproximationScheme() const
Returns the approximation scheme message.
virtual void disableMaxTime()=0
Disable stopping criterion on timeout.
virtual bool isEnabledMaxIter() const =0
Returns true if stopping criterion on max iterations is enabled, false otherwise.
virtual bool isEnabledMinEpsilonRate() const =0
Returns true if stopping criterion on epsilon rate is enabled, false otherwise.
virtual double maxTime() const =0
Returns the timeout (in seconds).
virtual void setMinEpsilonRate(double rate)=0
Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|).
virtual void setEpsilon(double eps)=0
Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|.
virtual void setPeriodSize(Size p)=0
How many samples between two stopping is enable.
virtual bool isEnabledMaxTime() const =0
Returns true if stopping criterion on timeout is enabled, false otherwise.
virtual void setMaxIter(Size max)=0
Stopping criterion on number of iterations.
virtual void enableMaxTime()=0
Enable stopping criterion on timeout.
Signaler3< Size, double, double > onProgress
Progression, error and time.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74
Useful macros for maths.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
Declare all signalers.
Class used to compute response times for benchmark purposes.