49#ifndef GUM_PRM_INFERENCE_H
50#define GUM_PRM_INFERENCE_H
67 template <
typename GUM_SCALAR >
108 virtual std::string
name()
const = 0;
141 void joint(
const std::vector< Chain >& chains, Tensor< GUM_SCALAR >& j);
215 virtual void posterior_(
const Chain& chain, Tensor< GUM_SCALAR >& m) = 0;
222 virtual void joint_(
const std::vector< Chain >& queries, Tensor< GUM_SCALAR >& j) = 0;
255#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Inline implementation of PRMInference.
The class for generic Hash Tables.
PRMAttribute is a member of a Class in a PRM.
std::pair< const PRMInstance< GUM_SCALAR > *, const PRMAttribute< GUM_SCALAR > * > Chain
Code alias.
void addEvidence(const Chain &chain, const Tensor< GUM_SCALAR > &p)
Add an evidence to the given instance's elt.
virtual ~PRMInference()
Destructor.
virtual std::string name() const =0
Returns the name of the current inference algorithm.
EMap & evidence(const PRMInstance< GUM_SCALAR > &i)
Returns EMap of evidences over i.
virtual void joint_(const std::vector< Chain > &queries, Tensor< GUM_SCALAR > &j)=0
Generic method to compute the posterior of given element.
void posterior(const Chain &chain, Tensor< GUM_SCALAR > &m)
Compute the posterior of the formal attribute pointed by chain and stores it in m.
HashTable< const PRMInstance< GUM_SCALAR > *, EMap * > _evidences_
Mapping of evidence over PRMInstance<GUM_SCALAR>'s nodes.
typename NodeProperty< const Tensor< GUM_SCALAR > * >::iterator_safe EMapIterator
Code alias.
PRMInference(const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system)
Default constructor.
EMap & _EMap_(const PRMInstance< GUM_SCALAR > *i)
Private getter over evidences, if necessary creates an EMap for i.
void joint(const std::vector< Chain > &chains, Tensor< GUM_SCALAR > &j)
Compute the joint probability of the formals attributes pointed by chains and stores it in m.
void removeEvidence(const Chain &chain)
Remove evidence on the given instance's elt.
PRMSystem< GUM_SCALAR > const * sys_
The Model on which inference is done.
PRMInference & operator=(const PRMInference &source)
Copy operator.
NodeProperty< const Tensor< GUM_SCALAR > * > EMap
Code alias.
typename NodeProperty< const Tensor< GUM_SCALAR > * >::const_iterator_safe EMapConstIterator
Code alias.
PRM< GUM_SCALAR > const * prm_
The PRM<GUM_SCALAR> on which inference is done.
virtual void evidenceAdded_(const Chain &chain)=0
This method is called whenever an evidence is added, but AFTER any processing made by PRMInference.
virtual void posterior_(const Chain &chain, Tensor< GUM_SCALAR > &m)=0
Generic method to compute the posterior of given element.
bool hasEvidence() const
Returns true if i has evidence on PRMAttribute<GUM_SCALAR> a.
virtual void evidenceRemoved_(const Chain &chain)=0
This method is called whenever an evidence is removed, but BEFORE any processing made by PRMInference...
typename HashTable< const PRMInstance< GUM_SCALAR > *, EMap * >::const_iterator_safe EvidenceConstIterator
Code alias.
void clearEvidence()
Remove all evidences.
typename HashTable< const PRMInstance< GUM_SCALAR > *, EMap * >::iterator_safe EvidenceIterator
Code alias.
An PRMInstance is a Bayesian network fragment defined by a Class and used in a PRMSystem.
A PRMSystem is a container of PRMInstance and describe a relational skeleton.
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
namespace for all probabilistic relational models entities
gum is the global namespace for all aGrUM entities