aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::ShaferShenoyLIMIDInference< GUM_SCALAR > Class Template Reference

#include <ShaferShenoyLIMIDInference.h>

+ Inheritance diagram for gum::ShaferShenoyLIMIDInference< GUM_SCALAR >:
+ Collaboration diagram for gum::ShaferShenoyLIMIDInference< GUM_SCALAR >:

Public Member Functions

DAG reducedGraph () const
 
std::vector< NodeSetreversePartialOrder () const
 
InfluenceDiagram< GUM_SCALAR > reducedLIMID () const
 
bool isSolvable () const
 
gum::Potential< GUM_SCALAR > optimalDecision (NodeId decisionId) final
 
gum::Potential< GUM_SCALAR > optimalDecision (const std::string &decisionName) final
 
virtual const Potential< GUM_SCALAR > & posterior (NodeId node) final
 Return the posterior probability of a node. More...
 
const Potential< GUM_SCALAR > & posterior (const std::string &name) final
 
virtual const Potential< GUM_SCALAR > & posteriorUtility (NodeId node) final
 Return the posterior utility of a node. More...
 
virtual const Potential< GUM_SCALAR > & posteriorUtility (const std::string &name) final
 
virtual std::pair< GUM_SCALAR, GUM_SCALAR > meanVar (NodeId node) final
 Return the pair (mean,variance) for a node. More...
 
std::pair< GUM_SCALAR, GUM_SCALAR > meanVar (const std::string &name) final
 
std::pair< GUM_SCALAR, GUM_SCALAR > MEU () final
 Return the pair (mean,variance) for the total utility (MEU) More...
 
virtual void setInfluenceDiagram (const InfluenceDiagram< GUM_SCALAR > *infdiag)
 assigns a new influence diagram to the inference engine More...
 
virtual const InfluenceDiagram< GUM_SCALAR > & influenceDiagram () const final
 Returns a constant reference over the IBayesNet referenced by this class. More...
 
Constructor & destructor
 ShaferShenoyLIMIDInference (const InfluenceDiagram< GUM_SCALAR > *infDiag)
 Default constructor. More...
 
virtual ~ShaferShenoyLIMIDInference ()
 Destructor. More...
 
const JunctionTreejunctionTree () const
 Default constructor. More...
 
void clear () override
 Default constructor. More...
 
void addNoForgettingAssumption (const std::vector< NodeId > &ids)
 No forgetting rule assumption. More...
 
void addNoForgettingAssumption (const std::vector< std::string > &names)
 Default constructor. More...
 
bool hasNoForgettingAssumption () const
 Default constructor. More...
 
Accessors / Modifiers
virtual const GraphicalModelmodel () const final
 Returns a constant reference over the IBayesNet referenced by this class. More...
 
virtual const NodeProperty< Size > & domainSizes () const final
 get the domain sizes of the random variables of the model More...
 
virtual bool isInferenceReady () const noexcept final
 returns whether the inference object is in a ready state More...
 
virtual bool isInferenceOutdatedStructure () const noexcept final
 returns whether the inference object is in a OutdatedStructure state More...
 
virtual bool isInferenceOutdatedPotentials () const noexcept final
 returns whether the inference object is in a OutdatedPotential state More...
 
virtual bool isInferenceDone () const noexcept final
 returns whether the inference object is in a InferenceDone state More...
 
virtual void prepareInference () final
 prepare the internal inference structures for the next inference More...
 
virtual void makeInference () final
 perform the heavy computations needed to compute the targets' posteriors More...
 
virtual StateOfInference state () const noexcept final
 returns the state of the inference engine More...
 
Evidence
virtual void addEvidence (NodeId id, const Idx val) final
 adds a new hard evidence on node id More...
 
virtual void addEvidence (const std::string &nodeName, const Idx val) final
 adds a new hard evidence on node named nodeName More...
 
virtual void addEvidence (NodeId id, const std::string &label) final
 adds a new hard evidence on node id More...
 
virtual void addEvidence (const std::string &nodeName, const std::string &label) final
 adds a new hard evidence on node named nodeName More...
 
virtual void addEvidence (NodeId id, const std::vector< GUM_SCALAR > &vals) final
 adds a new evidence on node id (might be soft or hard) More...
 
virtual void addEvidence (const std::string &nodeName, const std::vector< GUM_SCALAR > &vals) final
 adds a new evidence on node named nodeName (might be soft or hard) More...
 
virtual void addEvidence (const Potential< GUM_SCALAR > &pot) final
 adds a new evidence on node id (might be soft or hard) More...
 
virtual void addEvidence (Potential< GUM_SCALAR > &&pot) final
 adds a new evidence on node id (might be soft or hard) More...
 
virtual void addSetOfEvidence (const Set< const Potential< GUM_SCALAR > * > &potset) final
 adds a new set of evidence More...
 
virtual void addListOfEvidence (const List< const Potential< GUM_SCALAR > * > &potlist) final
 adds a new list of evidence More...
 
virtual void chgEvidence (NodeId id, const Idx val) final
 change the value of an already existing hard evidence More...
 
virtual void chgEvidence (const std::string &nodeName, const Idx val) final
 change the value of an already existing hard evidence More...
 
virtual void chgEvidence (NodeId id, const std::string &label) final
 change the value of an already existing hard evidence More...
 
virtual void chgEvidence (const std::string &nodeName, const std::string &label) final
 change the value of an already existing hard evidence More...
 
virtual void chgEvidence (NodeId id, const std::vector< GUM_SCALAR > &vals) final
 change the value of an already existing evidence (might be soft or hard) More...
 
virtual void chgEvidence (const std::string &nodeName, const std::vector< GUM_SCALAR > &vals) final
 change the value of an already existing evidence (might be soft or hard) More...
 
virtual void chgEvidence (const Potential< GUM_SCALAR > &pot) final
 change the value of an already existing evidence (might be soft or hard) More...
 
virtual void eraseAllEvidence () final
 removes all the evidence entered into the network More...
 
virtual void eraseEvidence (NodeId id) final
 removed the evidence, if any, corresponding to node id More...
 
virtual void eraseEvidence (const std::string &nodeName) final
 removed the evidence, if any, corresponding to node of name nodeName More...
 
virtual bool hasEvidence () const final
 indicates whether some node(s) have received evidence More...
 
virtual bool hasEvidence (NodeId id) const final
 indicates whether node id has received an evidence More...
 
virtual bool hasEvidence (const std::string &nodeName) const final
 indicates whether node id has received an evidence More...
 
virtual bool hasHardEvidence (NodeId id) const final
 indicates whether node id has received a hard evidence More...
 
virtual bool hasHardEvidence (const std::string &nodeName) const final
 indicates whether node id has received a hard evidence More...
 
virtual bool hasSoftEvidence (NodeId id) const final
 indicates whether node id has received a soft evidence More...
 
virtual bool hasSoftEvidence (const std::string &nodeName) const final
 indicates whether node id has received a soft evidence More...
 
virtual Size nbrEvidence () const final
 returns the number of evidence entered into the Bayesian network More...
 
virtual Size nbrHardEvidence () const final
 returns the number of hard evidence entered into the Bayesian network More...
 
virtual Size nbrSoftEvidence () const final
 returns the number of soft evidence entered into the Bayesian network More...
 
const NodeProperty< const Potential< GUM_SCALAR > *> & evidence () const
 returns the set of evidence More...
 
const NodeSetsoftEvidenceNodes () const
 returns the set of nodes with soft evidence More...
 
const NodeSethardEvidenceNodes () const
 returns the set of nodes with hard evidence More...
 
const NodeProperty< Idx > & hardEvidence () const
 indicate for each node with hard evidence which value it took More...
 

Public Types

enum  StateOfInference { StateOfInference::OutdatedStructure, StateOfInference::OutdatedPotentials, StateOfInference::ReadyForInference, StateOfInference::Done }
 current state of the inference More...
 

Protected Attributes

DAG reduced_
 
CliqueGraph reducedJunctionTree_
 
NodeProperty< NodeIdnode_to_clique_
 
EdgeProperty< SetOfVarsvarsSeparator_
 
NodeProperty< Potential< GUM_SCALAR > > strategies_
 
NodeProperty< DecisionPotential< GUM_SCALAR > > posteriors_
 
