aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
PRMInstance_tpl.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#pragma once
42
43
50
53
54namespace gum {
55 namespace prm {
56 template < GUM_Numeric GUM_SCALAR >
59 GUM_CONSTRUCTOR(PRMInstance);
60
61 // First we create attributes for each aggregate in type
62 for (const auto agg: _type_->aggregates())
64
65 // We add attributes in type by reference for inner ones and by copy for
66 // output ones
67 for (const auto attr: _type_->attributes())
68 _copyAttribute_(attr);
69 }
70
71 template < GUM_Numeric GUM_SCALAR >
73 GUM_DESTRUCTOR(PRMInstance);
74
75 for (const auto& elt: _nodeIdMap_)
76 delete elt.second;
77
78 for (const auto& elt: _referenceMap_)
79 delete elt.second;
80
81 for (const auto& elt: _referingAttr_)
82 delete elt.second;
83 }
84
85 template < GUM_Numeric GUM_SCALAR >
92
93 template < GUM_Numeric GUM_SCALAR >
95 // First retrieving any referenced instance
96 for (const auto chain: type().slotChains()) {
98 }
99
100 // Now we need to add referred instance to each input node
101 // For Attributes we first add parents, then we initialize CPF
102 for (const auto attr: type().attributes()) {
103 _copyAttributeCPF_(_nodeIdMap_[(*attr).id()]);
104 }
105
106 // For PRMAggregate<GUM_SCALAR> we add parents
107 for (const auto agg: type().aggregates()) {
108 PRMAttribute< GUM_SCALAR >& attr = get(agg->safeName());
109
110 for (const auto node: type().containerDag().parents(agg->id())) {
111 if (auto p_node = _nodeIdMap_.tryGet(node)) {
112 attr.addParent(*(*p_node));
113 } else {
114 auto elt = &(type().get(node));
115 auto sc = static_cast< PRMSlotChain< GUM_SCALAR >* >(elt);
116
117 if (auto p_ref = _referenceMap_.tryGet(sc->id())) {
118 for (const auto inst: *(*p_ref)) {
119 attr.addParent(inst->get(sc->lastElt().safeName()));
120 }
121 }
122 }
123 }
124 }
125 }
126
127 template < GUM_Numeric GUM_SCALAR >
129 auto first_id = sc->chain()[0]->id();
130 auto p_first = _referenceMap_.tryGet(first_id);
131 if (!p_first) { return; }
132 auto set = new Set< PRMInstance< GUM_SCALAR >* >(*(*p_first));
133 // We proceed with a width-first run of the slot chain
134 for (Size idx = 1; idx < sc->chain().size() - 1; ++idx) {
135 auto temp = new Set< PRMInstance< GUM_SCALAR >* >();
136 for (auto current: *set) {
137 auto& ref = current->type().get(sc->chain()[idx]->name());
138 for (auto next: *(current->_referenceMap_[ref.id()])) {
139 temp->insert(next);
140 }
141 }
142 delete set;
143 set = temp;
144 }
145
146 GUM_ASSERT(set->size() > 0);
147 // set contains all the instances references by sc
148 if (auto p_ref = _referenceMap_.tryGet(sc->id())) {
149 delete *p_ref;
150 *p_ref = set;
151 } else {
152 _referenceMap_.insert(sc->id(), set);
153 }
154
155 // Add refering instances
156 for (auto i: *set) {
158 }
159
160 // If sc is not multiple so it can be added as a parent of an attribute
161 if (!sc->isMultiple()) {
162 // We should have only one instance
163 // Less ugly way to get the single instance in set
164 for (auto instance: *set) {
165 auto& attr = instance->get(sc->lastElt().safeName());
166 _bijection_.insert(&(sc->type().variable()), &(attr.type().variable()));
167 }
168 }
169 }
170
171 template < GUM_Numeric GUM_SCALAR >
173 if (!type().exists(id))
174 GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> matches the given id")
175 PRMClassElement< GUM_SCALAR >* elt = &(type().get(id));
176
177 switch (elt->elt_type()) {
180
181 // Checking if instance's type is legal
182 if (!instance.type().isSubTypeOf(ref->slotType())) {
184 "given Instance type is not a proper "
185 "subclass of the ReferenceSlot<GUM_SCALAR> slot type");
186 }
187
188 // Checking the reference's size limit
189 if (auto p_ref_slot = _referenceMap_.tryGet(id);
190 p_ref_slot
191 && (!static_cast< PRMReferenceSlot< GUM_SCALAR >& >(type().get(id)).isArray())
192 && ((*p_ref_slot)->size() == 1)) {
193 GUM_ERROR(OutOfBounds, "ReferenceSlot<GUM_SCALAR> size limit reached")
194 }
195
196 break;
197 }
198
201 = static_cast< PRMSlotChain< GUM_SCALAR >& >(type().get(id));
202
203 // Checking if instance's type is legal
204 if (!instance.type().isSubTypeOf(sc.end())) {
206 "given Instance type is not a proper "
207 "subclass of the ClassElementContainer pointed"
208 " by the SlotChain<GUM_SCALAR>");
209 }
210
211 // Checking the reference's size limit
212 if (auto p_ref_sc = _referenceMap_.tryGet(id);
213 p_ref_sc && (!static_cast< PRMSlotChain< GUM_SCALAR >& >(type().get(id)).isMultiple())
214 && ((*p_ref_sc)->size() == 1)) {
215 GUM_ERROR(OutOfBounds, "SlotChain<GUM_SCALAR> size limit reached")
216 }
217
218 break;
219 }
220
221 default : {
222 if (!type().isOutputNode(*elt)) {
223 GUM_ERROR(WrongClassElement, "given ClassElement<GUM_SCALAR> is not an output node")
224 }
225 }
226 }
227
228 auto p_ref_add = _referenceMap_.tryGet(id);
229 if (!p_ref_add) {
230 _referenceMap_.insert(id, new Set< PRMInstance< GUM_SCALAR >* >());
231 p_ref_add = _referenceMap_.tryGet(id);
232 }
233
234 (*p_ref_add)->insert(&instance);
235 }
236
237 template < GUM_Numeric GUM_SCALAR >
239 return _nodeIdMap_.size();
240 }
241
242 template < GUM_Numeric GUM_SCALAR >
244 auto attr = new PRMScalarAttribute< GUM_SCALAR >(source->name(),
245 source->type(),
246 source->buildImpl());
247 GUM_ASSERT(&(attr->type().variable()) != &(source->type().variable()));
248 attr->setId(source->id());
249 _nodeIdMap_.insert(attr->id(), attr);
250 _bijection_.insert(&(source->type().variable()), &(attr->type().variable()));
251 }
252
253 template < GUM_Numeric GUM_SCALAR >
255 auto attr = new PRMScalarAttribute< GUM_SCALAR >(source->name(), source->type());
256 GUM_ASSERT(&(attr->type().variable()) != &(source->type().variable()));
257 // The tensor is copied when instantiate() is called
258 attr->cpf().fill((GUM_SCALAR)0);
259 attr->setId(source->id());
260 _bijection_.insert(&(source->type().variable()), &(attr->type().variable()));
261 _nodeIdMap_.insert(attr->id(), attr);
262 }
263
264 template < GUM_Numeric GUM_SCALAR >
266 PRMObject(source), _type_(source._type_) {
267 GUM_CONS_CPY(PRMInstance);
268 GUM_ERROR(FatalError, "do not copy Instance")
269 }
270
271 template < GUM_Numeric GUM_SCALAR >
274 GUM_ERROR(FatalError, "do not copy Instance")
275 }
276
277 template < GUM_Numeric GUM_SCALAR >
281
282 template < GUM_Numeric GUM_SCALAR >
286
287 template < GUM_Numeric GUM_SCALAR >
291
292 template < GUM_Numeric GUM_SCALAR >
294 return _nodeIdMap_.exists(id);
295 }
296
297 template < GUM_Numeric GUM_SCALAR >
298 bool PRMInstance< GUM_SCALAR >::exists(std::string_view name) const {
299 return _type_->exists(name) && exists(_type_->get(name).id());
300 }
301
302 template < GUM_Numeric GUM_SCALAR >
304 auto p = _nodeIdMap_.tryGet(id);
305 if (!p) GUM_ERROR(NotFound, "no PRMAttribute<GUM_SCALAR> with the given NodeId")
306 return *(*p);
307 }
308
309 template < GUM_Numeric GUM_SCALAR >
311 auto p = _nodeIdMap_.tryGet(id);
312 if (!p) GUM_ERROR(NotFound, "no PRMAttribute<GUM_SCALAR> with the given NodeId")
313 return *(*p);
314 }
315
316 template < GUM_Numeric GUM_SCALAR >
318 if (!exists(name)) GUM_ERROR(NotFound, "no PRMAttribute<GUM_SCALAR> with the given name")
319 return *(_nodeIdMap_[type().get(name).id()]);
320 }
321
322 template < GUM_Numeric GUM_SCALAR >
324 if (!exists(name)) GUM_ERROR(NotFound, "no PRMAttribute<GUM_SCALAR> with the given name")
325 return *(_nodeIdMap_[type().get(name).id()]);
326 }
327
328 template < GUM_Numeric GUM_SCALAR >
331 NodeId id = i->get(sc->lastElt().safeName()).id();
332 std::string name = sc->name();
333
334 auto p_rm = i->_referenceMap_.tryGet(id);
335 if (!p_rm) {
336 i->_referenceMap_.insert(id, new Set< PRMInstance< GUM_SCALAR >* >());
337 i->_referingAttr_.insert(id, new std::vector< pair >());
338 p_rm = i->_referenceMap_.tryGet(id);
339 }
340 (*p_rm)->insert(this);
341 (*i->_referingAttr_.tryGet(id))->push_back(std::make_pair(this, name));
342 }
343
344 template < GUM_Numeric GUM_SCALAR >
349
350 template < GUM_Numeric GUM_SCALAR >
352 auto p = _referenceMap_.tryGet(id);
353 if (!p)
355 "no ReferenceSlot<GUM_SCALAR> or SlotChain<GUM_SCALAR> "
356 "matches the given NodeId")
357 if ((*p)->size() > 0) {
358 return **((*p)->begin());
359 } else {
360 GUM_ERROR(UndefinedElement, "no Instance associated with the given NodeId")
361 }
362 }
363
364 template < GUM_Numeric GUM_SCALAR >
367 auto p = _referenceMap_.tryGet(id);
368 if (!p)
370 "no ReferenceSlot<GUM_SCALAR> or SlotChain<GUM_SCALAR> "
371 "matches the given NodeId")
372 return *(*p);
373 }
374
375 template < GUM_Numeric GUM_SCALAR >
379
380 template < GUM_Numeric GUM_SCALAR >
384
385 template < GUM_Numeric GUM_SCALAR >
389
390 template < GUM_Numeric GUM_SCALAR >
393 return _nodeIdMap_.end();
394 }
395
396 template < GUM_Numeric GUM_SCALAR >
398 auto p = _referenceMap_.tryGet(id);
399 if (!p) GUM_ERROR(NotFound, "no referred instances from this NodeId")
401 }
402
403 template < GUM_Numeric GUM_SCALAR >
406 auto p = _referenceMap_.tryGet(id);
407 if (!p) GUM_ERROR(NotFound, "no referred instances from this NodeId")
409 }
410
411 template < GUM_Numeric GUM_SCALAR >
416
417 template < GUM_Numeric GUM_SCALAR >
419 _set_(const_cast< Set< PRMInstance< GUM_SCALAR >* >& >(from._set_)), _iter_(from._iter_) {
421 }
422
423 template < GUM_Numeric GUM_SCALAR >
427
428 template < GUM_Numeric GUM_SCALAR >
431 _iter_ = from._iter_;
432 return *this;
433 }
434
435 template < GUM_Numeric GUM_SCALAR >
441
442 template < GUM_Numeric GUM_SCALAR >
444 return _iter_ == _set_.end();
445 }
446
447 template < GUM_Numeric GUM_SCALAR >
449 return _iter_ != from._iter_;
450 }
451
452 template < GUM_Numeric GUM_SCALAR >
454 return _iter_ == from._iter_;
455 }
456
457 template < GUM_Numeric GUM_SCALAR >
461
462 template < GUM_Numeric GUM_SCALAR >
466
467 template < GUM_Numeric GUM_SCALAR >
472
473 template < GUM_Numeric GUM_SCALAR >
478
479 template < GUM_Numeric GUM_SCALAR >
483
484 template < GUM_Numeric GUM_SCALAR >
490
491 template < GUM_Numeric GUM_SCALAR >
497
498 template < GUM_Numeric GUM_SCALAR >
500 return _iter_ == _set_.end();
501 }
502
503 template < GUM_Numeric GUM_SCALAR >
505 const RefConstIterator& from) const {
506 return _iter_ != from._iter_;
507 }
508
509 template < GUM_Numeric GUM_SCALAR >
511 const RefConstIterator& from) const {
512 return _iter_ == from._iter_;
513 }
514
515 template < GUM_Numeric GUM_SCALAR >
520
521 template < GUM_Numeric GUM_SCALAR >
526
527 template < GUM_Numeric GUM_SCALAR >
531
532 template < GUM_Numeric GUM_SCALAR >
537
538 template < GUM_Numeric GUM_SCALAR >
541 return _referingAttr_.begin();
542 }
543
544 template < GUM_Numeric GUM_SCALAR >
547 return _referingAttr_.end();
548 }
549
550 template < GUM_Numeric GUM_SCALAR >
551 std::vector< std::pair< PRMInstance< GUM_SCALAR >*, std::string > >&
555
556 template < GUM_Numeric GUM_SCALAR >
557 const std::vector< std::pair< PRMInstance< GUM_SCALAR >*, std::string > >&
559 return *(_referingAttr_[id]);
560 }
561
562 template < GUM_Numeric GUM_SCALAR >
564 auto p = _referingAttr_.tryGet(id);
565 return p && (!(*p)->empty());
566 }
567
568 template < GUM_Numeric GUM_SCALAR >
570 const auto& type_attr
571 = static_cast< const PRMAttribute< GUM_SCALAR >& >(type().get(attr->safeName()));
572 attr->copyCpf(bijection(), type_attr);
573 GUM_ASSERT(attr->cpf().contains(attr->type().variable()));
574 }
575
576 } /* namespace prm */
577} /* namespace gum */
Headers of gum::prm::PRMInstance<GUM_SCALAR>.
Set of pairs of elements with fast search for both elements.
Definition bijection.h:1640
Exception : fatal (unknown ?) error.
Exception : the element we looked for cannot be found.
Exception : out of bound.
Exception : wrong subtype or subclass.
Representation of a set.
Definition set.h:129
Exception : a looked-for element could not be found.
Exception: wrong PRMClassElement for this operation.
PRMType & type() override
See gum::PRMClassElement::type().
MultiDimImplementation< GUM_SCALAR > * buildImpl() const
Returns a pointer over an empty gum::MultiDimImplementation of the good type for this PRMAggregate.
PRMAttribute is a member of a Class in a PRM.
virtual void copyCpf(const Bijection< const DiscreteVariable *, const DiscreteVariable * > &bif, const PRMAttribute< GUM_SCALAR > &source)=0
See gum::PRMClassElement::elt_type().
const Tensor< GUM_SCALAR > & cpf() const override=0
See gum::PRMClassElement::cpf().
PRMType & type() override=0
See gum::PRMClassElement::type().
void addParent(const PRMClassElement< GUM_SCALAR > &elt) override=0
See gum::PRMClassElement::addParent_().
Abstract class representing an element of PRM class.
virtual ClassElementType elt_type() const =0
Return the type of class element this object is.
NodeId id() const
Returns the NodeId of this element in it's class DAG.
const std::string & safeName() const
Returns the safe name of this PRMClassElement, if any.
A PRMClass is an object of a PRM representing a fragment of a Bayesian network which can be instantia...
Definition PRMClass.h:77
Nested class to iterate over PRMReferenceSlot and PRMSlotChain<GUM_SCALAR> instantiations.
const Set< PRMInstance< GUM_SCALAR > * > & _set_
bool operator==(const RefConstIterator &from) const
const PRMInstance< GUM_SCALAR > & operator*() const
Set< PRMInstance< GUM_SCALAR > * >::const_iterator _iter_
RefConstIterator & operator=(const RefConstIterator &from)
bool operator!=(const RefConstIterator &from) const
RefConstIterator(const Set< PRMInstance< GUM_SCALAR > * > &set)
const PRMInstance< GUM_SCALAR > * operator->() const
Nested class to iterate over PRMReferenceSlot and PRMSlotChain<GUM_SCALAR> instantiations.
PRMInstance< GUM_SCALAR > & operator*() const
Set< PRMInstance< GUM_SCALAR > * >::iterator _iter_
Set< PRMInstance< GUM_SCALAR > * > & _set_
RefIterator(Set< PRMInstance< GUM_SCALAR > * > &set)
bool operator==(const RefIterator &from) const
PRMInstance< GUM_SCALAR > * operator->() const
RefIterator & operator=(const RefIterator &from)
bool operator!=(const RefIterator &from) const
An PRMInstance is a Bayesian network fragment defined by a Class and used in a PRMSystem.
Definition PRMInstance.h:79
NodeProperty< PRMAttribute< GUM_SCALAR > * > _nodeIdMap_
The gum::prm::PRMAttribute<GUM_SCALAR> and gum::prm::PRMAggregate<GUM_SCALAR> of this PRMInstance<GUM...
const PRMInstance< GUM_SCALAR > & getInstance(NodeId id) const
Fast access to the first instance in a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR>.
void instantiate()
Instantiate all nodes which requires it.
PRMInstance< GUM_SCALAR > & operator=(const PRMClass< GUM_SCALAR > &from)
Copy operator. Don't use it.
bool exists(NodeId id) const
Returns true if id matches an PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
const iterator & end()
Returns a reference over the iterator at the end of the list of gum::prm::PRMAttribute<GUM_SCALAR> in...
typename NodeProperty< PRMAttribute< GUM_SCALAR > * >::const_iterator const_iterator
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
void _copyAttribute_(PRMAttribute< GUM_SCALAR > *source)
Used at construction to instantiate attributes.
NodeProperty< Set< PRMInstance< GUM_SCALAR > * > * > _referenceMap_
Mapping between the gum::prm::PRMReferenceSlot and gum::prm::PRMSlotChain<GUM_SCALAR> in type / and t...
prm_type obj_type() const override
Returns the PRM type of this object.
bool _instantiated_
True if this instance has been instantiated.
void _copyAggregates_(PRMAggregate< GUM_SCALAR > *source)
Used at construction to instantiate aggregates.
Bijection< const DiscreteVariable *, const DiscreteVariable * > _bijection_
A bijection used for MultiDim handling.
Size size() const
Returns the number of attributes in this PRMInstance<GUM_SCALAR>.
~PRMInstance() override
Destructor.
PRMClass< GUM_SCALAR > * _type_
The type of this PRMInstance<GUM_SCALAR>.
void _instantiateSlotChain_(PRMSlotChain< GUM_SCALAR > *sc)
Retrieve all instances referred by sc.
typename NodeProperty< std::vector< std::pair< PRMInstance< GUM_SCALAR > *, std::string > > * >::const_iterator InvRefConstIterator
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
PRMAttribute< GUM_SCALAR > & get(NodeId id)
Getter on an PRMAttribute<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>.
typename NodeProperty< PRMAttribute< GUM_SCALAR > * >::iterator iterator
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
bool hasRefAttr(NodeId id) const
Returns true if id has at least one referring PRMAttribute<GUM_SCALAR>.
typename NodeProperty< std::vector< std::pair< PRMInstance< GUM_SCALAR > *, std::string > > * >::iterator InvRefIterator
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
void add(NodeId id, PRMInstance< GUM_SCALAR > &instance)
Add an PRMInstance<GUM_SCALAR> to a given PRMReferenceSlot, PRMSlotChain<GUM_SCALAR> or output node.
NodeProperty< std::vector< pair > * > _referingAttr_
The set of pair (instance, attribute) referring an attribute of this instance.
InvRefIterator beginInvRef()
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
const Bijection< const DiscreteVariable *, const DiscreteVariable * > & bijection() const
Returns a mapping between DiscreteVariable used in this and the ones used in this PRMInstance<GUM_SCA...
void _copyAttributeCPF_(PRMAttribute< GUM_SCALAR > *attr)
Copy the content of an PRMAttribute<GUM_SCALAR> from its Class<GUM_SCALAR> counterpart.
const InvRefIterator & endInvRef()
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
PRMClass< GUM_SCALAR > & type()
Returns the type of this instance.
PRMInstance(std::string_view name, PRMClass< GUM_SCALAR > &type)
Default constructor of an PRMInstance<GUM_SCALAR>.
std::vector< std::pair< PRMInstance< GUM_SCALAR > *, std::string > > & getRefAttr(NodeId id)
Returns a vector of pairs of refering attributes of id.
void _addReferingInstance_(PRMSlotChain< GUM_SCALAR > *sc, PRMInstance< GUM_SCALAR > *i)
Add this as a referring instance over the attribute pointed by sc in i.
void _doInstantiate_()
Starts this instance instantiations.
iterator begin()
Returns an iterator at the begining of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInst...
const Set< PRMInstance< GUM_SCALAR > * > & getInstances(NodeId id) const
Returns the Set of PRMInstance<GUM_SCALAR> referenced by id.
PRMObject(std::string_view name)
Constructor.
Definition PRMObject.cpp:62
const std::string & name() const
Returns the name of this object.
prm_type
Enumeration of the different types of objects handled by a PRM.
Definition PRMObject.h:90
A PRMReferenceSlot represent a relation between two PRMClassElementContainer.
PRMClassElementContainer< GUM_SCALAR > & slotType()
Returns the type of this slot, which is a PRMClassElementContainer (it is not the type of PRMObject).
<agrum/PRM/elements/scalarAttribute.h>
A PRMSlotChain represents a sequence of gum::prm::PRMClassElement<GUM_SCALAR> where the n-1 first gum...
PRMType & type() override
This is similar to the following call: this->lastElt().type().
PRMClassElement< GUM_SCALAR > & lastElt()
Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggre...
Sequence< PRMClassElement< GUM_SCALAR > * > & chain()
Return the sequence representing the chain of elements in this PRMSlotChain.
bool isMultiple() const
Return true if this slot chain contains at least one multiple reference slot.
PRMClassElementContainer< GUM_SCALAR > & end()
Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends.
DiscreteVariable & variable()
Return a reference on the DiscreteVariable contained in this.
Definition PRMType_inl.h:65
#define GUM_ERROR(type, msg)
Definition exceptions.h:76
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74
Size NodeId
Type for node ids.
Headers of MultiDimSparse.
namespace for all probabilistic relational models entities
Definition agrum.h:68
gum is the global namespace for all aGrUM entities
Definition agrum.h:46