61 template <
typename GUM_SCALAR >
63 GUM_SCALAR default_weight) :
65 _default_weight_(default_weight) {
66 GUM_CONSTRUCTOR(MultiDimICIModel);
70 template <
typename GUM_SCALAR >
71 MultiDimICIModel< GUM_SCALAR >::MultiDimICIModel(
const MultiDimICIModel< GUM_SCALAR >& from) :
72 MultiDimReadOnly< GUM_SCALAR >(from) {
73 GUM_CONS_CPY(MultiDimICIModel);
74 _default_weight_ = from._default_weight_;
75 _external_weight_ = from._external_weight_;
76 _causal_weights_ = from._causal_weights_;
80 template <
typename GUM_SCALAR >
81 MultiDimICIModel< GUM_SCALAR >::MultiDimICIModel(
82 const Bijection< const DiscreteVariable*, const DiscreteVariable* >& bij,
83 const MultiDimICIModel< GUM_SCALAR >& from) : MultiDimReadOnly< GUM_SCALAR >() {
84 GUM_CONSTRUCTOR(MultiDimICIModel);
85 _default_weight_ = from._default_weight_;
86 _external_weight_ = from._external_weight_;
88 for (HashTableConstIteratorSafe< const DiscreteVariable*, GUM_SCALAR > iter
89 = from._causal_weights_.beginSafe();
90 iter != from._causal_weights_.endSafe();
92 if (
auto pFirst = bij.tryFirst(iter.key())) {
93 causalWeight(**pFirst, iter.val());
95 causalWeight(*(iter.key()), iter.val());
101 template <
typename GUM_SCALAR >
106 template <
typename GUM_SCALAR >
112 template <
typename GUM_SCALAR >
118 if (w == (GUM_SCALAR)0) {
GUM_ERROR(gum::OutOfBounds,
"causal weight in CI Model>0") }
123 template <
typename GUM_SCALAR >
128 template <
typename GUM_SCALAR >
133 template <
typename GUM_SCALAR >
145 template <
typename GUM_SCALAR >
153 for (
Idx i = 1; i < this->
nbrDim(); i++) {
155 p->causalWeight(this->variable(i)));
163 template <
typename GUM_SCALAR >
165 static const std::string str =
"MultiDimICIModel";
169 template <
typename GUM_SCALAR >
177 template <
typename GUM_SCALAR >
183 template <
typename GUM_SCALAR >
186 template <
typename GUM_SCALAR >
189 template <
typename GUM_SCALAR >
192 template <
typename GUM_SCALAR >
195 template <
typename GUM_SCALAR >
198 template <
typename GUM_SCALAR >
203 template <
typename GUM_SCALAR >
Set of pairs of elements with fast search for both elements.
Base class for discrete random variable.
Class for assigning/browsing values to tuples of discrete variables.
std::string toString() const
Give a string version of instantiation.
Exception: at least one argument passed to a function is not what was expected.
virtual void copyFrom(const MultiDimContainer< GUM_ELEMENT > &src) const
Basic copy of a MultiDimContainer.
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.
GUM_SCALAR _external_weight_
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.
HashTable< const DiscreteVariable *, GUM_ELEMENT > _causal_weights_
in Henrion (89) in a hashtable with a default_value.
std::string toString() const override
Copy of a multiDimICIModel.
void setFirstNotification(const gum::Instantiation &) override
Copy of a multiDimICIModel.
GUM_SCALAR _default_weight_
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
const DiscreteVariable & variable(Idx i) const override
Returns a const ref to the ith var.
void replace_(const DiscreteVariable *x, const DiscreteVariable *y) override
Replace variable x by y.
Idx nbrDim() const override
Returns the number of vars in the multidimensional container.
virtual Size domainSize() const =0
Returns the product of the variables domain size.
Abstract base class for all multi dimensionnal read only structure.
Exception : operation not allowed.
const std::string & name() const
returns the name of the variable
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
bool contains(std::string_view s, std::string_view needle)
true if needle in s
Abstract base class for all multi dimensionnal Causal Independency models.
Header of the MultiDimReadOnly class.
gum is the global namespace for all aGrUM entities