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 >
73 PRMInference(
const PRM< GUM_SCALAR >& prm,
const PRMSystem< GUM_SCALAR >& system);
91 virtual std::string
name()
const = 0;
111 void posterior(
const Chain& chain, Potential< GUM_SCALAR >& m);
124 void joint(
const std::vector< Chain >& chains, Potential< GUM_SCALAR >& j);
142 const EMap&
evidence(
const PRMInstance< GUM_SCALAR >& i)
const;
146 const EMap&
evidence(
const PRMInstance< GUM_SCALAR >* i)
const;
149 bool hasEvidence(
const PRMInstance< GUM_SCALAR >& i)
const;
152 bool hasEvidence(
const PRMInstance< GUM_SCALAR >* i)
const;
166 void addEvidence(
const Chain& chain,
const Potential< GUM_SCALAR >& p);
197 virtual void posterior_(
const Chain& chain, Potential< GUM_SCALAR >& m) = 0;
204 virtual void joint_(
const std::vector< Chain >& queries, Potential< GUM_SCALAR >& j) = 0;
231 EMap&
_EMap_(
const PRMInstance< GUM_SCALAR >* i);
237 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 245 #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 & _EMap_(const PRMInstance< GUM_SCALAR > *i)
Private getter over evidences, if necessary creates an EMap for i.
EMap & evidence(const PRMInstance< GUM_SCALAR > &i)
Returns EMap of evidences over i.
INLINE void emplace(Args &&... args)
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.
HashTable< const PRMInstance< GUM_SCALAR > *, EMap *> _evidences_
Mapping of evidence over PRMInstance<GUM_SCALAR>'s nodes.
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.
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.