![]() |
aGrUM
0.21.0
a C++ library for (probabilistic) graphical models
|
This class is an implementation of the Structured Variable Elimination algorithm on PRM<GUM_SCALAR>. More...
#include <agrum/PRM/SVE.h>
Public Member Functions | |
Constructors & destructor. | |
SVE (const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system) | |
Default Constructor. More... | |
~SVE () | |
Destructor. More... | |
Getters & setters. | |
virtual std::string | name () const |
Returns the name of the current inference algorithm. More... | |
Query methods. | |
void | posterior (const Chain &chain, Potential< GUM_SCALAR > &m) |
Compute the posterior of the formal attribute pointed by chain and stores it in m. More... | |
void | joint (const std::vector< Chain > &chains, Potential< GUM_SCALAR > &j) |
Compute the joint probability of the formals attributes pointed by chains and stores it in m. More... | |
Evidence handling. | |
EMap & | evidence (const PRMInstance< GUM_SCALAR > &i) |
Returns EMap of evidences over i. More... | |
EMap & | evidence (const PRMInstance< GUM_SCALAR > *i) |
Returns EMap of evidences over i. More... | |
const EMap & | evidence (const PRMInstance< GUM_SCALAR > &i) const |
Returns EMap of evidences over i. More... | |
const EMap & | evidence (const PRMInstance< GUM_SCALAR > *i) const |
Returns EMap of evidences over i. More... | |
bool | hasEvidence (const PRMInstance< GUM_SCALAR > &i) const |
Returns true if i has evidence. More... | |
bool | hasEvidence (const PRMInstance< GUM_SCALAR > *i) const |
Returns EMap of evidences over i. More... | |
bool | hasEvidence (const Chain &chain) const |
Returns true if i has evidence on PRMAttribute<GUM_SCALAR> a. More... | |
bool | hasEvidence () const |
Returns true if i has evidence on PRMAttribute<GUM_SCALAR> a. More... | |
void | addEvidence (const Chain &chain, const Potential< GUM_SCALAR > &p) |
Add an evidence to the given instance's elt. More... | |
void | removeEvidence (const Chain &chain) |
Remove evidence on the given instance's elt. More... | |
void | clearEvidence () |
Remove all evidences. More... | |
Public Types | |
typedef NodeProperty< const Potential< GUM_SCALAR > *> | EMap |
Code alias. More... | |
typedef NodeProperty< const Potential< GUM_SCALAR > *>::iterator_safe | EMapIterator |
Code alias. More... | |
typedef NodeProperty< const Potential< GUM_SCALAR > *>::const_iterator_safe | EMapConstIterator |
Code alias. More... | |
Protected Attributes | |
Protected members. | |
PRM< GUM_SCALAR > const * | prm_ |
The PRM<GUM_SCALAR> on which inference is done. More... | |
PRMSystem< GUM_SCALAR > const * | sys_ |
The Model on which inference is done. More... | |
Query methods. | |
typedef PRMInference< GUM_SCALAR >::Chain | Chain |
Code alias. More... | |
virtual void | evidenceAdded_ (const Chain &chain) |
See PRMInference<GUM_SCALAR>::evidenceAdded_(). More... | |
virtual void | evidenceRemoved_ (const Chain &chain) |
See PRMInference<GUM_SCALAR>::evidenceRemoved_(). More... | |
virtual void | posterior_ (const Chain &chain, Potential< GUM_SCALAR > &m) |
See PRMInference<GUM_SCALAR>::posterior_(). More... | |
virtual void | joint_ (const std::vector< Chain > &queries, Potential< GUM_SCALAR > &j) |
See PRMInference<GUM_SCALAR>::joint_(). More... | |
This class is an implementation of the Structured Variable Elimination algorithm on PRM<GUM_SCALAR>.
|
private |
|
private |
|
private |
|
protected |
|
inherited |
Code alias.
Definition at line 58 of file PRMInference.h.
|
inherited |
Code alias.
Definition at line 65 of file PRMInference.h.
|
inherited |
Code alias.
Definition at line 61 of file PRMInference.h.
INLINE gum::prm::SVE< GUM_SCALAR >::SVE | ( | const PRM< GUM_SCALAR > & | prm, |
const PRMSystem< GUM_SCALAR > & | system | ||
) |
Default Constructor.
Definition at line 602 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
gum::prm::SVE< GUM_SCALAR >::~SVE | ( | ) |
Destructor.
Definition at line 106 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
When there is a loop in the references some variable elimination must be delayed, this methods add such variable to delayedVariables to keep track of them.
i | An PRMInstance<GUM_SCALAR> with a child of j->get(id). |
j | The PRMInstance<GUM_SCALAR> with the delayed variable. |
id | The NodeId of the delayed variable. |
Definition at line 657 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 630 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 207 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 125 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 234 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 322 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 375 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 641 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 618 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 527 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 476 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 610 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 456 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 623 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if second can be eliminated before first.
Definition at line 282 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
inherited |
Add an evidence to the given instance's elt.
chain | The variable being observed. |
p | The Potential added (by copy) as evidence. |
NotFound | Raised if elt does not belong to i. |
OperationNotAllowed | Raised if p is inconsistent with elt. |
Definition at line 105 of file PRMInference_tpl.h.
|
inherited |
Remove all evidences.
Definition at line 35 of file PRMInference_tpl.h.
|
inherited |
Returns EMap of evidences over i.
NotFound | if i has no evidence. |
Definition at line 151 of file PRMInference_tpl.h.
|
inherited |
Returns EMap of evidences over i.
NotFound | if i has no evidence. |
Definition at line 167 of file PRMInference_tpl.h.
|
inherited |
Returns EMap of evidences over i.
NotFound | if i has no evidence. |
Definition at line 159 of file PRMInference_tpl.h.
|
inherited |
Returns EMap of evidences over i.
NotFound | if i has no evidence. |
Definition at line 175 of file PRMInference_tpl.h.
|
protectedvirtual |
|
protectedvirtual |
|
inherited |
Returns true if i has evidence.
Definition at line 182 of file PRMInference_tpl.h.
|
inherited |
Returns EMap of evidences over i.
Definition at line 187 of file PRMInference_tpl.h.
|
inherited |
Returns true if i has evidence on PRMAttribute<GUM_SCALAR> a.
Definition at line 192 of file PRMInference_tpl.h.
|
inherited |
Returns true if i has evidence on PRMAttribute<GUM_SCALAR> a.
Definition at line 197 of file PRMInference_tpl.h.
|
inherited |
Compute the joint probability of the formals attributes pointed by chains and stores it in m.
chains | A Set of strings of the form instance.attribute. |
j | An empty CPF which will be filed by the joint probability over chains. |
NotFound | Raised if some chain in chains does not point to a formal attribute. |
OperationNotAllowed | Raise if m is not empty. |
Definition at line 241 of file PRMInference_tpl.h.
|
protectedvirtual |
See PRMInference<GUM_SCALAR>::joint_().
Implements gum::prm::PRMInference< GUM_SCALAR >.
Definition at line 596 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
virtual |
Returns the name of the current inference algorithm.
Implements gum::prm::PRMInference< GUM_SCALAR >.
|
inherited |
Compute the posterior of the formal attribute pointed by chain and stores it in m.
chain | A string of the form instance.attribute. |
m | An empty CPF which will be filed by the posterior of chain. |
NotFound | Raised if chain is invalid. |
TypeError | Raised if chain does not point to an PRMAttribute<GUM_SCALAR>. |
OperationNotAllowed | Raise if m is not empty. |
Definition at line 215 of file PRMInference_tpl.h.
|
protectedvirtual |
See PRMInference<GUM_SCALAR>::posterior_().
Implements gum::prm::PRMInference< GUM_SCALAR >.
Definition at line 564 of file SVE_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
inherited |
Remove evidence on the given instance's elt.
chain | The variable being observed. |
NotFound | Raised if the given names are not found. |
TypeError | Raised if the elt is not an PRMAttribute<GUM_SCALAR>. |
Definition at line 202 of file PRMInference_tpl.h.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protectedinherited |
The PRM<GUM_SCALAR> on which inference is done.
Definition at line 207 of file PRMInference.h.
|
protectedinherited |
The Model on which inference is done.
Definition at line 210 of file PRMInference.h.