29 #ifndef GUM_PRM_INFERENCE_H 30 #define GUM_PRM_INFERENCE_H 34 #include <agrum/tools/core/hashTable.h> 35 #include <agrum/tools/multidim/potential.h> 37 #include <agrum/PRM/PRM.h> 50 template <
typename GUM_SCALAR >
77 const PRMSystem< GUM_SCALAR >& system);
95 virtual std::string
name()
const = 0;
115 void posterior(
const Chain& chain, Potential< GUM_SCALAR >& m);
128 void joint(
const std::vector< Chain >& chains, Potential< GUM_SCALAR >& j);
146 const EMap&
evidence(
const PRMInstance< GUM_SCALAR >& i)
const;
150 const EMap&
evidence(
const PRMInstance< GUM_SCALAR >* i)
const;
153 bool hasEvidence(
const PRMInstance< GUM_SCALAR >& i)
const;
156 bool hasEvidence(
const PRMInstance< GUM_SCALAR >* i)
const;
170 void addEvidence(
const Chain& chain,
const Potential< GUM_SCALAR >& p);
201 virtual void posterior_(
const Chain& chain, Potential< GUM_SCALAR >& m) = 0;
208 virtual void joint_(
const std::vector< Chain >& queries,
209 Potential< GUM_SCALAR >& j)
238 EMap&
EMap__(
const PRMInstance< GUM_SCALAR >* i);
244 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 252 #include <agrum/PRM/inference/PRMInference_tpl.h> PRMInference(const PRMInference &source)
Copy constructor.
void posterior(const Chain &chain, Potential< GUM_SCALAR > &m)
Compute the posterior of the formal attribute pointed by chain and stores it in m.
bool hasEvidence(const Chain &chain) const
Returns true if i has evidence on PRMAttribute<GUM_SCALAR> a.
EMap & evidence(const PRMInstance< GUM_SCALAR > &i)
Returns EMap of evidences over i.
INLINE void emplace(Args &&... args)
HashTable< const PRMInstance< GUM_SCALAR > *, EMap *> evidences__
Mapping of evidence over PRMInstance<GUM_SCALAR>'s nodes.
virtual void evidenceAdded_(const Chain &chain)=0
This method is called whenever an evidence is added, but AFTER any processing made by PRMInference...
PRMInference(const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system)
Default constructor.
const EMap & evidence(const PRMInstance< GUM_SCALAR > &i) const
Returns EMap of evidences over i.
EMap & evidence(const PRMInstance< GUM_SCALAR > *i)
Returns EMap of evidences over i.
virtual void joint_(const std::vector< Chain > &queries, Potential< GUM_SCALAR > &j)=0
Generic method to compute the posterior of given element.
virtual void evidenceRemoved_(const Chain &chain)=0
This method is called whenever an evidence is removed, but BEFORE any processing made by PRMInference...
bool hasEvidence(const PRMInstance< GUM_SCALAR > *i) const
Returns EMap of evidences over i.
void clearEvidence()
Remove all evidences.
virtual void posterior_(const Chain &chain, Potential< GUM_SCALAR > &m)=0
Generic method to compute the posterior of given element.
const EMap & evidence(const PRMInstance< GUM_SCALAR > *i) const
Returns EMap of evidences over i.
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
bool hasEvidence() const
Returns true if i has evidence on PRMAttribute<GUM_SCALAR> a.
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, Potential< GUM_SCALAR > &j)
Compute the joint probability of the formals attributes pointed by chains and stores it in m...
void addEvidence(const Chain &chain, const Potential< GUM_SCALAR > &p)
Add an evidence to the given instance's elt.
virtual std::string name() const =0
Returns the name of the current inference algorithm.
NodeProperty< const Potential< GUM_SCALAR > *> EMap
Code alias.
void removeEvidence(const Chain &chain)
Remove evidence on the given instance's elt.
virtual ~PRMInference()
Destructor.
PRMInference & operator=(const PRMInference &source)
Copy operator.