aGrUM  0.16.0
loopyBeliefPropagation.h
Go to the documentation of this file.
1 
28 #ifndef GUM_LOOPYBELIEFPROPAGATION_H
29 #define GUM_LOOPYBELIEFPROPAGATION_H
30 
32 
33 namespace gum {
41  template < typename GUM_SCALAR >
42  class LoopyBeliefPropagation : public ApproximateInference< GUM_SCALAR > {
43  public:
48 
52  virtual ~LoopyBeliefPropagation();
53 
54  protected:
55  virtual void _onStateChanged(){};
56 
57  virtual void _onEvidenceAdded(const NodeId id, bool isHardEvidence){};
58 
59  virtual void _onEvidenceErased(const NodeId id, bool isHardEvidence){};
60 
61  virtual void _onAllEvidenceErased(bool contains_hard_evidence){};
62 
63  virtual void _onEvidenceChanged(const NodeId id, bool hasChangedSoftHard){};
64 
65  virtual void _onBayesNetChanged(const IBayesNet< GUM_SCALAR >* bn){};
66 
67  virtual void _updateOutdatedBNStructure();
68 
69  virtual void _updateOutdatedBNPotentials(){};
70 
71  virtual void _onMarginalTargetAdded(const NodeId id){};
72 
73  virtual void _onMarginalTargetErased(const NodeId id){};
74 
75  virtual void _onAllMarginalTargetsAdded(){};
76 
77  virtual void _onAllMarginalTargetsErased(){};
78 
80 
81  virtual const Potential< GUM_SCALAR >& _posterior(NodeId id);
82 
83  virtual void _makeInference();
84 
85  // will be used in both directions :
86  // for x->y, (x,y) and (y,x) will be in __messages
89 
90  void __initStats();
91 
92  void __init_messages();
97 
98  // return the max differential BNdistance for this node
99  GUM_SCALAR __updateNodeMessage(NodeId X);
100  };
101 
102 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
103 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
104  // extern template class LoopyBeliefPropagation<float>;
105 # endif
106 #endif
107 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
108 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
109  // extern template class LoopyBeliefPropagation<double>;
110 # endif
111 #endif
112 } /* namespace gum */
113 
115 
116 
117 #endif // GUM_LOOPYBELIEFPROPAGATION_H
aGrUM&#39;s Potential is a multi-dimensional array with tensor operators.
Definition: potential.h:60
virtual void _onBayesNetChanged(const IBayesNet< GUM_SCALAR > *bn)
fired after a new Bayes net has been assigned to the engine
virtual void _onStateChanged()
fired when the stage is changed
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void _onAllEvidenceErased(bool contains_hard_evidence)
fired before all the evidence are erased
virtual void _onEvidenceAdded(const NodeId id, bool isHardEvidence)
fired after a new evidence is inserted
virtual void _onMarginalTargetErased(const NodeId id)
fired before a marginal target is removed
Class representing the minimal interface for Bayesian Network.
Definition: IBayesNet.h:62
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Potential< GUM_SCALAR > __computeProdLambda(NodeId X)
The class for generic Hash Tables.
Definition: hashTable.h:679
virtual ~LoopyBeliefPropagation()
Destructor.
virtual void _onMarginalTargetAdded(const NodeId id)
fired after a new marginal target is inserted
virtual void _onEvidenceChanged(const NodeId id, bool hasChangedSoftHard)
fired after an evidence is changed, in particular when its status (soft/hard) changes ...
GUM_SCALAR __updateNodeMessage(NodeId X)
<agrum/BN/inference/loopyBeliefPropagation.h>
LoopyBeliefPropagation(const IBayesNet< GUM_SCALAR > *bn)
Default constructor.
virtual void _onAllMarginalTargetsAdded()
fired after all the nodes of the BN are added as marginal targets
ArcProperty< Potential< GUM_SCALAR > > __messages
virtual const Potential< GUM_SCALAR > & _posterior(NodeId id)
asks derived classes for the posterior of a given variable
virtual void _onEvidenceErased(const NodeId id, bool isHardEvidence)
fired before an evidence is removed
virtual void _onAllMarginalTargetsErased()
fired before a all marginal targets are removed
NodeProperty< Potential< GUM_SCALAR > > __posteriors
virtual void _makeInference()
called when the inference has to be performed effectively
Potential< GUM_SCALAR > __computeProdPi(NodeId X)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Size NodeId
Type for node ids.
Definition: graphElements.h:98
virtual void _updateOutdatedBNStructure()
prepares inference when the latter is in OutdatedBNStructure state
virtual void _updateOutdatedBNPotentials()
prepares inference when the latter is in OutdatedBNPotentials state