aGrUM 2.3.2
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-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
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_SCALAR >
80 class MultiDimICIModel: public MultiDimReadOnly< GUM_SCALAR > {
81 public:
82 // ============================================================================
84 // ============================================================================
86
90 MultiDimICIModel(GUM_SCALAR external_weight, GUM_SCALAR default_weight = (GUM_SCALAR)1.0);
91
96
105
109 virtual ~MultiDimICIModel();
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 virtual void setFirstNotification(const gum::Instantiation&) override {};
126
127 virtual void setLastNotification(const gum::Instantiation&) override {};
128
129 virtual void setIncNotification(const gum::Instantiation&) override {};
130
131 virtual void setDecNotification(const gum::Instantiation&) override {};
132
133 virtual void setChangeNotification(const gum::Instantiation&) override {};
134
135 std::string toString(const gum::Instantiation* i) const override { return i->toString(); };
136
146 virtual void copyFrom(const MultiDimContainer< GUM_SCALAR >& src) const override;
147
152 virtual Size realSize() const override { return this->nbrDim(); };
153
154 GUM_SCALAR causalWeight(const DiscreteVariable& v) const;
155
156 void causalWeight(const DiscreteVariable& v, GUM_SCALAR w) const;
157
158 GUM_SCALAR externalWeight() const;
159
160 void externalWeight(GUM_SCALAR w) const;
161
173 virtual const std::string& name() const override;
174
176
177 protected:
179 mutable GUM_SCALAR _external_weight_;
180
181 // ============================================================================
183 // ============================================================================
185
187 mutable GUM_SCALAR _default_weight_;
188
191
192 virtual 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:1594
Base class for discrete random variable.
The class for generic Hash Tables.
Definition hashTable.h:637
Class for assigning/browsing values to tuples of discrete variables.
std::string toString() const
Give a string version of instantiation.
Abstract base class for all multi dimensionnal containers.
abstract class for Conditional Indepency Models
virtual void setDecNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
virtual Size realSize() const override
virtual void changeNotification(const gum::Instantiation &, const gum::DiscreteVariable *const, gum::Idx, gum::Idx) override
Copy of a multiDimICIModel.
virtual void replace_(const DiscreteVariable *x, const DiscreteVariable *y) override
Replace variable x by y.
GUM_SCALAR externalWeight() const
Copy of a multiDimICIModel.
virtual const std::string & name() const override
returns the real name of the multiDimArray
virtual void setIncNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
GUM_SCALAR _default_weight_
in Henrion (89) in a hashtable with a default_value.
virtual void copyFrom(const MultiDimContainer< GUM_SCALAR > &src) const override
Copy of a multiDimICIModel.
std::string toString(const gum::Instantiation *i) const override
Copy of a multiDimICIModel.
virtual void setChangeNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
MultiDimICIModel(GUM_SCALAR external_weight, GUM_SCALAR default_weight=(GUM_SCALAR) 1.0)
Default constructor.
virtual void setFirstNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
virtual ~MultiDimICIModel()
Destructor.
std::string toString() const override
Copy of a multiDimICIModel.
virtual void setLastNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
HashTable< const DiscreteVariable *, GUM_SCALAR > _causal_weights_
in Henrion (89) in a hashtable with a default_value.
GUM_SCALAR causalWeight(const DiscreteVariable &v) const
Copy of a multiDimICIModel.
GUM_SCALAR _external_weight_
in Henrion (89).
virtual Idx nbrDim() const override
Returns the number of vars in the multidimensional container.
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