aGrUM  0.14.2
multiDimICIModel.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
33 #ifndef GUM_MULTI_DIM_ICI_MODEL_H
34 #define GUM_MULTI_DIM_ICI_MODEL_H
35 
36 #include <agrum/core/bijection.h>
38 
39 namespace gum {
40 
41  // ===========================================================================
42  // === GUM_MULTI_DIM_AGGREGATOR ===
43  // ===========================================================================
44  // clang-format off
55  // clang-format on
56  template < typename GUM_SCALAR >
57  class MultiDimICIModel : public MultiDimReadOnly< GUM_SCALAR > {
58  public:
59  // ============================================================================
61  // ============================================================================
63 
67  MultiDimICIModel(GUM_SCALAR external_weight,
68  GUM_SCALAR default_weight = (GUM_SCALAR)1.0);
69 
74 
83  const MultiDimICIModel< GUM_SCALAR >& from);
84 
88  virtual ~MultiDimICIModel();
89 
91  // ============================================================================
93  // ============================================================================
95 
96  public:
97  const std::string toString() const override;
98 
99  // @todo : optimisation with a always up-to-date value associated to each
100  // instantiation
102  const gum::DiscreteVariable* const,
103  gum::Idx,
104  gum::Idx) override{};
105 
106  virtual void setFirstNotification(const gum::Instantiation&) override{};
107 
108  virtual void setLastNotification(const gum::Instantiation&) override{};
109 
110  virtual void setIncNotification(const gum::Instantiation&) override{};
111 
112  virtual void setDecNotification(const gum::Instantiation&) override{};
113 
114  virtual void setChangeNotification(const gum::Instantiation&) override{};
115 
116  const std::string toString(const gum::Instantiation* i) const override {
117  return i->toString();
118  };
119 
129  virtual void
130  copyFrom(const MultiDimContainer< GUM_SCALAR >& src) const override;
131 
136  virtual Size realSize() const override { return this->nbrDim(); };
137 
138  GUM_SCALAR causalWeight(const DiscreteVariable& v) const;
139 
140  void causalWeight(const DiscreteVariable& v, GUM_SCALAR w) const;
141 
142  GUM_SCALAR externalWeight() const;
143 
144  void externalWeight(GUM_SCALAR w) const;
145 
157  virtual const std::string& name() const override;
158 
160  protected:
162  mutable GUM_SCALAR __external_weight;
163 
164  // ============================================================================
166  // ============================================================================
168 
170  mutable GUM_SCALAR __default_weight;
171 
174 
175  virtual void _replace(const DiscreteVariable* x,
176  const DiscreteVariable* y) override;
177  };
178 
179 
180 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
181  extern template class MultiDimICIModel< double >;
182 #endif
183 
184 } /* namespace gum */
185 
187 
188 #endif /* GUM_MULTI_DIM_ICI_MODEL_H */
virtual ~MultiDimICIModel()
Destructor.
Header of the MultiDimReadOnly class.
HashTable< const DiscreteVariable *, GUM_SCALAR > __causal_weights
in Henrion (89) in a hashtable with a default_value.
virtual void setIncNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
virtual void setDecNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Abstract base class for all multi dimensionnal containers.
Abstract base class for all multi dimensionnal read only structure.
GUM_SCALAR __external_weight
in Henrion (89).
The class for generic Hash Tables.
Definition: hashTable.h:676
GUM_SCALAR externalWeight() const
Copy of a multiDimICIModel.
const std::string toString(const gum::Instantiation *i) const override
Copy of a multiDimICIModel.
virtual void changeNotification(const gum::Instantiation &, const gum::DiscreteVariable *const, gum::Idx, gum::Idx) override
Copy of a multiDimICIModel.
abstract class for Conditional Indepency Models
A Interface to all Causal Independence models.
GUM_SCALAR __default_weight
in Henrion (89) in a hashtable with a default_value.
virtual Size realSize() const override
std::string toString() const
Give a string version of instantiation.
virtual const std::string & name() const override
returns the real name of the multiDimArray
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1803
virtual void _replace(const DiscreteVariable *x, const DiscreteVariable *y) override
Replace variable x by y.
virtual void copyFrom(const MultiDimContainer< GUM_SCALAR > &src) const override
Copy of a multiDimICIModel.
const std::string toString() const override
Copy of a multiDimICIModel.
virtual Idx nbrDim() const override
Returns the number of vars in the multidimensional container.
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:80
virtual void setFirstNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
GUM_SCALAR causalWeight(const DiscreteVariable &v) const
Copy of a multiDimICIModel.
MultiDimICIModel(GUM_SCALAR external_weight, GUM_SCALAR default_weight=(GUM_SCALAR) 1.0)
Default constructor.
Size Idx
Type for indexes.
Definition: types.h:50
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
virtual void setChangeNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
Set of pairs of elements with fast search for both elements.
virtual void setLastNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.