aGrUM  0.17.2
a C++ library for (probabilistic) graphical models
IMarkovNet.h
Go to the documentation of this file.
1 
30 #ifndef GUM_SIMPLE_MARKOV_NET_H
31 #define GUM_SIMPLE_MARKOV_NET_H
32 
33 #include <utility>
34 
35 #include <agrum/agrum.h>
36 
38 
41 
42 namespace gum {
43  template < typename GUM_SCALAR >
45 
46  // template < typename GUM_SCALAR >
47  // class MarkovNetFactory;
48 
63  template < typename GUM_SCALAR >
64  class IMarkovNet: public UGmodel {
65  public:
66  // ===========================================================================
68  // ===========================================================================
70 
74  IMarkovNet();
75  explicit IMarkovNet(std::string name);
76 
80  virtual ~IMarkovNet();
81 
85  IMarkovNet(const IMarkovNet< GUM_SCALAR >& source);
86 
91 
93 
94 
95  // ===========================================================================
97  // ===========================================================================
99 
105  virtual const Potential< GUM_SCALAR >& factor(const NodeSet& varIds) const = 0;
110  virtual const FactorTable< GUM_SCALAR >& factors() const = 0;
111 
115  virtual const VariableNodeMap& variableNodeMap() const = 0;
116 
122  virtual const DiscreteVariable& variable(NodeId id) const = 0;
123 
129  virtual NodeId nodeId(const DiscreteVariable& var) const = 0;
130 
136  virtual NodeId idFromName(const std::string& name) const = 0;
137 
143  virtual const DiscreteVariable&
144  variableFromName(const std::string& name) const = 0;
146 
154  bool operator==(const IMarkovNet< GUM_SCALAR >& from) const;
155 
157  bool operator!=(const IMarkovNet< GUM_SCALAR >& from) const;
158 
166  Size dim() const;
167 
173  Size maxVarDomainSize() const;
174 
179  GUM_SCALAR minParam() const;
180 
185  GUM_SCALAR maxParam() const;
186 
191  GUM_SCALAR minNonZeroParam() const;
192 
197  GUM_SCALAR maxNonOneParam() const;
198 
200  virtual std::string toDot() const;
201 
203  std::string toString() const;
204  };
205 
206 
207 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
208  extern template class IMarkovNet< double >;
209 #endif
210 
211 
213  template < typename GUM_SCALAR >
214  std::ostream& operator<<(std::ostream& output,
215  const IMarkovNet< GUM_SCALAR >& mn);
216 
217 } /* namespace gum */
218 
219 #include <agrum/MN/IMarkovNet_tpl.h>
220 
221 #endif /* GUM_SIMPLE_MARKOV_NET_H */
virtual const DiscreteVariable & variableFromName(const std::string &name) const =0
Getter by name.
aGrUM&#39;s Potential is a multi-dimensional array with tensor operators.
Definition: potential.h:60
GUM_SCALAR minNonZeroParam() const
virtual const VariableNodeMap & variableNodeMap() const =0
Returns a constant reference to the VariableNodeMap of thisBN.
virtual ~IMarkovNet()
Destructor.
GUM_SCALAR maxNonOneParam() const
virtual NodeId idFromName(const std::string &name) const =0
Getter by name.
Container used to map discrete variables with nodes.
Base class for discrete random variable.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:679
Virtual base class for PGMs using a undirected graph.
Definition: UGmodel.h:46
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variable given it&#39;s node id.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
std::ostream & operator<<(std::ostream &output, const BayesNet< GUM_SCALAR > &bn)
Prints map&#39;s DAG in output using the Graphviz-dot format.
Definition: BayesNet_tpl.h:626
virtual std::string toDot() const
virtual const FactorTable< GUM_SCALAR > & factors() const =0
Returns the set of factors as a IMarkovNet::FactorTable.
IMarkovNet()
Default constructor.
IMarkovNet< GUM_SCALAR > & operator=(const IMarkovNet< GUM_SCALAR > &source)
Copy operator.
bool operator!=(const IMarkovNet< GUM_SCALAR > &from) const
GUM_SCALAR minParam() const
Size maxVarDomainSize() const
virtual NodeId nodeId(const DiscreteVariable &var) const =0
Return id node from discrete var pointer.
std::string toString() const
Size dim() const
Returns the dimension (the number of free parameters) in this bayes net.
Class representing the minimal interface for Bayesian Network.
Definition: IMarkovNet.h:64
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
GUM_SCALAR maxParam() const
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Size NodeId
Type for node ids.
Definition: graphElements.h:98
virtual const Potential< GUM_SCALAR > & factor(const NodeSet &varIds) const =0
Returns the factor of a set of variable.
bool operator==(const IMarkovNet< GUM_SCALAR > &from) const
This operator compares 2 BNs !