aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
ITestPolicy.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2026 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-2026 *
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
50#ifndef GUM_MULTI_DIM_FUNCTION_GRAPH_INTERFACE_TEST_POLICY_H
51#define GUM_MULTI_DIM_FUNCTION_GRAPH_INTERFACE_TEST_POLICY_H
52
53// ============================================================================
55// ============================================================================
57
58// ============================================================================
59
60namespace gum {
61
70 template < typename GUM_ELEMENT >
72 public:
73 // ############################################################################
75 // ############################################################################
77
78 // ============================================================================
80 // ============================================================================
82
83 // ============================================================================
85 // ============================================================================
86 virtual ~ITestPolicy();
87
88 // ============================================================================
90 // ============================================================================
91 void* operator new(size_t s);
92
93 void operator delete(void* p);
94
96
97
98 // ############################################################################
100 // ############################################################################
102
103 // ============================================================================
105 // ============================================================================
106 virtual void addObservation(Idx attr, GUM_ELEMENT value);
107
108 // ============================================================================
110 // ============================================================================
111 Idx nbObservation() const;
112
114
115
116 // ############################################################################
118 // ############################################################################
120
121 // ============================================================================
124 // ============================================================================
125 virtual bool isTestRelevant() const = 0;
126
127 // ============================================================================
129 // ============================================================================
130 virtual void computeScore() const;
131
132 // ============================================================================
134 // ============================================================================
135 virtual double score() const = 0;
136
137 // ============================================================================
139 // ============================================================================
140 virtual double secondaryscore() const = 0;
141
143
144
145 // ############################################################################
147 // ############################################################################
149
150 // ============================================================================
152 // ============================================================================
153 void add(const ITestPolicy< GUM_ELEMENT >& src);
154
156
157
158 // ############################################################################
160 // ############################################################################
162
163 // ============================================================================
165 // ============================================================================
166 std::string toString() const;
167
169
170 protected:
171 bool isModified_() const;
172
173 private:
175 mutable bool _isModified_;
176
179 };
180
181} // End of namespace gum
182
184#endif /* GUM_MULTI_DIM_FUNCTION_GRAPH_INTERFACE_TEST_POLICY_H */
ITestPolicy()
Allocators and Deallocators redefinition.
bool isModified_() const
bool _isModified_
Booleans indicating if we have to re eval test.
virtual void addObservation(Idx attr, GUM_ELEMENT value)
Comptabilizes the new observation.
virtual void computeScore() const
Recomputes the statistic from the beginning.
virtual double score() const =0
Returns the performance of current variable according to the test.
virtual bool isTestRelevant() const =0
Returns true if enough observation were added so that the test can be relevant.
void add(const ITestPolicy< GUM_ELEMENT > &src)
virtual double secondaryscore() const =0
Returns a second criterion to severe ties.
Idx nbObservation() const
Comptabilizes the new observation.
virtual ~ITestPolicy()
Allocators and Deallocators redefinition.
std::string toString() const
Size Idx
Type for indexes.
Definition types.h:79
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
Base node set class for graphs.
Headers of gum::SmallObjectAllocator.