aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
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-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
49
50
#ifndef GUM_BAYES_NET_INFERENCE_H
51
#define GUM_BAYES_NET_INFERENCE_H
52
53
54
#include <
agrum/agrum.h
>
55
56
#include <
agrum/base/graphicalModels/inference/graphicalModelInference.h
>
57
#include <
agrum/BN/IBayesNet.h
>
58
59
namespace
gum
{
60
61
73
enum class
FindBarrenNodesType
{
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
< GUM_Numeric 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
< GUM_Numeric 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
< GUM_Numeric GUM_SCALAR >
95
class
EvidenceInference;
96
159
160
template
< GUM_Numeric 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
223
BayesNetInference
();
224
226
~BayesNetInference
()
override
;
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
:
251
void
_setBayesNetDuringConstruction_
(
const
IBayesNet< GUM_SCALAR >
* bn);
252
253
255
friend
MarginalTargetedInference< GUM_SCALAR >
;
256
friend
JointTargetedInference< GUM_SCALAR >
;
257
friend
EvidenceInference< GUM_SCALAR >
;
258
};
259
260
261
}
// namespace gum
262
263
#include <
agrum/BN/inference/tools/BayesNetInference_tpl.h
>
264
265
266
#endif
// GUM_BAYES_NET_INFERENCE_H
BayesNetInference_tpl.h
Implementation of the non pure virtual methods of class BayesNetInference.
IBayesNet.h
Class representing the minimal interface for Bayesian network with no numerical data.
agrum.h
gum::BayesNetInference::JointTargetedInference< GUM_SCALAR >
friend JointTargetedInference< GUM_SCALAR >
allow JointInference to access the single targets and inference states
Definition
BayesNetInference.h:256
gum::BayesNetInference::_setBayesNetDuringConstruction_
void _setBayesNetDuringConstruction_(const IBayesNet< GUM_SCALAR > *bn)
assigns a BN during the inference engine construction
Definition
BayesNetInference_tpl.h:88
gum::BayesNetInference::BayesNetInference
BayesNetInference(const IBayesNet< GUM_SCALAR > *bn)
default constructor
Definition
BayesNetInference_tpl.h:57
gum::BayesNetInference::MarginalTargetedInference< GUM_SCALAR >
friend MarginalTargetedInference< GUM_SCALAR >
allow JointInference to access the single targets and inference states
Definition
BayesNetInference.h:255
gum::BayesNetInference::EvidenceInference< GUM_SCALAR >
friend EvidenceInference< GUM_SCALAR >
allow JointInference to access the single targets and inference states
Definition
BayesNetInference.h:257
gum::BayesNetInference::BN
virtual const IBayesNet< GUM_SCALAR > & BN() const final
Returns a constant reference over the IBayesNet referenced by this class.
Definition
BayesNetInference_tpl.h:76
gum::BayesNetInference::BayesNetInference
BayesNetInference()
default constructor with a null BN (useful for virtual inheritance)
Definition
BayesNetInference_tpl.h:64
gum::BayesNetInference::setBN
virtual void setBN(const IBayesNet< GUM_SCALAR > *bn)
assigns a new BN to the inference engine
Definition
BayesNetInference_tpl.h:82
gum::GraphicalModelInference::GraphicalModelInference
GraphicalModelInference(const GraphicalModel *model)
default constructor
Definition
graphicalModelInference_tpl.h:57
gum::IBayesNet
Class representing the minimal interface for Bayesian network with no numerical data.
Definition
IBayesNet.h:75
graphicalModelInference.h
This file contains abstract class definitions for graphical models inference classes.
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
gum::FindBarrenNodesType
FindBarrenNodesType
type of algorithm to determine barren nodes
Definition
BayesNetInference.h:73
gum::FindBarrenNodesType::FIND_NO_BARREN_NODES
@ FIND_NO_BARREN_NODES
Definition
BayesNetInference.h:74
gum::FindBarrenNodesType::FIND_BARREN_NODES
@ FIND_BARREN_NODES
Definition
BayesNetInference.h:75
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0