aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
groundedInference.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
48
#ifndef GUM_GROUNDED_INFERENCE_H
49
#define GUM_GROUNDED_INFERENCE_H
50
51
#include <
agrum/BN/inference/tools/marginalTargetedInference.h
>
52
#include <
agrum/PRM/inference/PRMInference.h
>
53
54
namespace
gum
{
55
namespace
prm
{
65
template
< GUM_Numeric GUM_SCALAR >
66
class
GroundedInference
:
public
PRMInference
< GUM_SCALAR > {
67
public
:
68
// ========================================================================
70
// ========================================================================
72
74
GroundedInference
(
const
PRM< GUM_SCALAR >
&
prm
,
const
PRMSystem< GUM_SCALAR >
& system);
75
77
~GroundedInference
()
override
;
78
80
// ========================================================================
82
// ========================================================================
84
92
MarginalTargetedInference< GUM_SCALAR >
&
getBNInference
();
93
104
void
setBNInference
(
MarginalTargetedInference< GUM_SCALAR >
* bn_inf);
105
106
std::string
name
()
const override
;
107
109
110
protected
:
111
// ========================================================================
113
// ========================================================================
115
118
void
evidenceAdded_
(
const
typename
PRMInference< GUM_SCALAR >::Chain
& chain)
override
;
119
122
void
evidenceRemoved_
(
const
typename
PRMInference< GUM_SCALAR >::Chain
& chain)
override
;
123
128
void
posterior_
(
const
typename
PRMInference< GUM_SCALAR >::Chain
& chain,
129
Tensor< GUM_SCALAR >& m)
override
;
130
135
void
joint_
(
const
std::vector<
typename
PRMInference< GUM_SCALAR >::Chain
>& queries,
136
Tensor< GUM_SCALAR >& j)
override
;
137
139
140
private
:
142
GroundedInference
(
const
GroundedInference
& source);
143
145
GroundedInference
&
operator=
(
const
GroundedInference
& source);
146
148
MarginalTargetedInference< GUM_SCALAR >
*
_inf_
;
149
150
List< const Tensor< GUM_SCALAR >
* >
_obs_
;
151
};
152
153
154
#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
155
extern
template
class
GroundedInference< double >
;
156
#endif
157
158
159
}
/* namespace prm */
160
}
/* namespace gum */
161
162
#include <
agrum/PRM/inference/groundedInference_tpl.h
>
163
164
#endif
/* GUM_GROUNDED_INFERENCE_H */
PRMInference.h
Headers of PRMInference.
gum::List
Generic doubly linked lists.
Definition
list.h:378
gum::MarginalTargetedInference
<agrum/BN/inference/marginalTargetedInference.h>
Definition
marginalTargetedInference.h:78
gum::prm::GroundedInference
<agrum/PRM/groundedInference.h>
Definition
groundedInference.h:66
gum::prm::GroundedInference::setBNInference
void setBNInference(MarginalTargetedInference< GUM_SCALAR > *bn_inf)
Defines the bayesnet inference engine used by this class.
Definition
groundedInference_tpl.h:138
gum::prm::GroundedInference::joint_
void joint_(const std::vector< typename PRMInference< GUM_SCALAR >::Chain > &queries, Tensor< GUM_SCALAR > &j) override
Generic method to compute the marginal of given element.
Definition
groundedInference_tpl.h:166
gum::prm::GroundedInference::evidenceAdded_
void evidenceAdded_(const typename PRMInference< GUM_SCALAR >::Chain &chain) override
This method is called whenever an evidence is added, but AFTER any processing made by PRMInference.
Definition
groundedInference_tpl.h:71
gum::prm::GroundedInference::name
std::string name() const override
Returns the bayesnet inference engine used by this class.
Definition
groundedInference_tpl.h:173
gum::prm::GroundedInference::evidenceRemoved_
void evidenceRemoved_(const typename PRMInference< GUM_SCALAR >::Chain &chain) override
This method is called whenever an evidence is removed, but BEFORE any processing made by PRMInference...
Definition
groundedInference_tpl.h:89
gum::prm::GroundedInference::posterior_
void posterior_(const typename PRMInference< GUM_SCALAR >::Chain &chain, Tensor< GUM_SCALAR > &m) override
Generic method to compute the marginal of given element.
Definition
groundedInference_tpl.h:146
gum::prm::GroundedInference::operator=
GroundedInference & operator=(const GroundedInference &source)
Copy operator.
Definition
groundedInference_tpl.h:124
gum::prm::GroundedInference::_inf_
MarginalTargetedInference< GUM_SCALAR > * _inf_
The bayesnet inference engine used by this class.
Definition
groundedInference.h:148
gum::prm::GroundedInference::_obs_
List< const Tensor< GUM_SCALAR > * > _obs_
Definition
groundedInference.h:150
gum::prm::GroundedInference::getBNInference
MarginalTargetedInference< GUM_SCALAR > & getBNInference()
Returns the bayesnet inference engine used by this class.
Definition
groundedInference_tpl.h:129
gum::prm::GroundedInference::GroundedInference
GroundedInference(const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system)
Default constructor.
Definition
groundedInference_tpl.h:108
gum::prm::PRMInference::Chain
std::pair< const PRMInstance< GUM_SCALAR > *, const PRMAttribute< GUM_SCALAR > * > Chain
Code alias.
Definition
PRMInference.h:71
gum::prm::PRMInference::PRMInference
PRMInference(const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system)
Default constructor.
Definition
PRMInference_tpl.h:159
gum::prm::PRMSystem
A PRMSystem is a container of PRMInstance and describe a relational skeleton.
Definition
PRMSystem.h:72
gum::prm::PRM
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
Definition
PRM.h:74
groundedInference_tpl.h
Inline implementation of GroundedInference.
marginalTargetedInference.h
This file contains the abstract inference class definition for computing (incrementally) marginal pos...
gum::prm
namespace for all probabilistic relational models entities
Definition
agrum.h:68
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0