aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
BayesNetInference.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
49
50#ifndef GUM_BAYES_NET_INFERENCE_H
51#define GUM_BAYES_NET_INFERENCE_H
52
53
54#include <agrum/agrum.h>
55
57#include <agrum/BN/IBayesNet.h>
58
59namespace gum {
60
61
74 FIND_NO_BARREN_NODES, // do not try to find barren nodes
75 FIND_BARREN_NODES // use a bottom-up algorithm to detect barren nodes
76 };
77
78
79 // JointTargetedInference, the class for computing joint posteriors, should
80 // have access to the states of Inference and change them when needed: this
81 // will be a friend of Inference
82 template < typename GUM_SCALAR >
83 class JointTargetedInference;
84
85 // MarginalTargetedInference, the class for computing marginal posteriors,
86 // should have access to the states of Inference and change them when needed:
87 // this should be a friend of Inference
88 template < typename GUM_SCALAR >
89 class MarginalTargetedInference;
90
91 // EvidenceInference, the class for computing the probability of evidence,
92 // should have access to the states of Inference and change them when needed:
93 // this will be a friend of Inference
94 template < typename GUM_SCALAR >
95 class EvidenceInference;
96
159
160 template < typename GUM_SCALAR >
161 class BayesNetInference: public GraphicalModelInference< GUM_SCALAR > {
162 public:
202
203
204 // ############################################################################
206 // ############################################################################
208
210
212 explicit BayesNetInference(const IBayesNet< GUM_SCALAR >* bn);
213
215
224
226 virtual ~BayesNetInference();
227
229
230
231 // ############################################################################
233 // ############################################################################
235
237
242 virtual void setBN(const IBayesNet< GUM_SCALAR >* bn);
243
245
247 virtual const IBayesNet< GUM_SCALAR >& BN() const final;
248
249 private:
252
253
258 };
259
260
261} // namespace gum
262
264
265
266#endif // GUM_BAYES_NET_INFERENCE_H
Implementation of the non pure virtual methods of class BayesNetInference.
Class representing the minimal interface for Bayesian network with no numerical data.
friend JointTargetedInference< GUM_SCALAR >
allow JointInference to access the single targets and inference states
void _setBayesNetDuringConstruction_(const IBayesNet< GUM_SCALAR > *bn)
assigns a BN during the inference engine construction
BayesNetInference(const IBayesNet< GUM_SCALAR > *bn)
default constructor
friend MarginalTargetedInference< GUM_SCALAR >
allow JointInference to access the single targets and inference states
friend EvidenceInference< GUM_SCALAR >
allow JointInference to access the single targets and inference states
virtual const IBayesNet< GUM_SCALAR > & BN() const final
Returns a constant reference over the IBayesNet referenced by this class.
BayesNetInference()
default constructor with a null BN (useful for virtual inheritance)
virtual ~BayesNetInference()
destructor
virtual void setBN(const IBayesNet< GUM_SCALAR > *bn)
assigns a new BN to the inference engine
GraphicalModelInference(const GraphicalModel *model)
default constructor
Class representing the minimal interface for Bayesian network with no numerical data.
Definition IBayesNet.h:75
This file contains abstract class definitions for graphical models inference classes.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
FindBarrenNodesType
type of algorithm to determine barren nodes