NodeProperty< DecisionPotential< GUM_SCALAR > > unconditionalDecisions_
 
std::vector< NodeSetreversePartialOrder_
 
std::vector< NodeIdsolvabilityOrder_
 
std::vector< NodeIdnoForgettingOrder_
 

Protected Member Functions

void onStateChanged_ () override
 fired when the stage is changed More...
 
void onEvidenceAdded_ (NodeId id, bool isHardEvidence) override
 fired after a new evidence is inserted More...
 
void onEvidenceErased_ (NodeId id, bool isHardEvidence) override
 fired before an evidence is removed More...
 
void onAllEvidenceErased_ (bool contains_hard_evidence) override
 fired before all the evidence are erased More...
 
void onEvidenceChanged_ (NodeId id, bool hasChangedSoftHard) override
 fired after an evidence is changed, in particular when its status (soft/hard) changes More...
 
void onModelChanged_ (const GraphicalModel *model) override
 fired after a new Bayes net has been assigned to the engine More...
 
void updateOutdatedStructure_ () override
 prepares inference when the latter is in OutdatedStructure state More...
 
void updateOutdatedPotentials_ () override
 prepares inference when the latter is in OutdatedPotentials state More...
 
void makeInference_ () override
 called when the inference has to be performed effectively More...
 
NodeSet nonRequisiteNodes_ (NodeId d) const
 Returns the set of non-requisite for node d. More...
 
void createReduced_ ()
 
void setOutdatedStructureState_ ()
 put the inference into an outdated model structure state More...
 
void setOutdatedPotentialsState_ ()
 puts the inference into an OutdatedPotentials state if it is not already in an OutdatedStructure state More...
 
virtual void setState_ (const StateOfInference state) final
 set the state of the inference engine and call the notification onStateChanged_ when necessary (i.e. when the state has effectively changed). More...
 
void setModel_ (const GraphicalModel *model)
 
void setModelDuringConstruction_ (const GraphicalModel *model)
 assigns a model during the inference engine construction More...
 
bool hasNoModel_ () const
 

Detailed Description

template<typename GUM_SCALAR>
class gum::ShaferShenoyLIMIDInference< GUM_SCALAR >

Definition at line 65 of file ShaferShenoyLIMIDInference.h.

Member Typedef Documentation

◆ PhiNodeProperty

template<typename GUM_SCALAR >
using gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::PhiNodeProperty = NodeProperty< DecisionPotential< GUM_SCALAR > >
private

Definition at line 66 of file ShaferShenoyLIMIDInference.h.

◆ PsiArcProperty

template<typename GUM_SCALAR >
using gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::PsiArcProperty = ArcProperty< DecisionPotential< GUM_SCALAR > >
private

Definition at line 67 of file ShaferShenoyLIMIDInference.h.

◆ SetOfVars

template<typename GUM_SCALAR >
using gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::SetOfVars = Set< const DiscreteVariable* >
private

Definition at line 68 of file ShaferShenoyLIMIDInference.h.

Member Enumeration Documentation

◆ StateOfInference

template<typename GUM_SCALAR >
enum gum::GraphicalModelInference::StateOfInference
stronginherited

current state of the inference

graphicalModelInference can be in one of 4 different states:

  • OutdatedStructure: in this state, the inference is fully unprepared to be applied because some events changed the "logical" structure of the model: for instance a node received a hard evidence, which implies that its outgoing arcs can be removed from the model, hence involving a structural change in the model.
  • OutdatedPotentials: in this state, the structure of the model remains unchanged, only some potentials stored in it have changed. Therefore, the inference probably just needs to invalidate some already computed potentials to be ready. Only a light amount of preparation is needed to be able to perform inference.
  • Ready4Inference: in this state, all the data structures are ready for inference. There just remains to perform the inference computations.
  • Done: the heavy computations of inference have been done. There might still remain a few light computations to perform to get the posterior potentials we need.
Enumerator
OutdatedStructure 
OutdatedPotentials 
ReadyForInference 
Done 

Definition at line 106 of file graphicalModelInference.h.

107  {
108  OutdatedStructure,
109  OutdatedPotentials,
110  ReadyForInference,
111  Done
112  };

Constructor & Destructor Documentation

◆ ShaferShenoyLIMIDInference()

template<typename GUM_SCALAR >
gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::ShaferShenoyLIMIDInference ( const InfluenceDiagram< GUM_SCALAR > *  infDiag)
explicit

Default constructor.

Parameters
infDiagthe influence diagram we want to perform inference upon

◆ ~ShaferShenoyLIMIDInference()

template<typename GUM_SCALAR >
virtual gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::~ShaferShenoyLIMIDInference ( )
virtual

Destructor.

Member Function Documentation

◆ _checkingSolvability_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::_checkingSolvability_ ( const NodeSet utilities)
private

◆ _completingNoForgettingAssumption_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::_completingNoForgettingAssumption_ ( )
private

◆ _creatingJunctionTree_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::_creatingJunctionTree_ ( )
private

◆ _creatingPartialOrder_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::_creatingPartialOrder_ ( const NodeSet utilities)
private

◆ _findingCliqueForEachNode_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::_findingCliqueForEachNode_ ( DefaultTriangulation triangulation)
private

◆ _reducingLIMID_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::_reducingLIMID_ ( )
private

◆ addEvidence() [1/8]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::addEvidence ( NodeId  id,
const Idx  val 
)
finalvirtualinherited

adds a new hard evidence on node id

Exceptions
UndefinedElementif id does not belong to the Bayesian network
InvalidArgumentif val is not a value for id
InvalidArgumentif id already has an evidence

Definition at line 228 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

228  {
230  }
virtual void addEvidence(NodeId id, const Idx val) final
adds a new hard evidence on node id
Potential< GUM_SCALAR > _createHardEvidence_(NodeId id, Idx val) const
create the internal structure for a hard evidence
+ Here is the call graph for this function:

◆ addEvidence() [2/8]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::addEvidence ( const std::string &  nodeName,
const Idx  val 
)
finalvirtualinherited

adds a new hard evidence on node named nodeName

Exceptions
UndefinedElementif nodeName does not belong to the Bayesian network
InvalidArgumentif val is not a value for id
InvalidArgumentif nodeName already has an evidence

Definition at line 234 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

235  {
236  addEvidence(this->model().idFromName(nodeName), val);
237  }
virtual void addEvidence(NodeId id, const Idx val) final
adds a new hard evidence on node id
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
+ Here is the call graph for this function:

◆ addEvidence() [3/8]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::addEvidence ( NodeId  id,
const std::string &  label 
)
finalvirtualinherited

adds a new hard evidence on node id

Exceptions
UndefinedElementif id does not belong to the Bayesian network
InvalidArgumentif val is not a value for id
InvalidArgumentif id already has an evidence

Definition at line 241 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

242  {
243  addEvidence(id, this->model().variable(id)[label]);
244  }
virtual void addEvidence(NodeId id, const Idx val) final
adds a new hard evidence on node id
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
+ Here is the call graph for this function:

◆ addEvidence() [4/8]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::addEvidence ( const std::string &  nodeName,
const std::string &  label 
)
finalvirtualinherited

adds a new hard evidence on node named nodeName

Exceptions
UndefinedElementif nodeName does not belong to the Bayesian network
InvalidArgumentif val is not a value for id
InvalidArgumentif nodeName already has an evidence

Definition at line 248 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

249  {
250  NodeId id = this->model().idFromName(nodeName);
251  addEvidence(id, this->model().variable(id)[label]);
252  }
virtual void addEvidence(NodeId id, const Idx val) final
adds a new hard evidence on node id
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
virtual NodeId idFromName(const std::string &name) const =0
Getter by name.
Size NodeId
Type for node ids.
Definition: graphElements.h:97
+ Here is the call graph for this function:

◆ addEvidence() [5/8]

template<typename GUM_SCALAR >
void gum::GraphicalModelInference< GUM_SCALAR >::addEvidence ( NodeId  id,
const std::vector< GUM_SCALAR > &  vals 
)
finalvirtualinherited

adds a new evidence on node id (might be soft or hard)

Exceptions
UndefinedElementif id does not belong to the Bayesian network
InvalidArgumentif id already has an evidence
FatalErrorif vals=[0,0,...,0]
InvalidArgumentif the size of vals is different from the domain size of node id

