aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
multiDimICIModel.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
55#ifndef GUM_MULTI_DIM_ICI_MODEL_H
56#define GUM_MULTI_DIM_ICI_MODEL_H
57
60
61namespace gum {
62
63 // ===========================================================================
64 // === GUM_MULTI_DIM_AGGREGATOR ===
65 // ===========================================================================
66 // clang-format off
77 // clang-format on
78
79 template < typename GUM_ELEMENT >
80 class MultiDimICIModel: public MultiDimReadOnly< GUM_ELEMENT > {
81 public:
82 // ============================================================================
84 // ============================================================================
86
90 MultiDimICIModel(GUM_ELEMENT external_weight, GUM_ELEMENT default_weight = (GUM_ELEMENT)1.0);
91
96
105
109 ~MultiDimICIModel() override;
110
112 // ============================================================================
114 // ============================================================================
116
117 public:
118 std::string toString() const override;
119
121 const gum::DiscreteVariable* const,
122 gum::Idx,
123 gum::Idx) override;
124
125 void setFirstNotification(const gum::Instantiation&) override;
126
127 void setLastNotification(const gum::Instantiation&) override;
128
129 void setIncNotification(const gum::Instantiation&) override;
130
131 void setDecNotification(const gum::Instantiation&) override;
132
133 void setChangeNotification(const gum::Instantiation&) override;
134
135 std::string toString(const gum::Instantiation* i) const override;
136
146 void copyFrom(const MultiDimContainer< GUM_ELEMENT >& src) const override;
147
152 Size realSize() const override;
153
154 GUM_ELEMENT causalWeight(const DiscreteVariable& v) const;
155
156 void causalWeight(const DiscreteVariable& v, GUM_ELEMENT w) const;
157
158 GUM_ELEMENT externalWeight() const;
159
160 void externalWeight(GUM_ELEMENT w) const;
161
173 const std::string& name() const override;
174
176
177 protected:
179 mutable GUM_ELEMENT _external_weight_;
180
181 // ============================================================================
183 // ============================================================================
185
187 mutable GUM_ELEMENT _default_weight_;
188
191
192 void replace_(const DiscreteVariable* x, const DiscreteVariable* y) override;
193 };
194
195
196#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
197 extern template class MultiDimICIModel< double >;
198#endif
199
200} /* namespace gum */
201
203
204#endif /* GUM_MULTI_DIM_ICI_MODEL_H */
Set of pairs of elements with fast search for both elements.
Set of pairs of elements with fast search for both elements.
Definition bijection.h:1640
Base class for discrete random variable.
The class for generic Hash Tables.
Definition hashTable.h:640
Class for assigning/browsing values to tuples of discrete variables.
Abstract base class for all multi dimensionnal containers.
abstract class for Conditional Indepency Models
void setDecNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
void setLastNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
void changeNotification(const gum::Instantiation &, const gum::DiscreteVariable *const, gum::Idx, gum::Idx) override
Copy of a multiDimICIModel.
void setChangeNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
MultiDimICIModel(const MultiDimICIModel< GUM_ELEMENT > &from)
Default constructor.
GUM_ELEMENT _external_weight_
in Henrion (89).
MultiDimICIModel(GUM_ELEMENT external_weight, GUM_ELEMENT default_weight=(GUM_ELEMENT) 1.0)
Default constructor.
GUM_ELEMENT externalWeight() const
Copy of a multiDimICIModel.
Size realSize() const override
void replace_(const DiscreteVariable *x, const DiscreteVariable *y) override
This is called by MultiDimContainer::replace() to proceed with the replacing between x and y.
MultiDimICIModel(const Bijection< const DiscreteVariable *, const DiscreteVariable * > &bij, const MultiDimICIModel< GUM_ELEMENT > &from)
Copy constructor using a bijection to swap variables from source.
HashTable< const DiscreteVariable *, GUM_ELEMENT > _causal_weights_
in Henrion (89) in a hashtable with a default_value.
void causalWeight(const DiscreteVariable &v, GUM_ELEMENT w) const
Copy of a multiDimICIModel.
std::string toString() const override
Copy of a multiDimICIModel.
void setFirstNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
GUM_ELEMENT _default_weight_
in Henrion (89) in a hashtable with a default_value.
GUM_ELEMENT causalWeight(const DiscreteVariable &v) const
Copy of a multiDimICIModel.
~MultiDimICIModel() override
Destructor.
void setIncNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
void copyFrom(const MultiDimContainer< GUM_ELEMENT > &src) const override
Copy of a multiDimICIModel.
const std::string & name() const override
returns the real name of the multiDimArray
void externalWeight(GUM_ELEMENT w) const
Copy of a multiDimICIModel.
MultiDimReadOnly()
Default constructor.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74
Size Idx
Type for indexes.
Definition types.h:79
A Interface to all Causal Independence models.
Header of the MultiDimReadOnly class.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46