aGrUM  0.14.2
instanceBayesNet.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
27 #ifndef GUM_INSTANCE_BAYESNET_H
28 #define GUM_INSTANCE_BAYESNET_H
29 
30 #include <list>
31 
32 #include <agrum/BN/IBayesNet.h>
33 
34 #include <agrum/PRM/PRM.h>
35 
36 namespace gum {
37  namespace prm {
38 
53  template < typename GUM_SCALAR >
54  class InstanceBayesNet : public IBayesNet< GUM_SCALAR > {
55  public:
56  // ========================================================================
58  // ========================================================================
60 
65 
68 
71 
73  virtual ~InstanceBayesNet();
74 
76  // ===========================================================================
78  // ===========================================================================
80 
82  virtual const Potential< GUM_SCALAR >& cpt(NodeId varId) const;
83 
85  virtual const VariableNodeMap& variableNodeMap() const;
86 
88  virtual const DiscreteVariable& variable(NodeId id) const;
89 
91  virtual NodeId nodeId(const DiscreteVariable& var) const;
92 
94  virtual NodeId idFromName(const std::string& name) const;
95 
97  virtual const DiscreteVariable&
98  variableFromName(const std::string& name) const;
99 
100  const NodeProperty< Size >& modalities() const;
101 
103  // ===========================================================================
105  // ===========================================================================
108  virtual std::string toDot() const;
109 
111  private:
115 
119  const PRMClassElement< GUM_SCALAR >& __get(NodeId id) const;
120 
121  const PRMClassElement< GUM_SCALAR >& __get(const std::string& name) const;
122 
125 
127 
128  void __init(const PRMInstance< GUM_SCALAR >& i);
129  };
130 
131 
132 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
133  extern template class InstanceBayesNet< double >;
134 #endif
135 
136 
137  } /* namespace prm */
138 } /* namespace gum */
139 
141 
142 #endif /* GUM_INSTANCE_BAYESNET_H */
aGrUM&#39;s Potential is a multi-dimensional array with tensor operators.
Definition: potential.h:57
virtual NodeId idFromName(const std::string &name) const
See gum::IBaseBayesNet::idFromName().
virtual const Potential< GUM_SCALAR > & cpt(NodeId varId) const
See gum::IBaseBayesNet::cpt().
virtual const VariableNodeMap & variableNodeMap() const
See gum::IBaseBayesNet::variableNodeMap().
virtual const DiscreteVariable & variable(NodeId id) const
See gum::IBaseBayesNet::variable().
An PRMInstance is a Bayesian Network fragment defined by a Class and used in a PRMSystem.
Definition: PRMInstance.h:60
const PRMClassElement< GUM_SCALAR > & __get(NodeId id) const
Private getter with type checking in case the id is not a formal PRMAttribute<GUM_SCALAR>.
Container used to map discrete variables with nodes.
const NodeProperty< Size > & modalities() const
See gum::IBaseBayesNet::cpt().
virtual std::string toDot() const
Abstract class representing an element of PRM class.
Headers of PRM.
Class representing Bayesian networks.
InstanceBayesNet(const PRMInstance< GUM_SCALAR > &i)
Default constructor.
Base class for discrete random variable.
virtual const DiscreteVariable & variableFromName(const std::string &name) const
See gum::IBaseBayesNet::variableFromName().
Class representing the minimal interface for Bayesian Network.
Definition: IBayesNet.h:59
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
HashTable< const DiscreteVariable *, const PRMAttribute< GUM_SCALAR > *> __varNodeMap
Mapping between DiscreteVariable and their NodeId.
The class for generic Hash Tables.
Definition: hashTable.h:676
NodeProperty< Size > __modalities
const PRMInstance< GUM_SCALAR > * __inst
The PRMClassElementContainer decorated by this.
virtual NodeId nodeId(const DiscreteVariable &var) const
See gum::IBaseBayesNet::nodeId().
InstanceBayesNet & operator=(const InstanceBayesNet &from)
Copy operator.
virtual ~InstanceBayesNet()
Destructor.
void __init(const PRMInstance< GUM_SCALAR > &i)
This class decorates an PRMInstance<GUM_SCALAR> as an IBaseBayesNet.
Inline implementation of InstanceBayesNet.
Size NodeId
Type for node ids.
Definition: graphElements.h:97