aGrUM  0.16.0
maxParentsMCBayesNetGenerator_tpl.h
Go to the documentation of this file.
1 
31 
32 namespace gum {
33 
34 #ifdef _MSC_VER
35 # define MCBG MCBayesNetGenerator
36 #else
37 # define MCBG MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >
38 #endif
39 
40  // Default constructor.
41  // Use the SimpleCPTGenerator for generating the BNs CPT.
42  template < typename GUM_SCALAR,
43  template < class >
44  class ICPTGenerator,
45  template < class >
46  class ICPTDisturber >
47  INLINE
50  Size maxArcs,
51  Size maxModality,
52  Size maxParents,
53  Idx iteration,
54  Idx p,
55  Idx q) :
56  MCBG(nbrNodes, maxArcs, maxModality, iteration, p, q) {
57  if (maxParents == 0)
59  "maxParents must be at least equal to 1 to have a connexe graph");
60 
62  GUM_CONSTRUCTOR(MaxParentsMCBayesNetGenerator);
63  }
64 
65  template < typename GUM_SCALAR,
66  template < class >
67  class ICPTGenerator,
68  template < class >
69  class ICPTDisturber >
70  INLINE
74  Idx iteration,
75  Idx p,
76  Idx q) :
77  MCBG(bayesNet, iteration, p, q) {
79  GUM_CONSTRUCTOR(MaxParentsMCBayesNetGenerator);
80  }
81 
82  // Destructor.
83  template < typename GUM_SCALAR,
84  template < class >
85  class ICPTGenerator,
86  template < class >
87  class ICPTDisturber >
88  INLINE
91  GUM_DESTRUCTOR(MaxParentsMCBayesNetGenerator);
92  }
93 
94  template < typename GUM_SCALAR,
95  template < class >
96  class ICPTGenerator,
97  template < class >
98  class ICPTDisturber >
101  for (auto node : this->_bayesNet.nodes())
102  if (this->_bayesNet.parents(node).size() > _maxParents) return false;
103 
104  return MCBG::__checkConditions();
105  }
106 
107  template < typename GUM_SCALAR,
108  template < class >
109  class ICPTGenerator,
110  template < class >
111  class ICPTDisturber >
112  INLINE Size MaxParentsMCBayesNetGenerator< GUM_SCALAR,
113  ICPTGenerator,
114  ICPTDisturber >::maxParents() const {
115  return _maxParents;
116  }
117  template < typename GUM_SCALAR,
118  template < class >
119  class ICPTGenerator,
120  template < class >
121  class ICPTDisturber >
122  INLINE void
125  if (maxParents == 0)
127  "maxParents must be at least equal to 1 to have a connexe graph");
128 
130  }
131 } /* namespace gum */
Class representing a Bayesian Network.
Definition: BayesNet.h:78
<agrum/BN/generator/SimpleMCayesNetGenerator.h>
Idx q() const
Return a constant reference to the probabilité imposed on the Markov Chain BayesNetGenerator.
void setMaxParents(Size maxParents)
Modifies the value of the number of maximum parents imposed on the BayesNetGenerator.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
BayesNet< GUM_SCALAR > _bayesNet
bool __checkConditions() final
function to holding the the specification wanted for the Bayesian markov.
MaxParentsMCBayesNetGenerator(Size nbrNodes, Size maxArcs, Size maxModality=2, Size maxParents=1, Idx iteration=5000, Idx p=30, Idx q=40)
Constructor.
Size maxParents() const
Return a constant reference to the number of maximum parents imposed on the Markov Chain BayesNetGene...
Size Idx
Type for indexes.
Definition: types.h:53
Size iteration() const
Return a constant reference to the number of iteration imposed on the Markov Chain BayesNetGenerator...
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Idx p() const
Return a constant reference to the probabilité p imposed on the Markov Chain BayesNetGenerator.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55