![]() |
aGrUM
0.14.2
|
An PRMInstance is a Bayesian Network fragment defined by a Class and used in a PRMSystem. More...
#include <PRMInstance.h>
Public Member Functions | |
Constructors & private operators. | |
PRMInstance (const std::string &name, PRMClass< GUM_SCALAR > &type) | |
Default constructor of an PRMInstance<GUM_SCALAR>. More... | |
virtual | ~PRMInstance () |
Destructor. More... | |
Getters & setters. | |
virtual prm_type | obj_type () const |
Returns the PRM type of this object. More... | |
PRMClass< GUM_SCALAR > & | type () |
Returns the type of this instance. More... | |
const PRMClass< GUM_SCALAR > & | type () const |
Returns the type of this instance. More... | |
bool | exists (NodeId id) const |
Returns true if id matches an PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
bool | exists (const std::string &name) const |
Returns true if name matches an PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
PRMAttribute< GUM_SCALAR > & | get (NodeId id) |
Getter on an PRMAttribute<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>. More... | |
PRMAttribute< GUM_SCALAR > & | get (const std::string &name) |
Given a name returns the related PRMAttribute<GUM_SCALAR>. More... | |
const PRMAttribute< GUM_SCALAR > & | get (NodeId id) const |
Getter on an PRMAttribute<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>. More... | |
const PRMAttribute< GUM_SCALAR > & | get (const std::string &name) const |
Given a name returns the related PRMClassElement. More... | |
Size | size () const |
Returns the number of attributes in this PRMInstance<GUM_SCALAR>. More... | |
Instantiation methods. | |
void | instantiate () |
Instantiate all nodes which requires it. More... | |
const Bijection< const DiscreteVariable *, const DiscreteVariable *> & | bijection () const |
Returns a mapping between DiscreteVariable used in this and the ones used in this PRMInstance<GUM_SCALAR>'s Class<GUM_SCALAR>. More... | |
Reference handling. | |
void | add (NodeId id, PRMInstance< GUM_SCALAR > &instance) |
Add an PRMInstance<GUM_SCALAR> to a given PRMReferenceSlot, PRMSlotChain<GUM_SCALAR> or output node. More... | |
const PRMInstance< GUM_SCALAR > & | getInstance (NodeId id) const |
Fast access to the first instance in a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR>. More... | |
const Set< PRMInstance< GUM_SCALAR > *> & | getInstances (NodeId id) const |
Returns the Set of PRMInstance<GUM_SCALAR> referenced by id. More... | |
bool | hasRefAttr (NodeId id) const |
Returns true if id has at least one referring PRMAttribute<GUM_SCALAR>. More... | |
std::vector< std::pair< PRMInstance< GUM_SCALAR > *, std::string > > & | getRefAttr (NodeId id) |
Returns a vector of pairs of refering attributes of id. More... | |
const std::vector< std::pair< PRMInstance< GUM_SCALAR > *, std::string > > & | getRefAttr (NodeId id) const |
Returns a vector of pairs of refering attributes of id. More... | |
Getters & setters. | |
const std::string & | name () const |
Returns the name of this object. More... | |
void | name (const std::string &name) |
Change the name of the PRM Object. More... | |
Operators | |
bool | operator== (const PRMObject &obj) const |
To PRMObject are equal if they have the same name (which is unique). More... | |
bool | operator!= (const PRMObject &obj) const |
To PRMObject are equal if they have the same name (which is unique). More... | |
Classes | |
class | RefConstIterator |
Nested class to iterate over PRMReferenceSlot and PRMSlotChain<GUM_SCALAR> instantiations. More... | |
class | RefIterator |
Nested class to iterate over PRMReferenceSlot and PRMSlotChain<GUM_SCALAR> instantiations. More... | |
Iterators | |
typedef NodeProperty< PRMAttribute< GUM_SCALAR > *>::iterator | iterator |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
typedef NodeProperty< PRMAttribute< GUM_SCALAR > *>::const_iterator | const_iterator |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
typedef 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>. More... | |
typedef 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>. More... | |
iterator | begin () |
Returns an iterator at the begining of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
const iterator & | end () |
Returns a reference over the iterator at the end of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
const_iterator | begin () const |
Returns an iterator at the beginning of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
const const_iterator & | end () const |
Returns a reference over the iterator at the end of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
RefIterator | begin (NodeId id) |
Returns an iterator at the beginning of the set of PRMInstance<GUM_SCALAR> associated to a given gum::prm::PRMReferenceSlot or gum::prm::PRMSlotChain<GUM_SCALAR>. More... | |
RefConstIterator | begin (NodeId id) const |
Returns an iterator at the beginning of the set of PRMInstance<GUM_SCALAR> associated to a given gum::prm::PRMReferenceSlot or gum::prm::PRMSlotChain<GUM_SCALAR>. More... | |
InvRefIterator | beginInvRef () |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
const InvRefIterator & | endInvRef () |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
InvRefConstIterator | beginInvRef () const |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
const InvRefConstIterator & | endInvRef () const |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. More... | |
Private members. | |
typedef std::pair< PRMInstance< GUM_SCALAR > *, std::string > | pair |
Code alias. More... | |
bool | __instantiated |
True if this instance has been instantiated. More... | |
PRMClass< GUM_SCALAR > * | __type |
The type of this PRMInstance<GUM_SCALAR>. More... | |
NodeProperty< PRMAttribute< GUM_SCALAR > *> | __nodeIdMap |
The gum::prm::PRMAttribute<GUM_SCALAR> and gum::prm::PRMAggregate<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>. More... | |
NodeProperty< Set< PRMInstance< GUM_SCALAR > *> *> | __referenceMap |
Mapping between the gum::prm::PRMReferenceSlot and gum::prm::PRMSlotChain<GUM_SCALAR> in __type / and the PRMInstance<GUM_SCALAR> associated with it. More... | |
NodeProperty< std::vector< pair > *> | __referingAttr |
The set of pair (instance, attribute) referring an attribute of this instance. More... | |
Bijection< const DiscreteVariable *, const DiscreteVariable *> | __bijection |
A bijection used for MultiDim handling. More... | |
Built-in types. | |
enum | prm_type : char { prm_type::ALL, prm_type::CLASS, prm_type::PRM_INTERFACE, prm_type::CLASS_ELT, prm_type::TYPE, prm_type::SYSTEM, prm_type::INSTANCE } |
Enumeration of the different types of objects handled by a PRM. More... | |
static std::string | LEFT_CAST () |
Enumeration of the different types of objects handled by a PRM. More... | |
static std::string | RIGHT_CAST () |
Enumeration of the different types of objects handled by a PRM. More... | |
static std::string | enum2str (prm_type type) |
Returns the string representation of a PRMObject. More... | |
static INLINE bool | isClass (const PRMObject &obj) |
Returns true if obj_ptr is of type Class. More... | |
static INLINE bool | isInterface (const PRMObject &obj) |
Returns true if obj_ptr is of type PRMInterface. More... | |
static INLINE bool | isInstance (const PRMObject &obj) |
Returns true if obj_ptr is of type PRMInstance. More... | |
An PRMInstance is a Bayesian Network fragment defined by a Class and used in a PRMSystem.
Before using an PRMInstance for inference YOU MUST call PRMInstance::instantiateSlotChains() and PRMInstance::instantiate() on it before, otherwise DiscreteVariable pointers will be inconsistent and inference will be erroneous. Of course, this must be done once you have set all reference in the current system.
Definition at line 60 of file PRMInstance.h.
typedef NodeProperty< PRMAttribute< GUM_SCALAR >* >::const_iterator gum::prm::PRMInstance< GUM_SCALAR >::const_iterator |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 326 of file PRMInstance.h.
typedef NodeProperty< std::vector< std::pair< PRMInstance< GUM_SCALAR >*, std::string > >* >::const_iterator gum::prm::PRMInstance< GUM_SCALAR >::InvRefConstIterator |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 444 of file PRMInstance.h.
typedef NodeProperty< std::vector< std::pair< PRMInstance< GUM_SCALAR >*, std::string > >* >::iterator gum::prm::PRMInstance< GUM_SCALAR >::InvRefIterator |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 441 of file PRMInstance.h.
typedef NodeProperty< PRMAttribute< GUM_SCALAR >* >::iterator gum::prm::PRMInstance< GUM_SCALAR >::iterator |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 312 of file PRMInstance.h.
|
private |
Code alias.
Definition at line 519 of file PRMInstance.h.
|
stronginherited |
Enumeration of the different types of objects handled by a PRM.
The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.
Enumerator | |
---|---|
ALL | |
CLASS | |
PRM_INTERFACE | |
CLASS_ELT | |
TYPE | |
SYSTEM | |
INSTANCE |
Definition at line 66 of file PRMObject.h.
gum::prm::PRMInstance< GUM_SCALAR >::PRMInstance | ( | const std::string & | name, |
PRMClass< GUM_SCALAR > & | type | ||
) |
Default constructor of an PRMInstance<GUM_SCALAR>.
When you create an PRMInstance<GUM_SCALAR> all gum::prm::PRMAttribute<GUM_SCALAR> in it's type are added, except for gum::prm::PRMAggregate<GUM_SCALAR> and parameters which are instantiated.
However neither of their children or parents are updated (i.e. DiscreteVariable pointers are inconsistent).
Definition at line 34 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__copyAggregates(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAttribute(), and gum::prm::PRMInstance< GUM_SCALAR >::__type.
|
virtual |
Destructor.
Definition at line 51 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap, gum::prm::PRMInstance< GUM_SCALAR >::__referenceMap, and gum::prm::PRMInstance< GUM_SCALAR >::__referingAttr.
|
private |
Copy constructor.
Definition at line 252 of file PRMInstance_tpl.h.
References GUM_ERROR.
|
private |
Add this as a referring instance over the attribute pointed by sc in i.
sc | A slot chain pointing over an attribute in i. |
i | An instance holding an attribute pointed by sc. |
Definition at line 331 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referenceMap, gum::prm::PRMInstance< GUM_SCALAR >::__referingAttr, gum::prm::PRMInstance< GUM_SCALAR >::get(), gum::prm::PRMSlotChain< GUM_SCALAR >::lastElt(), and gum::prm::PRMObject::name().
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::__instantiateSlotChain().
|
private |
Used at construction to instantiate aggregates.
Definition at line 228 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__bijection, gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap, gum::prm::PRMAggregate< GUM_SCALAR >::buildImpl(), gum::prm::PRMClassElement< GUM_SCALAR >::id(), gum::prm::PRMObject::name(), and gum::prm::PRMAggregate< GUM_SCALAR >::type().
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::PRMInstance().
|
private |
Used at construction to instantiate attributes.
source | An attribute in __type. |
Definition at line 239 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__bijection, gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap, gum::prm::PRMClassElement< GUM_SCALAR >::id(), gum::prm::PRMObject::name(), and gum::prm::PRMAttribute< GUM_SCALAR >::type().
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::PRMInstance().
|
private |
Copy the content of an PRMAttribute<GUM_SCALAR> from its Class<GUM_SCALAR> counterpart.
attr | An PRMAttribute<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>. |
OperationNotAllowed | If the MultiDimImplementation is of an unknown type. |
Definition at line 600 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::bijection(), gum::prm::PRMAttribute< GUM_SCALAR >::copyCpf(), gum::prm::PRMAttribute< GUM_SCALAR >::cpf(), gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), gum::prm::PRMAttribute< GUM_SCALAR >::type(), and gum::prm::PRMInstance< GUM_SCALAR >::type().
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::__doInstantiate().
|
private |
Starts this instance instantiations.
Definition at line 73 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__copyAttributeCPF(), gum::prm::PRMInstance< GUM_SCALAR >::__instantiateSlotChain(), gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap, gum::prm::PRMAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMInstance< GUM_SCALAR >::getInstances(), and gum::prm::PRMInstance< GUM_SCALAR >::type().
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::instantiate().
|
private |
Retrieve all instances referred by sc.
sc | A slot chain of this instance's type. |
NotFound | Raised if a reference in sc is not instantiated. |
Definition at line 106 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__addReferingInstance(), gum::prm::PRMInstance< GUM_SCALAR >::__bijection, gum::prm::PRMInstance< GUM_SCALAR >::__referenceMap, gum::prm::PRMSlotChain< GUM_SCALAR >::chain(), gum::prm::PRMClassElement< GUM_SCALAR >::id(), gum::Set< Key, Alloc >::insert(), gum::prm::PRMSlotChain< GUM_SCALAR >::isMultiple(), gum::prm::PRMSlotChain< GUM_SCALAR >::lastElt(), and gum::prm::PRMSlotChain< GUM_SCALAR >::type().
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::__doInstantiate().
void gum::prm::PRMInstance< GUM_SCALAR >::add | ( | NodeId | id, |
PRMInstance< GUM_SCALAR > & | instance | ||
) |
Add an PRMInstance<GUM_SCALAR> to a given PRMReferenceSlot, PRMSlotChain<GUM_SCALAR> or output node.
Three type of nodes can be associated with an PRMInstance<GUM_SCALAR>. When an PRMInstance<GUM_SCALAR> is associated with a PRMReferenceSlot, it represents an arc in the relational skeleton. For a PRMSlotChain<GUM_SCALAR>, it is a placeholder of referenced PRMClassElement by this PRMInstance<GUM_SCALAR>. Finally, for an output node it indicates that an PRMInstance<GUM_SCALAR> has an PRMClassElement referring it.
id | The NodeId of a PRMReferenceSlot of this PRMInstance<GUM_SCALAR>. |
instance | The instance added as references by id in this PRMInstance<GUM_SCALAR>. |
WrongClassElement | Raised if id is not a valid PRMClassElement. |
OutOfUpperBound | Raised if no more PRMInstance<GUM_SCALAR> can be added to id. |
TypeError | Raised if instance's type isn't compatible with the reference's type. |
NotFound | If there is no PRMClassElement given id. |
Definition at line 150 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referenceMap, gum::prm::PRMClassElement< GUM_SCALAR >::elt_type(), gum::prm::PRMSlotChain< GUM_SCALAR >::end(), GUM_ERROR, gum::prm::PRMInstance< GUM_SCALAR >::size(), gum::prm::PRMReferenceSlot< GUM_SCALAR >::slotType(), and gum::prm::PRMInstance< GUM_SCALAR >::type().
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__addInstance().
INLINE PRMInstance< GUM_SCALAR >::iterator gum::prm::PRMInstance< GUM_SCALAR >::begin | ( | ) |
Returns an iterator at the begining of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 386 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap.
Referenced by gum::prm::SVE< GUM_SCALAR >::__eliminateNodes(), gum::prm::StructuredInference< GUM_SCALAR >::__reduceAloneInstances(), and gum::prm::StructuredInference< GUM_SCALAR >::searchPatterns().
INLINE PRMInstance< GUM_SCALAR >::const_iterator gum::prm::PRMInstance< GUM_SCALAR >::begin | ( | ) | const |
Returns an iterator at the beginning of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 398 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap.
INLINE PRMInstance< GUM_SCALAR >::RefIterator gum::prm::PRMInstance< GUM_SCALAR >::begin | ( | NodeId | id | ) |
Returns an iterator at the beginning of the set of PRMInstance<GUM_SCALAR> associated to a given gum::prm::PRMReferenceSlot or gum::prm::PRMSlotChain<GUM_SCALAR>.
id | A gum::prm::PRMReferenceSlot or gum::prm::PRMSlotChain<GUM_SCALAR> in this PRMInstance<GUM_SCALAR> type. |
NotFound | Raised if no gum::prm::PRMClassElement in this PRMInstance<GUM_SCALAR> type matches id. |
WrongClassElement | Raised if id is neither a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR>. |
Definition at line 410 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referenceMap, and GUM_ERROR.
INLINE PRMInstance< GUM_SCALAR >::RefConstIterator gum::prm::PRMInstance< GUM_SCALAR >::begin | ( | NodeId | id | ) | const |
Returns an iterator at the beginning of the set of PRMInstance<GUM_SCALAR> associated to a given gum::prm::PRMReferenceSlot or gum::prm::PRMSlotChain<GUM_SCALAR>.
id | A gum::prm::PRMReferenceSlot or gum::prm::PRMSlotChain<GUM_SCALAR> in this PRMInstance<GUM_SCALAR> type. |
NotFound | Raised if no gum::prm::PRMClassElement in this PRMInstance<GUM_SCALAR> type matches id. |
WrongClassElement | Raised if id is neither a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR>. |
Definition at line 420 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referenceMap, and GUM_ERROR.
INLINE PRMInstance< GUM_SCALAR >::InvRefIterator gum::prm::PRMInstance< GUM_SCALAR >::beginInvRef | ( | ) |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 559 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referingAttr.
Referenced by gum::prm::SVE< GUM_SCALAR >::__eliminateNodes(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodesDownward(), and gum::prm::SVE< GUM_SCALAR >::__eliminateNodesUpward().
INLINE PRMInstance< GUM_SCALAR >::InvRefConstIterator gum::prm::PRMInstance< GUM_SCALAR >::beginInvRef | ( | ) | const |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 571 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referingAttr.
INLINE const Bijection< const DiscreteVariable *, const DiscreteVariable *> & gum::prm::PRMInstance< GUM_SCALAR >::bijection | ( | ) | const |
Returns a mapping between DiscreteVariable used in this and the ones used in this PRMInstance<GUM_SCALAR>'s Class<GUM_SCALAR>.
MultiDims require distinctive DiscreteVariable pointers, thus interface attributes are always instantiated to prevent multiple insertion of the same DiscreteVariable pointer in a MultiDim.
Definition at line 351 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__bijection.
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::__copyAttributeCPF(), gum::prm::SVED< GUM_SCALAR >::__insertLiftedNodes(), gum::prm::SVE< GUM_SCALAR >::__insertLiftedNodes(), and gum::prm::StructuredInference< GUM_SCALAR >::__reduceAloneInstances().
INLINE const PRMInstance< GUM_SCALAR >::iterator & gum::prm::PRMInstance< GUM_SCALAR >::end | ( | ) |
Returns a reference over the iterator at the end of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 392 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap.
Referenced by gum::prm::SVE< GUM_SCALAR >::__eliminateNodes(), and gum::prm::StructuredInference< GUM_SCALAR >::__reduceAloneInstances().
INLINE const PRMInstance< GUM_SCALAR >::const_iterator & gum::prm::PRMInstance< GUM_SCALAR >::end | ( | ) | const |
Returns a reference over the iterator at the end of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 404 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap.
INLINE const PRMInstance< GUM_SCALAR >::InvRefIterator & gum::prm::PRMInstance< GUM_SCALAR >::endInvRef | ( | ) |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 565 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referingAttr.
Referenced by gum::prm::SVE< GUM_SCALAR >::__eliminateNodes(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodesDownward(), and gum::prm::SVE< GUM_SCALAR >::__eliminateNodesUpward().
INLINE const PRMInstance< GUM_SCALAR >::InvRefConstIterator & gum::prm::PRMInstance< GUM_SCALAR >::endInvRef | ( | ) | const |
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 577 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referingAttr.
|
inlinestaticinherited |
Returns the string representation of a PRMObject.
Definition at line 80 of file PRMObject.h.
References gum::prm::PRMObject::CLASS, gum::prm::PRMObject::CLASS_ELT, gum::prm::PRMObject::INSTANCE, gum::prm::PRMObject::PRM_INTERFACE, gum::prm::PRMObject::SYSTEM, and gum::prm::PRMObject::TYPE.
Referenced by gum::prm::operator<<().
INLINE bool gum::prm::PRMInstance< GUM_SCALAR >::exists | ( | NodeId | id | ) | const |
Returns true if id matches an PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 282 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap.
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::exists(), and gum::prm::o3prmr::O3prmrInterpreter::findAttributeName().
INLINE bool gum::prm::PRMInstance< GUM_SCALAR >::exists | ( | const std::string & | name | ) | const |
Returns true if name matches an PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
Definition at line 287 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__type, and gum::prm::PRMInstance< GUM_SCALAR >::exists().
INLINE PRMAttribute< GUM_SCALAR > & gum::prm::PRMInstance< GUM_SCALAR >::get | ( | NodeId | id | ) |
Getter on an PRMAttribute<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>.
Recall that PRMAggregate<GUM_SCALAR> are instantiated as PRMAttribute<GUM_SCALAR> when an PRMInstance<GUM_SCALAR> is created. Thus any random variable contained in this PRMInstance<GUM_SCALAR> is mapped to an PRMAttribute<GUM_SCALAR>.
id | The PRMAttribute<GUM_SCALAR> id. |
NotFound | Raised if no PRMAttribute<GUM_SCALAR> matches name. |
Definition at line 292 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap, and GUM_ERROR.
Referenced by gum::prm::SVE< GUM_SCALAR >::__addDelayedVariable(), gum::prm::PRMInstance< GUM_SCALAR >::__addReferingInstance(), gum::prm::SVED< GUM_SCALAR >::__eliminateNodes(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodesWithEvidence(), gum::prm::SVED< GUM_SCALAR >::__getAggPotential(), gum::prm::SVE< GUM_SCALAR >::__getAggPotential(), gum::prm::PRMSystem< double >::__groundAttr(), gum::prm::PRMSystem< double >::__groundPotential(), gum::prm::InstanceBayesNet< GUM_SCALAR >::__init(), gum::prm::StructuredInference< GUM_SCALAR >::__insertNodeInElimLists(), gum::prm::StructuredBayesBall< GUM_SCALAR >::__isHardEvidence(), gum::prm::StructuredInference< GUM_SCALAR >::__reduceAloneInstances(), gum::prm::o3prmr::O3prmrInterpreter::checkObserve(), gum::prm::o3prmr::O3prmrInterpreter::checkQuery(), and gum::prm::o3prmr::O3prmrInterpreter::checkUnobserve().
INLINE PRMAttribute< GUM_SCALAR > & gum::prm::PRMInstance< GUM_SCALAR >::get | ( | const std::string & | name | ) |
Given a name returns the related PRMAttribute<GUM_SCALAR>.
name | The PRMAttribute<GUM_SCALAR>'s name. |
NotFound | Raised if there is no PRMAttribute<GUM_SCALAR> named n. |
Definition at line 312 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap, GUM_ERROR, and gum::prm::PRMInstance< GUM_SCALAR >::type().
INLINE const PRMAttribute< GUM_SCALAR > & gum::prm::PRMInstance< GUM_SCALAR >::get | ( | NodeId | id | ) | const |
Getter on an PRMAttribute<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>.
Recall that PRMAggregate<GUM_SCALAR> are instantiated has PRMAttribute<GUM_SCALAR> when an PRMInstance<GUM_SCALAR> is created. Thus any random variable contained in this PRMInstance<GUM_SCALAR> is mapped to an PRMAttribute<GUM_SCALAR>.
id | The PRMAttribute<GUM_SCALAR> id. |
NotFound | Raised if no PRMAttribute<GUM_SCALAR> matches name. |
Definition at line 302 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap, and GUM_ERROR.
INLINE const PRMAttribute< GUM_SCALAR > & gum::prm::PRMInstance< GUM_SCALAR >::get | ( | const std::string & | name | ) | const |
Given a name returns the related PRMClassElement.
name | The PRMClassElement's name. |
NotFound | Raised if there is no PRMClassElement named n. |
Definition at line 322 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap, GUM_ERROR, and gum::prm::PRMInstance< GUM_SCALAR >::type().
INLINE const PRMInstance< GUM_SCALAR > & gum::prm::PRMInstance< GUM_SCALAR >::getInstance | ( | NodeId | id | ) | const |
Fast access to the first instance in a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR>.
This is equivalent to **(this->getInstance(id).begin()) and should be use when dealing with non multiple PRMReferenceSlot or PRMSlotChain<GUM_SCALAR>.
id | The NodeId of a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>. |
NotFound | Raised if there is no PRMClassElement given id. |
UndefinedElement | Raised if no PRMInstance<GUM_SCALAR> are referenced by id. |
Definition at line 357 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referenceMap, GUM_ERROR, and gum::prm::PRMInstance< GUM_SCALAR >::size().
Referenced by gum::prm::PRMSystem< double >::__groundPotential().
INLINE const Set< PRMInstance< GUM_SCALAR > *> & gum::prm::PRMInstance< GUM_SCALAR >::getInstances | ( | NodeId | id | ) | const |
Returns the Set of PRMInstance<GUM_SCALAR> referenced by id.
id | The NodeId of a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR> in this. |
NotFound | If there is no PRMClassElement given id. |
Definition at line 374 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referenceMap, and GUM_ERROR.
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::__doInstantiate(), gum::prm::SVED< GUM_SCALAR >::__eliminateNodes(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodes(), gum::prm::SVED< GUM_SCALAR >::__eliminateNodesDownward(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodesDownward(), gum::prm::SVED< GUM_SCALAR >::__eliminateNodesUpward(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodesUpward(), and gum::prm::StructuredBayesBall< GUM_SCALAR >::__fromChild().
INLINE std::vector< std::pair< PRMInstance< GUM_SCALAR > *, std::string > > & gum::prm::PRMInstance< GUM_SCALAR >::getRefAttr | ( | NodeId | id | ) |
Returns a vector of pairs of refering attributes of id.
Definition at line 583 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referingAttr.
Referenced by gum::prm::SVED< GUM_SCALAR >::__eliminateNodes(), gum::prm::SVED< GUM_SCALAR >::__eliminateNodesDownward(), gum::prm::SVED< GUM_SCALAR >::__eliminateNodesUpward(), gum::prm::StructuredBayesBall< GUM_SCALAR >::__fromChild(), gum::prm::StructuredBayesBall< GUM_SCALAR >::__fromParent(), and gum::prm::StructuredInference< GUM_SCALAR >::__insertNodeInElimLists().
INLINE const std::vector< std::pair< PRMInstance< GUM_SCALAR > *, std::string > > & gum::prm::PRMInstance< GUM_SCALAR >::getRefAttr | ( | NodeId | id | ) | const |
Returns a vector of pairs of refering attributes of id.
Definition at line 590 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referingAttr.
INLINE bool gum::prm::PRMInstance< GUM_SCALAR >::hasRefAttr | ( | NodeId | id | ) | const |
Returns true if id has at least one referring PRMAttribute<GUM_SCALAR>.
id | A NodeId. |
Definition at line 595 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__referingAttr.
void gum::prm::PRMInstance< GUM_SCALAR >::instantiate | ( | ) |
Instantiate all nodes which requires it.
All attributes are now instantiated, which means they have a different DiscreteVariable pointer. This methods however still connects attributes of different instance together.
Definition at line 65 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__doInstantiate(), and gum::prm::PRMInstance< GUM_SCALAR >::__instantiated.
Returns true if obj_ptr is of type Class.
Definition at line 99 of file PRMObject.h.
References gum::prm::PRMObject::CLASS, and gum::prm::PRMObject::obj_type().
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().
Returns true if obj_ptr is of type PRMInstance.
Definition at line 109 of file PRMObject.h.
References gum::prm::PRMObject::INSTANCE, gum::prm::PRMObject::name(), gum::prm::PRMObject::obj_type(), gum::prm::PRMObject::operator!=(), gum::prm::PRMObject::operator=(), gum::prm::PRMObject::operator==(), gum::prm::PRMObject::PRMObject(), and gum::prm::PRMObject::~PRMObject().
Returns true if obj_ptr is of type PRMInterface.
Definition at line 104 of file PRMObject.h.
References gum::prm::PRMObject::obj_type(), and gum::prm::PRMObject::PRM_INTERFACE.
|
inlinestaticinherited |
Enumeration of the different types of objects handled by a PRM.
The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.
Definition at line 76 of file PRMObject.h.
Referenced by gum::prm::decomposePath(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), and gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute().
|
inherited |
Returns the name of this object.
Definition at line 32 of file PRMObject_inl.h.
References gum::prm::PRMObject::__name.
Referenced by gum::prm::SVE< GUM_SCALAR >::__addDelayedVariable(), gum::prm::PRMClass< double >::__addIOInterfaceFlags(), gum::prm::PRMFactory< GUM_SCALAR >::__addParent(), gum::prm::PRMInstance< GUM_SCALAR >::__addReferingInstance(), gum::prm::PRMClass< double >::__checkInterface(), gum::prm::PRMFactory< GUM_SCALAR >::__checkInterfaceImplementation(), gum::prm::PRMClass< double >::__checkInterfaces(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__checkRawCPT(), gum::prm::PRMClass< double >::__checkRefInterface(), gum::prm::PRMClass< double >::__checkRefInterfaces(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__checkRuleCPTSumsTo1(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAggregates(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAttribute(), gum::prm::PRMSlotChain< double >::__copyLastElt(), gum::prm::PRMSystem< double >::__groundAttr(), gum::prm::PRMSystem< double >::__groundPotential(), gum::prm::PRMSystem< double >::__groundRef(), gum::prm::PRMClass< double >::__inheritClass(), gum::prm::PRMInterface< double >::__overloadAttribute(), gum::prm::PRMClass< double >::__overloadAttribute(), gum::prm::PRMClass< double >::__overloadParameter(), gum::prm::PRMClass< double >::__overloadReference(), gum::prm::PRMInterface< double >::__overloadReferenceSlot(), gum::prm::__print_attribute__(), gum::prm::__print_instance__(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::__str(), gum::prm::StructuredInference< GUM_SCALAR >::__str(), gum::prm::PRMInterface< double >::add(), gum::prm::PRMSystem< double >::add(), gum::prm::PRMClass< double >::add(), gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), gum::prm::PRMFormAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMFormAttribute< GUM_SCALAR >::copy(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::copy(), gum::prm::o3prmr::O3prmrInterpreter::findAttributeName(), gum::prm::o3prmr::O3prmrInterpreter::findInstanceName(), gum::prm::PRMFormAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMClass< double >::inheritAggregates(), gum::prm::PRMClass< double >::isCastDescendant(), gum::prm::PRMObject::isInstance(), gum::prm::PRMObject::name(), gum::prm::PRMType::name(), gum::prm::PRMFormAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMType::operator!=(), gum::prm::PRMObject::operator!=(), operator<<(), gum::prm::PRMType::operator==(), gum::prm::PRMObject::operator==(), gum::prm::PRMClass< double >::overload(), gum::prm::PRMInterface< double >::overload(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMReferenceSlot< double >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMFactory< GUM_SCALAR >::startClass(), gum::prm::PRMFactory< GUM_SCALAR >::startInterface(), gum::prm::PRMFactory< GUM_SCALAR >::startSystem(), and gum::prm::PRMAggregate< double >::str2enum().
|
inherited |
Change the name of the PRM Object.
Definition at line 36 of file PRMObject_inl.h.
References gum::prm::PRMObject::__name, and gum::prm::PRMObject::name().
|
virtual |
Returns the PRM type of this object.
Implements gum::prm::PRMObject.
Definition at line 267 of file PRMInstance_tpl.h.
References gum::prm::PRMObject::INSTANCE.
To PRMObject are equal if they have the same name (which is unique).
Definition at line 46 of file PRMObject_inl.h.
References gum::prm::PRMObject::__name, and gum::prm::PRMObject::name().
Referenced by gum::prm::PRMObject::isInstance().
|
private |
Copy operator. Don't use it.
Definition at line 262 of file PRMInstance_tpl.h.
References GUM_ERROR.
To PRMObject are equal if they have the same name (which is unique).
Definition at line 40 of file PRMObject_inl.h.
References gum::prm::PRMObject::__name, and gum::prm::PRMObject::name().
Referenced by gum::prm::PRMObject::isInstance().
|
inlinestaticinherited |
Enumeration of the different types of objects handled by a PRM.
The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.
Definition at line 77 of file PRMObject.h.
Referenced by gum::prm::decomposePath(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), and gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute().
INLINE Size gum::prm::PRMInstance< GUM_SCALAR >::size | ( | ) | const |
Returns the number of attributes in this PRMInstance<GUM_SCALAR>.
Definition at line 223 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__nodeIdMap.
Referenced by gum::prm::StructuredInference< GUM_SCALAR >::__reduceAloneInstances(), gum::prm::PRMInstance< GUM_SCALAR >::add(), and gum::prm::PRMInstance< GUM_SCALAR >::getInstance().
INLINE PRMClass< GUM_SCALAR > & gum::prm::PRMInstance< GUM_SCALAR >::type | ( | ) |
Returns the type of this instance.
Definition at line 272 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__type.
Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::__buildHashKey(), gum::prm::SVED< GUM_SCALAR >::__checkElimOrder(), gum::prm::SVE< GUM_SCALAR >::__checkElimOrder(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAttributeCPF(), gum::prm::PRMInstance< GUM_SCALAR >::__doInstantiate(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodes(), gum::prm::SVED< GUM_SCALAR >::__eliminateNodesDownward(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodesDownward(), gum::prm::SVED< GUM_SCALAR >::__eliminateNodesUpward(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodesUpward(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodesWithEvidence(), gum::prm::StructuredBayesBall< GUM_SCALAR >::__fromChild(), gum::prm::StructuredBayesBall< GUM_SCALAR >::__fromParent(), gum::prm::StructuredBayesBall< GUM_SCALAR >::__getSC(), gum::prm::PRMSystem< double >::__groundAttr(), gum::prm::PRMSystem< double >::__groundPotential(), gum::prm::InstanceBayesNet< GUM_SCALAR >::__init(), gum::prm::SVED< GUM_SCALAR >::__initLiftedNodes(), gum::prm::SVED< GUM_SCALAR >::__initReqSets(), gum::prm::SVE< GUM_SCALAR >::__insertLiftedNodes(), gum::prm::StructuredInference< GUM_SCALAR >::__insertNodeInElimLists(), gum::prm::__print_attribute__(), gum::prm::StructuredInference< GUM_SCALAR >::__reduceAloneInstances(), gum::prm::SVE< GUM_SCALAR >::__variableElimination(), gum::prm::PRMSystem< double >::add(), gum::prm::PRMInstance< GUM_SCALAR >::add(), and gum::prm::PRMInstance< GUM_SCALAR >::get().
INLINE const PRMClass< GUM_SCALAR > & gum::prm::PRMInstance< GUM_SCALAR >::type | ( | ) | const |
Returns the type of this instance.
Definition at line 277 of file PRMInstance_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::__type.
|
private |
A bijection used for MultiDim handling.
Definition at line 526 of file PRMInstance.h.
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::__copyAggregates(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAttribute(), gum::prm::PRMInstance< GUM_SCALAR >::__instantiateSlotChain(), and gum::prm::PRMInstance< GUM_SCALAR >::bijection().
|
private |
True if this instance has been instantiated.
Definition at line 504 of file PRMInstance.h.
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::instantiate().
|
private |
The gum::prm::PRMAttribute<GUM_SCALAR> and gum::prm::PRMAggregate<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>.
Definition at line 511 of file PRMInstance.h.
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::__copyAggregates(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAttribute(), gum::prm::PRMInstance< GUM_SCALAR >::__doInstantiate(), gum::prm::PRMInstance< GUM_SCALAR >::begin(), gum::prm::PRMInstance< GUM_SCALAR >::end(), gum::prm::PRMInstance< GUM_SCALAR >::exists(), gum::prm::PRMInstance< GUM_SCALAR >::get(), gum::prm::PRMInstance< GUM_SCALAR >::size(), and gum::prm::PRMInstance< GUM_SCALAR >::~PRMInstance().
|
private |
Mapping between the gum::prm::PRMReferenceSlot and gum::prm::PRMSlotChain<GUM_SCALAR> in __type / and the PRMInstance<GUM_SCALAR> associated with it.
Definition at line 516 of file PRMInstance.h.
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::__addReferingInstance(), gum::prm::PRMInstance< GUM_SCALAR >::__instantiateSlotChain(), gum::prm::PRMInstance< GUM_SCALAR >::add(), gum::prm::PRMInstance< GUM_SCALAR >::begin(), gum::prm::PRMInstance< GUM_SCALAR >::getInstance(), gum::prm::PRMInstance< GUM_SCALAR >::getInstances(), and gum::prm::PRMInstance< GUM_SCALAR >::~PRMInstance().
|
private |
The set of pair (instance, attribute) referring an attribute of this instance.
Definition at line 523 of file PRMInstance.h.
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::__addReferingInstance(), gum::prm::PRMInstance< GUM_SCALAR >::beginInvRef(), gum::prm::PRMInstance< GUM_SCALAR >::endInvRef(), gum::prm::PRMInstance< GUM_SCALAR >::getRefAttr(), gum::prm::PRMInstance< GUM_SCALAR >::hasRefAttr(), and gum::prm::PRMInstance< GUM_SCALAR >::~PRMInstance().
|
private |
The type of this PRMInstance<GUM_SCALAR>.
Definition at line 507 of file PRMInstance.h.
Referenced by gum::prm::PRMInstance< GUM_SCALAR >::exists(), gum::prm::PRMInstance< GUM_SCALAR >::PRMInstance(), and gum::prm::PRMInstance< GUM_SCALAR >::type().