30 #ifndef GUM_MARKOV_NET_H 31 #define GUM_MARKOV_NET_H 70 template <
typename GUM_SCALAR >
71 class MarkovNet:
public IMarkovNet< GUM_SCALAR > {
95 static MarkovNet< GUM_SCALAR > fastPrototype(
const std::string& dotlike,
113 explicit MarkovNet(std::string name);
118 virtual ~MarkovNet() final;
123 MarkovNet(const MarkovNet< GUM_SCALAR >& source);
137 MarkovNet< GUM_SCALAR >& operator=(const MarkovNet< GUM_SCALAR >& source);
152 virtual const Potential< GUM_SCALAR >&
153 factor(const
NodeSet& varIds) const final;
159 virtual const
FactorTable<GUM_SCALAR>& factors() const final;
166 virtual const VariableNodeMap& variableNodeMap() const final;
182 NodeId add(const DiscreteVariable& var);
195 NodeId add(const
std::
string& name,
unsigned int nbrmod);
231 NodeId add(const DiscreteVariable& var,
232 MultiDimImplementation< GUM_SCALAR >* aContent,
255 void erase(const
std::
string& name) { erase(idFromName(name)); };
267 void erase(
const DiscreteVariable& var);
279 const DiscreteVariable& variable(
NodeId id)
const final;
287 const DiscreteVariable& variable(
const std::string& name)
const {
288 return variable(idFromName(name));
300 void changeVariableName(
NodeId id,
const std::string& new_name);
305 void changeVariableName(
const std::string& name,
const std::string& new_name) {
306 changeVariableName(idFromName(name), new_name);
319 void changeVariableLabel(
NodeId id,
320 const std::string& old_label,
321 const std::string& new_label);
326 void changeVariableLabel(
const std::string& name,
327 const std::string& old_label,
328 const std::string& new_label) {
329 changeVariableLabel(idFromName(name), old_label, new_label);
340 NodeId nodeId(
const DiscreteVariable& var)
const final;
350 NodeId idFromName(
const std::string& name)
const final;
361 const DiscreteVariable& variableFromName(
const std::string& name)
const final;
379 const Potential< GUM_SCALAR >& addFactor(
const NodeSet& vars);
380 const Potential< GUM_SCALAR >&
381 addFactor(
const std::vector< std::string >& varnames);
382 const Potential< GUM_SCALAR >&
383 addFactor(
const Potential<GUM_SCALAR>& factor);
390 void eraseFactor(
const NodeSet& vars);
395 void generateFactors()
const;
398 void generateFactor(
const NodeSet& vars)
const;
404 void changeFactor(
const NodeSet& vars, Potential< GUM_SCALAR >* newPot);
408 void __clearFactors();
411 void __copyFactors(
const MarkovNet< GUM_SCALAR >& source);
414 VariableNodeMap __varMap;
417 FactorTable<GUM_SCALAR> __factors;
426 void _unsafeChangePotential(
const NodeSet& vars,
427 Potential< GUM_SCALAR >* newPot);
437 template <
typename GUM_SCALAR >
438 std::ostream&
operator<<(std::ostream& output,
439 const MarkovNet< GUM_SCALAR >& bn);
442 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 443 extern template class MarkovNet< double >;
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
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.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
double log10DomainSize() const
std::ostream & operator<<(std::ostream &output, const BayesNet< GUM_SCALAR > &bn)
Prints map's DAG in output using the Graphviz-dot format.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
const NodeGraphPart & nodes() const
Returns a constant reference to the dag of this Bayes Net.
const UndiGraph & graph() const
Returns a constant reference to the dag of this Bayes Net.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Size NodeId
Type for node ids.
virtual Size size() const final
Returns the number of variables in this Directed Graphical Model.
HashTable< NodeSet, const Potential< GUM_SCALAR > *> FactorTable