aGrUM  0.16.0
classBayesNet.h
Go to the documentation of this file.
1 
29 #ifndef GUM_CLASS_BAYESNET_H
30 #define GUM_CLASS_BAYESNET_H
31 
32 #include <list>
33 
34 #include <agrum/BN/IBayesNet.h>
35 
36 #include <agrum/PRM/PRM.h>
37 namespace gum {
38  namespace prm {
39 
40  // clang-format off
58  // clang-format on
59  template < typename GUM_SCALAR >
60  class ClassBayesNet : public IBayesNet< GUM_SCALAR > {
61  public:
62  // ========================================================================
64  // ========================================================================
66 
71 
74 
78 
80  virtual ~ClassBayesNet< GUM_SCALAR >();
81 
83  // ===========================================================================
85  // ===========================================================================
87 
101  virtual const Potential< GUM_SCALAR >& cpt(NodeId varId) const;
102 
104  virtual const VariableNodeMap& variableNodeMap() const;
105 
107  virtual const DiscreteVariable& variable(NodeId id) const;
108 
110  virtual NodeId nodeId(const DiscreteVariable& var) const;
111 
113  virtual NodeId idFromName(const std::string& name) const;
114 
116  virtual const DiscreteVariable&
117  variableFromName(const std::string& name) const;
118 
120  const NodeProperty< Size >& modalities() const;
121 
123  // ===========================================================================
125  // ===========================================================================
128  virtual std::string toDot() const;
129 
131  private:
135 
139  const PRMClassElement< GUM_SCALAR >& __get(NodeId id) const;
140 
144  const PRMClassElement< GUM_SCALAR >& __get(const std::string& name) const;
145 
148 
150 
151  void __init(const PRMClass< GUM_SCALAR >& c);
152  };
153 
154 
155 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
156  extern template class ClassBayesNet< double >;
157 #endif
158 
159 
160  } /* namespace prm */
161 } /* namespace gum */
162 
164 
165 #endif /* GUM_CLASS_BAYESNET_H */
aGrUM&#39;s Potential is a multi-dimensional array with tensor operators.
Definition: potential.h:60
virtual const VariableNodeMap & variableNodeMap() const
See gum::IBaseBayesNet::variableNodeMap().
virtual const DiscreteVariable & variable(NodeId id) const
See gum::IBaseBayesNet::variable().
void __init(const PRMClass< GUM_SCALAR > &c)
Container used to map discrete variables with nodes.
Abstract class representing an element of PRM class.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const PRMClassElement< GUM_SCALAR > & __get(NodeId id) const
Private getter with type checking in case the id is not a formal PRMAttribute.
const PRMClass< GUM_SCALAR > * __class
The PRMClassElementContainer decorated by this.
NodeProperty< Size > __modalities
Base class for discrete random variable.
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
virtual const DiscreteVariable & variableFromName(const std::string &name) const
See gum::IBaseBayesNet::variableFromName().
The class for generic Hash Tables.
Definition: hashTable.h:679
This class decorates a gum::prm::Class<GUM_SCALAR> has an IBaseBayesNet.
Definition: classBayesNet.h:60
virtual NodeId nodeId(const DiscreteVariable &var) const
See gum::IBaseBayesNet::nodeId().
A PRMClass is an object of a PRM representing a fragment of a Bayesian Network which can be instantia...
Definition: PRMClass.h:66
virtual std::string toDot() const
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
ClassBayesNet< GUM_SCALAR > & operator=(const ClassBayesNet< GUM_SCALAR > &from)
Copy operator.
virtual NodeId idFromName(const std::string &name) const
See gum::IBaseBayesNet::idFromName().
Size NodeId
Type for node ids.
Definition: graphElements.h:98
const NodeProperty< Size > & modalities() const
See gum::IBaseBayesNet::modalities().
HashTable< const DiscreteVariable *, const PRMClassElement< GUM_SCALAR > *> __varNodeMap
Mapping between DiscreteVariable and their NodeId.
virtual const Potential< GUM_SCALAR > & cpt(NodeId varId) const
Returns the CPT of a node in this ClassBayesNet<GUM_SCALAR>.