aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
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-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
48#ifndef GUM_GROUNDED_INFERENCE_H
49#define GUM_GROUNDED_INFERENCE_H
50
53
54namespace gum {
55 namespace prm {
65 template < typename GUM_SCALAR >
66 class GroundedInference: public PRMInference< GUM_SCALAR > {
67 public:
68 // ========================================================================
70 // ========================================================================
72
75
77 virtual ~GroundedInference();
78
80 // ========================================================================
82 // ========================================================================
84
93
105
106 virtual std::string name() const;
107
109
110 protected:
111 // ========================================================================
113 // ========================================================================
115
118 virtual void evidenceAdded_(const typename PRMInference< GUM_SCALAR >::Chain& chain);
119
122 virtual void evidenceRemoved_(const typename PRMInference< GUM_SCALAR >::Chain& chain);
123
128 virtual void posterior_(const typename PRMInference< GUM_SCALAR >::Chain& chain,
129 Tensor< GUM_SCALAR >& m);
130
135 virtual void joint_(const std::vector< typename PRMInference< GUM_SCALAR >::Chain >& queries,
136 Tensor< GUM_SCALAR >& j);
137
139
140 private:
143
146
149
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
163
164#endif /* GUM_GROUNDED_INFERENCE_H */
Headers of PRMInference.
Generic doubly linked lists.
Definition list.h:379
<agrum/BN/inference/marginalTargetedInference.h>
<agrum/PRM/groundedInference.h>
virtual std::string name() const
Returns the bayesnet inference engine used by this class.
virtual void posterior_(const typename PRMInference< GUM_SCALAR >::Chain &chain, Tensor< GUM_SCALAR > &m)
Generic method to compute the marginal of given element.
virtual void evidenceRemoved_(const typename PRMInference< GUM_SCALAR >::Chain &chain)
This method is called whenever an evidence is removed, but BEFORE any processing made by PRMInference...
MarginalTargetedInference< GUM_SCALAR > * _inf_
The bayesnet inference engine used by this class.
List< const Tensor< GUM_SCALAR > * > _obs_
void setBNInference(MarginalTargetedInference< GUM_SCALAR > *bn_inf)
Defines the bayesnet inference engine used by this class.
virtual void evidenceAdded_(const typename PRMInference< GUM_SCALAR >::Chain &chain)
This method is called whenever an evidence is added, but AFTER any processing made by PRMInference.
virtual ~GroundedInference()
Destructor.
GroundedInference & operator=(const GroundedInference &source)
Copy operator.
virtual void joint_(const std::vector< typename PRMInference< GUM_SCALAR >::Chain > &queries, Tensor< GUM_SCALAR > &j)
Generic method to compute the marginal of given element.
MarginalTargetedInference< GUM_SCALAR > & getBNInference()
Returns the bayesnet inference engine used by this class.
GroundedInference(const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system)
Default constructor.
std::pair< const PRMInstance< GUM_SCALAR > *, const PRMAttribute< GUM_SCALAR > * > Chain
Code alias.
PRMInference(const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system)
Default constructor.
A PRMSystem is a container of PRMInstance and describe a relational skeleton.
Definition PRMSystem.h:70
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
Definition PRM.h:74
Inline implementation of GroundedInference.
This file contains the abstract inference class definition for computing (incrementally) marginal pos...
namespace for all probabilistic relational models entities
Definition agrum.h:68
gum is the global namespace for all aGrUM entities
Definition agrum.h:46