Definition at line 256 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

257  {
258  // checks that the evidence is meaningful
259  if (_model_ == nullptr)
260  GUM_ERROR(NullElement,
261  "No Bayes net has been assigned to the "
262  "inference algorithm");
263 
264  if (!_model_->exists(id)) { GUM_ERROR(UndefinedElement, id << " is not a NodeId in the model") }
265 
266  if (_model_->variable(id).domainSize() != vals.size()) {
267  GUM_ERROR(InvalidArgument,
268  "node " << _model_->variable(id)
269  << " and its evidence vector have different sizes.");
270  }
271 
272  Potential< GUM_SCALAR > pot;
273  pot.add(_model_->variable(id));
274  pot.fillWith(vals);
275  addEvidence(std::move(pot));
276  }
virtual void addEvidence(NodeId id, const Idx val) final
adds a new hard evidence on node id
virtual Size domainSize() const =0
virtual bool exists(NodeId node) const =0
Return true if this node exists in this graphical model.
const GraphicalModel * _model_
the Bayes net on which we perform inferences
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variable given it&#39;s node id.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ addEvidence() [6/8]

template<typename GUM_SCALAR >
void gum::GraphicalModelInference< GUM_SCALAR >::addEvidence ( const std::string &  nodeName,
const std::vector< GUM_SCALAR > &  vals 
)
finalvirtualinherited

adds a new evidence on node named nodeName (might be soft or hard)

Exceptions
UndefinedElementif id does not belong to the Bayesian network
InvalidArgumentif nodeName already has an evidence
FatalErrorif vals=[0,0,...,0]
InvalidArgumentif the size of vals is different from the domain size of node nodeName

Definition at line 280 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

281  {
282  addEvidence(this->model().idFromName(nodeName), vals);
283  }
virtual void addEvidence(NodeId id, const Idx val) final
adds a new hard evidence on node id
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
+ Here is the call graph for this function:

◆ addEvidence() [7/8]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::addEvidence ( const Potential< GUM_SCALAR > &  pot)
finalvirtualinherited

adds a new evidence on node id (might be soft or hard)

Exceptions
UndefinedElementif the potential is defined over several nodes
UndefinedElementif the node on which the potential is defined does not belong to the Bayesian network
InvalidArgumentif the node of the potential already has an evidence
FatalErrorif pot=[0,0,...,0]

Definition at line 325 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

325  {
326  Potential< GUM_SCALAR > new_pot(pot);
327  addEvidence(std::move(new_pot));
328  }
virtual void addEvidence(NodeId id, const Idx val) final
adds a new hard evidence on node id
+ Here is the call graph for this function:

◆ addEvidence() [8/8]

template<typename GUM_SCALAR >
void gum::GraphicalModelInference< GUM_SCALAR >::addEvidence ( Potential< GUM_SCALAR > &&  pot)
finalvirtualinherited

adds a new evidence on node id (might be soft or hard)

Exceptions
UndefinedElementif the potential is defined over several nodes
UndefinedElementif the node on which the potential is defined does not belong to the Bayesian network
InvalidArgumentif the node of the potential already has an evidence
FatalErrorif pot=[0,0,...,0]

Definition at line 287 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

287  {
288  // check if the potential corresponds to an evidence
289  if (pot.nbrDim() != 1) { GUM_ERROR(InvalidArgument, pot << " is not mono-dimensional.") }
290  if (_model_ == nullptr)
291  GUM_ERROR(NullElement,
292  "No Bayes net has been assigned to the "
293  "inference algorithm");
294 
295  NodeId id = _model_->nodeId(pot.variable(0));
296 
297  if (hasEvidence(id)) {
298  GUM_ERROR(InvalidArgument,
299  " node " << id << " already has an evidence. Please use chgEvidence().");
300  }
301 
302  // check whether we have a hard evidence (and also check whether the
303  // potential only contains 0 (in this case, this will automatically raise
304  // an exception) )
305  Idx val;
306  bool is_hard_evidence = _isHardEvidence_(pot, val);
307 
308  // insert the evidence
309  _evidence_.insert(id,
310  new Potential< GUM_SCALAR >(std::forward< Potential< GUM_SCALAR > >(pot)));
311  if (is_hard_evidence) { // pot is deterministic
312  _hard_evidence_.insert(id, val);
314  } else {
316  }
318  onEvidenceAdded_(id, is_hard_evidence);
319  }
virtual void setState_(const StateOfInference state) final
set the state of the inference engine and call the notification onStateChanged_ when necessary (i...
virtual void onEvidenceAdded_(const NodeId id, bool isHardEvidence)=0
fired after a new evidence is inserted
NodeProperty< const Potential< GUM_SCALAR > *> _evidence_
the set of evidence entered into the network
NodeProperty< Idx > _hard_evidence_
assign to each node with a hard evidence the index of its observed value
bool _isHardEvidence_(const Potential< GUM_SCALAR > &pot, Idx &val) const
checks whether a potential corresponds to a hard evidence or not
virtual bool hasEvidence() const final
indicates whether some node(s) have received evidence
virtual NodeId nodeId(const DiscreteVariable &var) const =0
Return id node src discrete var pointer.
NodeSet _hard_evidence_nodes_
the set of nodes that received hard evidence
NodeSet _soft_evidence_nodes_
the set of nodes that received soft evidence
const GraphicalModel * _model_
the Bayes net on which we perform inferences
Size NodeId
Type for node ids.
Definition: graphElements.h:97
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:606
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ addListOfEvidence()

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::addListOfEvidence ( const List< const Potential< GUM_SCALAR > * > &  potlist)
finalvirtualinherited

adds a new list of evidence

Exceptions
UndefinedElementif some potential is defined over several nodes
UndefinedElementif the node on which some potential is defined does not belong to the Bayesian network
InvalidArgumentif the node of some potential already has an evidence
FatalErrorif pot=[0,0,...,0]

Definition at line 333 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

334  {
335  for (const auto pot: potlist)
336  addEvidence(*pot);
337  }
virtual void addEvidence(NodeId id, const Idx val) final
adds a new hard evidence on node id
+ Here is the call graph for this function:

◆ addNoForgettingAssumption() [1/2]

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::addNoForgettingAssumption ( const std::vector< NodeId > &  ids)

No forgetting rule assumption.

◆ addNoForgettingAssumption() [2/2]

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::addNoForgettingAssumption ( const std::vector< std::string > &  names)

Default constructor.

Parameters
infDiagthe influence diagram we want to perform inference upon

◆ addSetOfEvidence()

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::addSetOfEvidence ( const Set< const Potential< GUM_SCALAR > * > &  potset)
finalvirtualinherited

adds a new set of evidence

Exceptions
UndefinedElementif some potential is defined over several nodes
UndefinedElementif the node on which some potential is defined does not belong to the Bayesian network
InvalidArgumentif the node of some potential already has an evidence
FatalErrorif pot=[0,0,...,0]

Definition at line 342 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

343  {
344  for (const auto pot: potset)
345  addEvidence(*pot);
346  }
virtual void addEvidence(NodeId id, const Idx val) final
adds a new hard evidence on node id
+ Here is the call graph for this function:

◆ binarizingMax_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::binarizingMax_ ( const Potential< GUM_SCALAR > &  decision,
const Potential< GUM_SCALAR > &  proba 
) const
private

◆ chgEvidence() [1/7]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::chgEvidence ( NodeId  id,
const Idx  val 
)
finalvirtualinherited

change the value of an already existing hard evidence

Exceptions
UndefinedElementif id does not belong to the Bayesian network
InvalidArgumentif val is not a value for id
InvalidArgumentif id does not already have an evidence

Definition at line 402 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

402  {
404  }
Potential< GUM_SCALAR > _createHardEvidence_(NodeId id, Idx val) const
create the internal structure for a hard evidence
virtual void chgEvidence(NodeId id, const Idx val) final
change the value of an already existing hard evidence
+ Here is the call graph for this function:

◆ chgEvidence() [2/7]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::chgEvidence ( const std::string &  nodeName,
const Idx  val 
)
finalvirtualinherited

change the value of an already existing hard evidence

Exceptions
UndefinedElementif nodeName does not belong to the Bayesian network
InvalidArgumentif val is not a value for id
InvalidArgumentif id does not already have an evidence

Definition at line 408 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

409  {
410  chgEvidence(this->model().idFromName(nodeName), val);
411  }
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
virtual void chgEvidence(NodeId id, const Idx val) final
change the value of an already existing hard evidence
+ Here is the call graph for this function:

◆ chgEvidence() [3/7]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::chgEvidence ( NodeId  id,
const std::string &  label 
)
finalvirtualinherited

change the value of an already existing hard evidence

Exceptions
UndefinedElementif id does not belong to the Bayesian network
InvalidArgumentif val is not a value for id
InvalidArgumentif id does not already have an evidence

Definition at line 415 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

416  {
417  chgEvidence(id, this->model().variable(id)[label]);
418  }
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
virtual void chgEvidence(NodeId id, const Idx val) final
change the value of an already existing hard evidence
+ Here is the call graph for this function:

◆ chgEvidence() [4/7]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::chgEvidence ( const std::string &  nodeName,
const std::string &  label 
)
finalvirtualinherited

change the value of an already existing hard evidence

Exceptions
UndefinedElementif nodeName does not belong to the Bayesian network
InvalidArgumentif val is not a value for id
InvalidArgumentif id does not already have an evidence

Definition at line 422 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

423  {
424  NodeId id = this->model().idFromName(nodeName);
425  chgEvidence(id, this->model().variable(id)[label]);
426  }
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
virtual NodeId idFromName(const std::string &name) const =0
Getter by name.
virtual void chgEvidence(NodeId id, const Idx val) final
change the value of an already existing hard evidence
Size NodeId
Type for node ids.
Definition: graphElements.h:97
+ Here is the call graph for this function:

◆ chgEvidence() [5/7]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::chgEvidence ( NodeId  id,
const std::vector< GUM_SCALAR > &  vals 
)
finalvirtualinherited

change the value of an already existing evidence (might be soft or hard)

Exceptions
UndefinedElementif id does not belong to the Bayesian network
InvalidArgumentif the node does not already have an evidence
FatalErrorif vals=[0,0,...,0]
InvalidArgumentif the size of vals is different from the domain size of node id

Definition at line 431 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

432  {
433  // check whether this corresponds to an evidence
434  if (_model_ == nullptr)
435  GUM_ERROR(NullElement,
436  "No Bayes net has been assigned to the "
437  "inference algorithm");
438 
439  if (!_model_->exists(id)) { GUM_ERROR(UndefinedElement, id << " is not a NodeId in the model") }
440 
441  if (_model_->variable(id).domainSize() != vals.size()) {
442  GUM_ERROR(InvalidArgument,
443  "node " << _model_->variable(id) << " and its evidence have different sizes.");
444  }
445 
446  // create the potential corresponding to vals
447  Potential< GUM_SCALAR > pot;
448  pot.add(_model_->variable(id));
449  pot.fillWith(vals);
450  chgEvidence(pot);
451  }
virtual Size domainSize() const =0
virtual bool exists(NodeId node) const =0
Return true if this node exists in this graphical model.
virtual void chgEvidence(NodeId id, const Idx val) final
change the value of an already existing hard evidence
const GraphicalModel * _model_
the Bayes net on which we perform inferences
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variable given it&#39;s node id.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ chgEvidence() [6/7]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::chgEvidence ( const std::string &  nodeName,
const std::vector< GUM_SCALAR > &  vals 
)
finalvirtualinherited

change the value of an already existing evidence (might be soft or hard)

Exceptions
UndefinedElementif nodeName does not belong to the Bayesian network
InvalidArgumentif the node does not already have an evidence
FatalErrorif vals=[0,0,...,0]
InvalidArgumentif the size of vals is different from the domain size of node id

Definition at line 456 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

457  {
458  chgEvidence(this->model().idFromName(nodeName), vals);
459  }
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
virtual void chgEvidence(NodeId id, const Idx val) final
change the value of an already existing hard evidence
+ Here is the call graph for this function:

◆ chgEvidence() [7/7]

template<typename GUM_SCALAR >
void gum::GraphicalModelInference< GUM_SCALAR >::chgEvidence ( const Potential< GUM_SCALAR > &  pot)
finalvirtualinherited

change the value of an already existing evidence (might be soft or hard)

Exceptions
UndefinedElementif the potential is defined over several nodes
UndefinedElementif the node on which the potential is defined does not belong to the Bayesian network
InvalidArgumentif the node of the potential does not already have an evidence
FatalErrorif pot=[0,0,...,0]

Definition at line 464 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

464  {
465  // check if the potential corresponds to an evidence
466  if (pot.nbrDim() != 1) {
467  GUM_ERROR(InvalidArgument, pot << " is not a mono-dimensional potential.")
468  }
469  if (_model_ == nullptr)
470  GUM_ERROR(NullElement,
471  "No Bayes net has been assigned to the "
472  "inference algorithm");
473 
474  NodeId id = _model_->nodeId(pot.variable(0));
475 
476  if (!hasEvidence(id)) {
477  GUM_ERROR(InvalidArgument, id << " has no evidence. Please use addEvidence().")
478  }
479 
480  // check whether we have a hard evidence (and also check whether the
481  // potential only contains 0 (in this case, this will automatically raise
482  // an exception) )
483  Idx val;
484  bool is_hard_evidence = _isHardEvidence_(pot, val);
485 
486  // modify the evidence already stored
487  const Potential< GUM_SCALAR >* localPot = _evidence_[id];
488  Instantiation I(pot);
489  for (I.setFirst(); !I.end(); I.inc()) {
490  localPot->set(I, pot[I]);
491  }
492 
493  // the inference state will be different
494  // whether evidence change from Hard to Soft or not.
495  bool hasChangedSoftHard = false;
496 
497  if (is_hard_evidence) {
498  if (!hasHardEvidence(id)) {
499  hasChangedSoftHard = true;
500  _hard_evidence_.insert(id, val);
503  } else {
504  _hard_evidence_[id] = val;
505  }
506  } else {
507  if (hasHardEvidence(id)) { // evidence was hard
508  _hard_evidence_.erase(id);
511  hasChangedSoftHard = true;
512  }
513  }
514 
515  if (hasChangedSoftHard) {
517  } else {
519  }
520 
521  onEvidenceChanged_(id, hasChangedSoftHard);
522  }
virtual void setState_(const StateOfInference state) final
set the state of the inference engine and call the notification onStateChanged_ when necessary (i...
virtual bool hasHardEvidence(NodeId id) const final
indicates whether node id has received a hard evidence
NodeProperty< const Potential< GUM_SCALAR > *> _evidence_
the set of evidence entered into the network
void erase(const Key &k)
Erases an element from the set.
Definition: set_tpl.h:649
NodeProperty< Idx > _hard_evidence_
assign to each node with a hard evidence the index of its observed value
bool _isHardEvidence_(const Potential< GUM_SCALAR > &pot, Idx &val) const
checks whether a potential corresponds to a hard evidence or not
virtual void onEvidenceChanged_(const NodeId id, bool hasChangedSoftHard)=0
fired after an evidence is changed, in particular when its status (soft/hard) changes ...
virtual bool hasEvidence() const final
indicates whether some node(s) have received evidence
virtual NodeId nodeId(const DiscreteVariable &var) const =0
Return id node src discrete var pointer.
NodeSet _hard_evidence_nodes_
the set of nodes that received hard evidence
NodeSet _soft_evidence_nodes_
the set of nodes that received soft evidence
const GraphicalModel * _model_
the Bayes net on which we perform inferences
virtual bool isInferenceOutdatedStructure() const noexcept final
returns whether the inference object is in a OutdatedStructure state
Size NodeId
Type for node ids.
Definition: graphElements.h:97
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:606
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ clear()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::clear ( )
overridevirtual

Default constructor.

Parameters
infDiagthe influence diagram we want to perform inference upon

Reimplemented from gum::GraphicalModelInference< GUM_SCALAR >.

◆ collectingMessage_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::collectingMessage_ ( PhiNodeProperty phi,
PsiArcProperty psi,
NodeId  rootClique 
)
private

◆ collectingToFollowingRoot_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::collectingToFollowingRoot_ ( PhiNodeProperty phi,
PsiArcProperty psi,
NodeId  fromClique,
NodeId  toClique 
)
private

◆ computingPosteriors_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::computingPosteriors_ ( const PhiNodeProperty phi,
const PsiArcProperty psi 
)
private

◆ createReduced_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::createReduced_ ( )
protected

◆ deciding_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::deciding_ ( PhiNodeProperty phi,
PsiArcProperty psi,
NodeId  decisionNode 
)
private

◆ distributingMessage_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::distributingMessage_ ( PhiNodeProperty phi,
PsiArcProperty psi,
NodeId  rootClique 
)
private

◆ domainSizes()

template<typename GUM_SCALAR >
INLINE const NodeProperty< Size > & gum::GraphicalModelInference< GUM_SCALAR >::domainSizes ( ) const
finalvirtualinherited

get the domain sizes of the random variables of the model

Definition at line 159 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

159  {
160  return _domain_sizes_;
161  }
NodeProperty< Size > _domain_sizes_
the domain sizes of the random variables
+ Here is the call graph for this function:

◆ eraseAllEvidence()

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::eraseAllEvidence ( )
finalvirtualinherited

removes all the evidence entered into the network

Definition at line 553 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

553  {
554  bool has_hard_evidence = !_hard_evidence_.empty();
555  this->onAllEvidenceErased_(has_hard_evidence);
556 
557  for (const auto& pair: _evidence_) {
558  if (pair.second != nullptr) { delete (pair.second); }
559  }
560 
561  _evidence_.clear();
562  _hard_evidence_.clear();
565 
566  if (has_hard_evidence) {
568  } else {
570  }
571  }
virtual void onAllEvidenceErased_(bool contains_hard_evidence)=0
fired before all the evidence are erased
virtual void setState_(const StateOfInference state) final
set the state of the inference engine and call the notification onStateChanged_ when necessary (i...
NodeProperty< const Potential< GUM_SCALAR > *> _evidence_
the set of evidence entered into the network
NodeProperty< Idx > _hard_evidence_
assign to each node with a hard evidence the index of its observed value
NodeSet _hard_evidence_nodes_
the set of nodes that received hard evidence
NodeSet _soft_evidence_nodes_
the set of nodes that received soft evidence
void clear()
Removes all the elements, if any, from the set.
Definition: set_tpl.h:361
virtual bool isInferenceOutdatedStructure() const noexcept final
returns whether the inference object is in a OutdatedStructure state
+ Here is the call graph for this function:

◆ eraseEvidence() [1/2]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::eraseEvidence ( NodeId  id)
finalvirtualinherited

removed the evidence, if any, corresponding to node id

Definition at line 527 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

527  {
528  if (hasEvidence(id)) {
529  if (hasHardEvidence(id)) {
530  onEvidenceErased_(id, true);
531  _hard_evidence_.erase(id);
534  } else {
535  onEvidenceErased_(id, false);
538  }
539 
540  delete (_evidence_[id]);
541  _evidence_.erase(id);
542  }
543  }
virtual void setState_(const StateOfInference state) final
set the state of the inference engine and call the notification onStateChanged_ when necessary (i...
virtual bool hasHardEvidence(NodeId id) const final
indicates whether node id has received a hard evidence
NodeProperty< const Potential< GUM_SCALAR > *> _evidence_
the set of evidence entered into the network
void erase(const Key &k)
Erases an element from the set.
Definition: set_tpl.h:649
NodeProperty< Idx > _hard_evidence_
assign to each node with a hard evidence the index of its observed value
virtual bool hasEvidence() const final
indicates whether some node(s) have received evidence
NodeSet _hard_evidence_nodes_
the set of nodes that received hard evidence
virtual void onEvidenceErased_(const NodeId id, bool isHardEvidence)=0
fired before an evidence is removed
NodeSet _soft_evidence_nodes_
the set of nodes that received soft evidence
virtual bool isInferenceOutdatedStructure() const noexcept final
returns whether the inference object is in a OutdatedStructure state
+ Here is the call graph for this function:

◆ eraseEvidence() [2/2]

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::eraseEvidence ( const std::string &  nodeName)
finalvirtualinherited

removed the evidence, if any, corresponding to node of name nodeName

Definition at line 546 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

546  {
547  eraseEvidence(this->model().idFromName(nodeName));
548  }
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
virtual void eraseEvidence(NodeId id) final
removed the evidence, if any, corresponding to node id
+ Here is the call graph for this function:

◆ evidence()

template<typename GUM_SCALAR >
INLINE const NodeProperty< const Potential< GUM_SCALAR > *> & gum::GraphicalModelInference< GUM_SCALAR >::evidence ( ) const
inherited

returns the set of evidence

Definition at line 605 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

605  {
606  return _evidence_;
607  }
NodeProperty< const Potential< GUM_SCALAR > *> _evidence_
the set of evidence entered into the network
+ Here is the call graph for this function:

◆ hardEvidence()

template<typename GUM_SCALAR >
INLINE const NodeProperty< Idx > & gum::GraphicalModelInference< GUM_SCALAR >::hardEvidence ( ) const
inherited

indicate for each node with hard evidence which value it took

Definition at line 597 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

597  {
598  return _hard_evidence_;
599  }
NodeProperty< Idx > _hard_evidence_
assign to each node with a hard evidence the index of its observed value
+ Here is the call graph for this function:

◆ hardEvidenceNodes()

template<typename GUM_SCALAR >
INLINE const NodeSet & gum::GraphicalModelInference< GUM_SCALAR >::hardEvidenceNodes ( ) const
inherited

returns the set of nodes with hard evidence

the set of nodes that received hard evidence

Definition at line 619 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

619  {
620  return _hard_evidence_nodes_;
621  }
NodeSet _hard_evidence_nodes_
the set of nodes that received hard evidence
+ Here is the call graph for this function:

◆ hasEvidence() [1/3]

template<typename GUM_SCALAR >
INLINE bool gum::GraphicalModelInference< GUM_SCALAR >::hasEvidence ( ) const
finalvirtualinherited

indicates whether some node(s) have received evidence

Definition at line 351 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

351  {
352  return !_evidence_.empty();
353  }
NodeProperty< const Potential< GUM_SCALAR > *> _evidence_
the set of evidence entered into the network
+ Here is the call graph for this function:

◆ hasEvidence() [2/3]

template<typename GUM_SCALAR >
INLINE bool gum::GraphicalModelInference< GUM_SCALAR >::hasEvidence ( NodeId  id) const
finalvirtualinherited

indicates whether node id has received an evidence

Definition at line 358 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

358  {
359  return _evidence_.exists(id);
360  }
NodeProperty< const Potential< GUM_SCALAR > *> _evidence_
the set of evidence entered into the network
+ Here is the call graph for this function:

◆ hasEvidence() [3/3]

template<typename GUM_SCALAR >
INLINE bool gum::GraphicalModelInference< GUM_SCALAR >::hasEvidence ( const std::string &  nodeName) const
finalvirtualinherited

indicates whether node id has received an evidence

Definition at line 380 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

380  {
381  return hasEvidence(this->model().idFromName(nodeName));
382  }
virtual bool hasEvidence() const final
indicates whether some node(s) have received evidence
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
+ Here is the call graph for this function:

◆ hasHardEvidence() [1/2]

template<typename GUM_SCALAR >
INLINE bool gum::GraphicalModelInference< GUM_SCALAR >::hasHardEvidence ( NodeId  id) const
finalvirtualinherited

indicates whether node id has received a hard evidence

Definition at line 365 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

365  {
366  return _hard_evidence_nodes_.exists(id);
367  }
bool exists(const Key &k) const
Indicates whether a given elements belong to the set.
Definition: set_tpl.h:600
NodeSet _hard_evidence_nodes_
the set of nodes that received hard evidence
+ Here is the call graph for this function:

◆ hasHardEvidence() [2/2]

template<typename GUM_SCALAR >
INLINE bool gum::GraphicalModelInference< GUM_SCALAR >::hasHardEvidence ( const std::string &  nodeName) const
finalvirtualinherited

indicates whether node id has received a hard evidence

Definition at line 388 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

388  {
389  return hasHardEvidence(this->model().idFromName(nodeName));
390  }
virtual bool hasHardEvidence(NodeId id) const final
indicates whether node id has received a hard evidence
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
+ Here is the call graph for this function:

◆ hasNoForgettingAssumption()

template<typename GUM_SCALAR >
bool gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::hasNoForgettingAssumption ( ) const

Default constructor.

Parameters
infDiagthe influence diagram we want to perform inference upon

◆ hasNoModel_()

template<typename GUM_SCALAR >
bool gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_ ( ) const
inlineprotectedinherited

Definition at line 527 of file graphicalModelInference.h.

527 { return _model_ == nullptr; };
const GraphicalModel * _model_
the Bayes net on which we perform inferences

◆ hasSoftEvidence() [1/2]

template<typename GUM_SCALAR >
INLINE bool gum::GraphicalModelInference< GUM_SCALAR >::hasSoftEvidence ( NodeId  id) const
finalvirtualinherited

indicates whether node id has received a soft evidence

Definition at line 372 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

372  {
373  return _soft_evidence_nodes_.exists(id);
374  }
bool exists(const Key &k) const
Indicates whether a given elements belong to the set.
Definition: set_tpl.h:600
NodeSet _soft_evidence_nodes_
the set of nodes that received soft evidence
+ Here is the call graph for this function:

◆ hasSoftEvidence() [2/2]

template<typename GUM_SCALAR >
INLINE bool gum::GraphicalModelInference< GUM_SCALAR >::hasSoftEvidence ( const std::string &  nodeName) const
finalvirtualinherited

indicates whether node id has received a soft evidence

Definition at line 396 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

396  {
397  return hasSoftEvidence(this->model().idFromName(nodeName));
398  }
virtual bool hasSoftEvidence(NodeId id) const final
indicates whether node id has received a soft evidence
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
+ Here is the call graph for this function:

◆ influenceDiagram()

template<typename GUM_SCALAR >
virtual const InfluenceDiagram< GUM_SCALAR >& gum::InfluenceDiagramInference< GUM_SCALAR >::influenceDiagram ( ) const
finalvirtualinherited

Returns a constant reference over the IBayesNet referenced by this class.

Exceptions
UndefinedElementis raised if no Bayes net has been assigned to the inference.

◆ initializingInference_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::initializingInference_ ( PhiNodeProperty phi,
PsiArcProperty psi 
)
private

◆ integrating_() [1/2]

template<typename GUM_SCALAR >
DecisionPotential< double > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::integrating_ ( const PhiNodeProperty phi,
const PsiArcProperty psi,
NodeId  clique,
NodeId  except 
) const
private

◆ integrating_() [2/2]

template<typename GUM_SCALAR >
DecisionPotential< double > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::integrating_ ( const PhiNodeProperty phi,
const PsiArcProperty psi,
NodeId  clique 
) const
private

◆ isInferenceDone()

template<typename GUM_SCALAR >
INLINE bool gum::GraphicalModelInference< GUM_SCALAR >::isInferenceDone ( ) const
finalvirtualnoexceptinherited

returns whether the inference object is in a InferenceDone state

The inference object is in a done state when the posteriors can be retrieved without performing a new inference, i.e., all the heavy computations have already been performed. Typically, in a junction tree algorithm, this corresponds to a situation in which all the messages needed in the JT have been computed and sent.

Definition at line 84 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

84  {
85  return (_state_ == StateOfInference::Done);
86  }
StateOfInference _state_
the current state of the inference (outdated/ready/done)
+ Here is the call graph for this function:

◆ isInferenceOutdatedPotentials()

template<typename GUM_SCALAR >
INLINE bool gum::GraphicalModelInference< GUM_SCALAR >::isInferenceOutdatedPotentials ( ) const
finalvirtualnoexceptinherited

returns whether the inference object is in a OutdatedPotential state

Definition at line 79 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

79  {
81  }
StateOfInference _state_
the current state of the inference (outdated/ready/done)
+ Here is the call graph for this function:

◆ isInferenceOutdatedStructure()

template<typename GUM_SCALAR >
INLINE bool gum::GraphicalModelInference< GUM_SCALAR >::isInferenceOutdatedStructure ( ) const
finalvirtualnoexceptinherited

returns whether the inference object is in a OutdatedStructure state

Definition at line 73 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

73  {
75  }
StateOfInference _state_
the current state of the inference (outdated/ready/done)
+ Here is the call graph for this function:

◆ isInferenceReady()

template<typename GUM_SCALAR >
INLINE bool gum::GraphicalModelInference< GUM_SCALAR >::isInferenceReady ( ) const
finalvirtualnoexceptinherited

returns whether the inference object is in a ready state

Definition at line 68 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

68  {
70  }
StateOfInference _state_
the current state of the inference (outdated/ready/done)
+ Here is the call graph for this function:

◆ isSolvable()

template<typename GUM_SCALAR >
bool gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::isSolvable ( ) const

◆ junctionTree()

template<typename GUM_SCALAR >
const JunctionTree* gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::junctionTree ( ) const

Default constructor.

Parameters
infDiagthe influence diagram we want to perform inference upon

◆ makeInference()

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::makeInference ( )
finalvirtualinherited

perform the heavy computations needed to compute the targets' posteriors

In a Junction tree propagation scheme, for instance, the heavy computations are those of the messages sent in the JT. This is precisely what makeInference should compute. Later, the computations of the posteriors can be done "lightly" by multiplying and projecting those messages.

Definition at line 664 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

664  {
665  if (isInferenceDone()) { return; }
666 
667  if (!isInferenceReady()) { prepareInference(); }
668 
669  makeInference_();
670 
672  }
virtual void prepareInference() final
prepare the internal inference structures for the next inference
virtual void setState_(const StateOfInference state) final
set the state of the inference engine and call the notification onStateChanged_ when necessary (i...
virtual bool isInferenceDone() const noexcept final
returns whether the inference object is in a InferenceDone state
virtual void makeInference_()=0
called when the inference has to be performed effectively
virtual bool isInferenceReady() const noexcept final
returns whether the inference object is in a ready state
+ Here is the call graph for this function:

◆ makeInference_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::makeInference_ ( )
overrideprotectedvirtual

called when the inference has to be performed effectively

Once the inference is done, fillPosterior_ can be called.

Implements gum::GraphicalModelInference< GUM_SCALAR >.

◆ meanVar() [1/2]

template<typename GUM_SCALAR >
virtual std::pair< GUM_SCALAR, GUM_SCALAR > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::meanVar ( NodeId  node)
finalvirtual

Return the pair (mean,variance) for a node.

Parameters
node
Returns
the pair (mean,variance) for a node

Implements gum::InfluenceDiagramInference< GUM_SCALAR >.

◆ meanVar() [2/2]

template<typename GUM_SCALAR >
std::pair< GUM_SCALAR, GUM_SCALAR > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::meanVar ( const std::string &  name)
inlinefinalvirtual

Implements gum::InfluenceDiagramInference< GUM_SCALAR >.

Definition at line 142 of file ShaferShenoyLIMIDInference.h.

142  {
143  return meanVar(this->influenceDiagram().idFromName(name));
144  };
virtual std::pair< GUM_SCALAR, GUM_SCALAR > meanVar(NodeId node) final
Return the pair (mean,variance) for a node.
virtual const InfluenceDiagram< GUM_SCALAR > & influenceDiagram() const final
Returns a constant reference over the IBayesNet referenced by this class.

◆ MEU()

template<typename GUM_SCALAR >
std::pair< GUM_SCALAR, GUM_SCALAR > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::MEU ( )
finalvirtual

Return the pair (mean,variance) for the total utility (MEU)

Returns
the pair (mean,variance) for MEU

Implements gum::InfluenceDiagramInference< GUM_SCALAR >.

◆ model()

template<typename GUM_SCALAR >
INLINE const GraphicalModel & gum::GraphicalModelInference< GUM_SCALAR >::model ( ) const
finalvirtualinherited

Returns a constant reference over the IBayesNet referenced by this class.

Exceptions
UndefinedElementis raised if no Bayes net has been assigned to the inference.

Definition at line 107 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

107  {
108  if (_model_ == nullptr)
109  GUM_ERROR(UndefinedElement,
110  "No Bayes net has been assigned to "
111  "the inference algorithm.");
112  return *_model_;
113  }
const GraphicalModel * _model_
the Bayes net on which we perform inferences
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ nbrEvidence()

template<typename GUM_SCALAR >
INLINE Size gum::GraphicalModelInference< GUM_SCALAR >::nbrEvidence ( ) const
finalvirtualinherited

returns the number of evidence entered into the Bayesian network

Definition at line 576 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

576  {
577  return _evidence_.size();
578  }
NodeProperty< const Potential< GUM_SCALAR > *> _evidence_
the set of evidence entered into the network
+ Here is the call graph for this function:

◆ nbrHardEvidence()

template<typename GUM_SCALAR >
INLINE Size gum::GraphicalModelInference< GUM_SCALAR >::nbrHardEvidence ( ) const
finalvirtualinherited

returns the number of hard evidence entered into the Bayesian network

Definition at line 583 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

583  {
584  return _hard_evidence_nodes_.size();
585  }
NodeSet _hard_evidence_nodes_
the set of nodes that received hard evidence
Size size() const noexcept
Returns the number of elements in the set.
Definition: set_tpl.h:694
+ Here is the call graph for this function:

◆ nbrSoftEvidence()

template<typename GUM_SCALAR >
INLINE Size gum::GraphicalModelInference< GUM_SCALAR >::nbrSoftEvidence ( ) const
finalvirtualinherited

returns the number of soft evidence entered into the Bayesian network

Definition at line 590 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

590  {
591  return _soft_evidence_nodes_.size();
592  }
NodeSet _soft_evidence_nodes_
the set of nodes that received soft evidence
Size size() const noexcept
Returns the number of elements in the set.
Definition: set_tpl.h:694
+ Here is the call graph for this function:

◆ nonRequisiteNodes_()

template<typename GUM_SCALAR >
NodeSet gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::nonRequisiteNodes_ ( NodeId  d) const
protected

Returns the set of non-requisite for node d.

◆ onAllEvidenceErased_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::onAllEvidenceErased_ ( bool  contains_hard_evidence)
overrideprotectedvirtual

fired before all the evidence are erased

Implements gum::GraphicalModelInference< GUM_SCALAR >.

◆ onEvidenceAdded_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::onEvidenceAdded_ ( NodeId  id,
bool  isHardEvidence 
)
overrideprotectedvirtual

fired after a new evidence is inserted

Implements gum::GraphicalModelInference< GUM_SCALAR >.

◆ onEvidenceChanged_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::onEvidenceChanged_ ( NodeId  id,
bool  hasChangedSoftHard 
)
overrideprotectedvirtual

fired after an evidence is changed, in particular when its status (soft/hard) changes

Parameters
nodeIdthe node of the changed evidence
hasChangedSoftHardtrue if the evidence has changed from Soft to Hard or from Hard to Soft

Implements gum::GraphicalModelInference< GUM_SCALAR >.

◆ onEvidenceErased_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::onEvidenceErased_ ( NodeId  id,
bool  isHardEvidence 
)
overrideprotectedvirtual

fired before an evidence is removed

Implements gum::GraphicalModelInference< GUM_SCALAR >.

◆ onModelChanged_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::onModelChanged_ ( const GraphicalModel model)
overrideprotectedvirtual

fired after a new Bayes net has been assigned to the engine

Implements gum::GraphicalModelInference< GUM_SCALAR >.

◆ onStateChanged_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::onStateChanged_ ( )
overrideprotectedvirtual

fired when the stage is changed

Implements gum::GraphicalModelInference< GUM_SCALAR >.

◆ optimalDecision() [1/2]

template<typename GUM_SCALAR >
gum::Potential< GUM_SCALAR > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::optimalDecision ( NodeId  decisionId)
finalvirtual

◆ optimalDecision() [2/2]

template<typename GUM_SCALAR >
gum::Potential< GUM_SCALAR > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::optimalDecision ( const std::string &  decisionName)
inlinefinalvirtual

Implements gum::InfluenceDiagramInference< GUM_SCALAR >.

Definition at line 109 of file ShaferShenoyLIMIDInference.h.

109  {
110  return optimalDecision(this->influenceDiagram().idFromName(decisionName));
111  };
virtual const InfluenceDiagram< GUM_SCALAR > & influenceDiagram() const final
Returns a constant reference over the IBayesNet referenced by this class.
gum::Potential< GUM_SCALAR > optimalDecision(NodeId decisionId) final

◆ posterior() [1/2]

template<typename GUM_SCALAR >
virtual const Potential< GUM_SCALAR >& gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::posterior ( NodeId  node)
finalvirtual

Return the posterior probability of a node.

Parameters
node
Returns
the posterior probability

Implements gum::InfluenceDiagramInference< GUM_SCALAR >.

◆ posterior() [2/2]

template<typename GUM_SCALAR >
const Potential< GUM_SCALAR >& gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::posterior ( const std::string &  name)
inlinefinalvirtual

Implements gum::InfluenceDiagramInference< GUM_SCALAR >.

Definition at line 120 of file ShaferShenoyLIMIDInference.h.

120  {
121  return posterior(this->influenceDiagram().idFromName(name));
122  };
virtual const Potential< GUM_SCALAR > & posterior(NodeId node) final
Return the posterior probability of a node.
virtual const InfluenceDiagram< GUM_SCALAR > & influenceDiagram() const final
Returns a constant reference over the IBayesNet referenced by this class.

◆ posteriorUtility() [1/2]

template<typename GUM_SCALAR >
virtual const Potential< GUM_SCALAR >& gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::posteriorUtility ( NodeId  node)
finalvirtual

Return the posterior utility of a node.

Parameters
node
Returns
the posterior utility of a node

Implements gum::InfluenceDiagramInference< GUM_SCALAR >.

◆ posteriorUtility() [2/2]

template<typename GUM_SCALAR >
virtual const Potential< GUM_SCALAR >& gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::posteriorUtility ( const std::string &  name)
inlinefinalvirtual

Implements gum::InfluenceDiagramInference< GUM_SCALAR >.

Definition at line 131 of file ShaferShenoyLIMIDInference.h.

131  {
132  return posteriorUtility(this->influenceDiagram().idFromName(name));
133  };
virtual const InfluenceDiagram< GUM_SCALAR > & influenceDiagram() const final
Returns a constant reference over the IBayesNet referenced by this class.
virtual const Potential< GUM_SCALAR > & posteriorUtility(NodeId node) final
Return the posterior utility of a node.

◆ prepareInference()

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::prepareInference ( )
finalvirtualinherited

prepare the internal inference structures for the next inference

Definition at line 645 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

645  {
646  if (isInferenceReady() || isInferenceDone()) { return; }
647 
648  if (_model_ == nullptr)
649  GUM_ERROR(NullElement,
650  "No model been assigned to the "
651  "inference algorithm");
652 
655  else
657 
659  }
virtual void updateOutdatedPotentials_()=0
prepares inference when the latter is in OutdatedPotentials state
virtual void setState_(const StateOfInference state) final
set the state of the inference engine and call the notification onStateChanged_ when necessary (i...
virtual void updateOutdatedStructure_()=0
prepares inference when the latter is in OutdatedStructure state
virtual bool isInferenceDone() const noexcept final
returns whether the inference object is in a InferenceDone state
StateOfInference _state_
the current state of the inference (outdated/ready/done)
virtual bool isInferenceReady() const noexcept final
returns whether the inference object is in a ready state
const GraphicalModel * _model_
the Bayes net on which we perform inferences
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ reducedGraph()

template<typename GUM_SCALAR >
DAG gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::reducedGraph ( ) const
inline

◆ reducedLIMID()

template<typename GUM_SCALAR >
InfluenceDiagram< GUM_SCALAR > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::reducedLIMID ( ) const

◆ reversePartialOrder()

template<typename GUM_SCALAR >
std::vector< NodeSet > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::reversePartialOrder ( ) const

◆ setInfluenceDiagram()

template<typename GUM_SCALAR >
virtual void gum::InfluenceDiagramInference< GUM_SCALAR >::setInfluenceDiagram ( const InfluenceDiagram< GUM_SCALAR > *  infdiag)
virtualinherited

assigns a new influence diagram to the inference engine

Assigns a new influence diagram to the o,fere,ce e,go,e engine and sends messages to the descendants of ShaferShenoyLIMIDInference to inform them that the ID has changed.

Warning
note that, by aGrUM's rule, the influence Diagram is not copied into the inference engine but only referenced.

◆ setModel_()

template<typename GUM_SCALAR >
void gum::GraphicalModelInference< GUM_SCALAR >::setModel_ ( const GraphicalModel model)
protectedinherited

Definition at line 118 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

118  {
119  clear();
120  _model_ = model;
124  }
virtual void setState_(const StateOfInference state) final
set the state of the inference engine and call the notification onStateChanged_ when necessary (i...
void _computeDomainSizes_()
computes the domain sizes of the random variables
virtual void onModelChanged_(const GraphicalModel *model)=0
fired after a new Bayes net has been assigned to the engine
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
virtual void clear()
clears all the data structures allocated for the last inference
const GraphicalModel * _model_
the Bayes net on which we perform inferences
+ Here is the call graph for this function:

◆ setModelDuringConstruction_()

template<typename GUM_SCALAR >
void gum::GraphicalModelInference< GUM_SCALAR >::setModelDuringConstruction_ ( const GraphicalModel model)
protectedinherited

assigns a model during the inference engine construction

Definition at line 129 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

130  {
131  _model_ = model;
134  }
virtual void setState_(const StateOfInference state) final
set the state of the inference engine and call the notification onStateChanged_ when necessary (i...
void _computeDomainSizes_()
computes the domain sizes of the random variables
virtual const GraphicalModel & model() const final
Returns a constant reference over the IBayesNet referenced by this class.
const GraphicalModel * _model_
the Bayes net on which we perform inferences
+ Here is the call graph for this function:

◆ setOutdatedPotentialsState_()

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::setOutdatedPotentialsState_ ( )
protectedinherited

puts the inference into an OutdatedPotentials state if it is not already in an OutdatedStructure state

OutdatedPotentials: in this state, the structure of the model remains unchanged, only some potentials stored in it have changed. Therefore, the inference probably just needs to invalidate some already computed potentials to be ready. Only a light amount of preparation is needed to be able to perform inference.

Definition at line 638 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

638  {
640  }
virtual void setState_(const StateOfInference state) final
set the state of the inference engine and call the notification onStateChanged_ when necessary (i...
+ Here is the call graph for this function:

◆ setOutdatedStructureState_()

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::setOutdatedStructureState_ ( )
protectedinherited

put the inference into an outdated model structure state

OutdatedStructure: in this state, the inference is fully unprepared to be applied because some events changed the "logical" structure of the model: for instance a node received a hard evidence, which implies that its outgoing arcs can be removed from the model, hence involving a structural change in the model. As a consequence, the (incremental) inference (probably) needs a significant amount of preparation to be ready for the next inference. In a Lazy propagation, for instance, this step amounts to compute a new join tree, hence a new structure in which inference will be applied. Note that classes that inherit from graphicalModelInference may be smarter than graphicalModelInference and may, in some situations, find out that their data structures are still ok for inference and, therefore, only resort to perform the actions related to the OutdatedPotentials state. As an example, consider a LazyPropagation inference in Bayes Net A->B->C->D->E in which C has received hard evidence e_C and E is the only target. In this case, A and B are not needed for inference, the only potentials that matter are P(D|e_C) and P(E|D). So the smallest join tree needed for inference contains only one clique DE. Now, adding new evidence e_A on A has no impact on E given hard evidence e_C. In this case, LazyPropagation can be smart and not update its join tree.

Definition at line 630 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

630  {
632  }
virtual void setState_(const StateOfInference state) final
set the state of the inference engine and call the notification onStateChanged_ when necessary (i...
+ Here is the call graph for this function:

◆ setState_()

template<typename GUM_SCALAR >
INLINE void gum::GraphicalModelInference< GUM_SCALAR >::setState_ ( const StateOfInference  state)
finalprotectedvirtualinherited

set the state of the inference engine and call the notification onStateChanged_ when necessary (i.e. when the state has effectively changed).

Definition at line 98 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

98  {
99  if (_state_ != state) {
100  _state_ = state;
101  onStateChanged_();
102  }
103  }
virtual StateOfInference state() const noexcept final
returns the state of the inference engine
StateOfInference _state_
the current state of the inference (outdated/ready/done)
virtual void onStateChanged_()=0
fired when the stage is changed
+ Here is the call graph for this function:

◆ softEvidenceNodes()

template<typename GUM_SCALAR >
INLINE const NodeSet & gum::GraphicalModelInference< GUM_SCALAR >::softEvidenceNodes ( ) const
inherited

returns the set of nodes with soft evidence

the set of nodes that received soft evidence

Definition at line 612 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

612  {
613  return _soft_evidence_nodes_;
614  }
NodeSet _soft_evidence_nodes_
the set of nodes that received soft evidence
+ Here is the call graph for this function:

◆ state()

template<typename GUM_SCALAR >
INLINE GraphicalModelInference< GUM_SCALAR >::StateOfInference gum::GraphicalModelInference< GUM_SCALAR >::state ( ) const
finalvirtualnoexceptinherited

returns the state of the inference engine

Definition at line 92 of file graphicalModelInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

92  {
93  return _state_;
94  }
StateOfInference _state_
the current state of the inference (outdated/ready/done)
+ Here is the call graph for this function:

◆ transmittingFinalMessage_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::transmittingFinalMessage_ ( PhiNodeProperty phi,
PsiArcProperty psi,
NodeId  fromClique,
NodeId  toClique 
)
private

◆ transmittingMessage_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::transmittingMessage_ ( PhiNodeProperty phi,
PsiArcProperty psi,
NodeId  fromClique,
NodeId  toClique 
)
private

◆ updateOutdatedPotentials_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::updateOutdatedPotentials_ ( )
overrideprotectedvirtual

prepares inference when the latter is in OutdatedPotentials state

Note that the values of evidence are not necessarily known and can be changed between updateOutdatedPotentials_ and makeInference_.

Implements gum::GraphicalModelInference< GUM_SCALAR >.

◆ updateOutdatedStructure_()

template<typename GUM_SCALAR >
void gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::updateOutdatedStructure_ ( )
overrideprotectedvirtual

prepares inference when the latter is in OutdatedStructure state

Note that the values of evidence are not necessarily known and can be changed between updateOutdatedStructure_ and makeInference_.

Implements gum::GraphicalModelInference< GUM_SCALAR >.

Member Data Documentation

◆ node_to_clique_

template<typename GUM_SCALAR >
NodeProperty< NodeId > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::node_to_clique_
protected

Definition at line 169 of file ShaferShenoyLIMIDInference.h.

◆ noForgettingOrder_

template<typename GUM_SCALAR >
std::vector< NodeId > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::noForgettingOrder_
protected

Definition at line 178 of file ShaferShenoyLIMIDInference.h.

◆ posteriors_

template<typename GUM_SCALAR >
NodeProperty< DecisionPotential< GUM_SCALAR > > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::posteriors_
protected

Definition at line 172 of file ShaferShenoyLIMIDInference.h.

◆ reduced_

template<typename GUM_SCALAR >
DAG gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::reduced_
protected

Definition at line 167 of file ShaferShenoyLIMIDInference.h.

◆ reducedJunctionTree_

template<typename GUM_SCALAR >
CliqueGraph gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::reducedJunctionTree_
protected

Definition at line 168 of file ShaferShenoyLIMIDInference.h.

◆ reversePartialOrder_

template<typename GUM_SCALAR >
std::vector< NodeSet > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::reversePartialOrder_
protected

Definition at line 176 of file ShaferShenoyLIMIDInference.h.

◆ solvabilityOrder_

template<typename GUM_SCALAR >
std::vector< NodeId > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::solvabilityOrder_
protected

Definition at line 177 of file ShaferShenoyLIMIDInference.h.

◆ strategies_

template<typename GUM_SCALAR >
NodeProperty< Potential< GUM_SCALAR > > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::strategies_
protected

Definition at line 171 of file ShaferShenoyLIMIDInference.h.

◆ unconditionalDecisions_

template<typename GUM_SCALAR >
NodeProperty< DecisionPotential< GUM_SCALAR > > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::unconditionalDecisions_
protected

Definition at line 173 of file ShaferShenoyLIMIDInference.h.

◆ varsSeparator_

template<typename GUM_SCALAR >
EdgeProperty< SetOfVars > gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::varsSeparator_
protected

Definition at line 170 of file ShaferShenoyLIMIDInference.h.


The documentation for this class was generated from the following file: