57 template <
typename GUM_SCALAR,
template <
typename >
class ICPTGenerator >
75 template <
typename GUM_SCALAR,
template <
typename >
class ICPTGenerator >
81 template <
typename GUM_SCALAR,
template <
typename >
class ICPTGenerator >
83 for (
auto node: bn.nodes())
84 this->generateCPT(bn.cpt(node).pos(bn.variable(node)), bn.cpt(node));
87 template <
typename GUM_SCALAR,
template <
typename >
class ICPTGenerator >
92 template <
typename GUM_SCALAR,
template <
typename >
class ICPTGenerator >
97 template <
typename GUM_SCALAR,
template <
typename >
class ICPTGenerator >
102 template <
typename GUM_SCALAR,
template <
typename >
class ICPTGenerator >
110 template < typename GUM_SCALAR, template < typename > class ICPTGenerator >
118 template <
typename GUM_SCALAR,
template <
typename >
class ICPTGenerator >
126 template < typename GUM_SCALAR, template < typename > class ICPTGenerator >
130 const auto width = (this->
dag_.size() >= 100) ? 3 : 2;
132 const auto& topo = this->
dag_.topologicalOrder();
133 for (
const auto node: topo) {
134 std::stringstream strBuff;
135 strBuff <<
"X" << std::setfill(
'0') << std::setw(width) << n++;
139 bn.beginTopologyTransformation();
140 for (
auto arc: this->dag_.arcs()) {
141 bn.addArc(arc.tail(), arc.head());
143 bn.endTopologyTransformation();
Interface-like class for generating Bayesian networks.
Class representing a Bayesian network.
void setMaxArcs(Size maxArcs)
Modifies the value of the number of nodes imposed on the BayesGenerator.
void setNbrNodes(Size nbrNodes)
Modifies the value of the number of nodes imposed on the BayesGenerator.
void fromDAG(BayesNet< GUM_SCALAR > &bayesNet)
Virtual function that Generates a Bayesian networks.
Size maxModality() const
Return a constant reference to the maximum modality imposed on the IBayesNetGenerator.
void setMaxModality(Size maxModality)
Modifies the value of the number of nodes imposed on the BayesGenerator.
Size nbrNodes() const
Return a constant reference to the number of nodes imposed on the IBayesNetGenerator.
void fillCPT(BayesNet< GUM_SCALAR > &bn) const
function that insert random values in the CPT of each nodes according to the CPTGenerator.
virtual ~IBayesNetGenerator()
Destructor.
Size maxArcs() const
Return a constant reference to the maximum number of arcs imposed on the IBayesNetGenerator.
IBayesNetGenerator(Size nbrNodes, Size maxArcs, Size maxModality)
constructor.
Exception : operation not allowed.
Defines a discrete random variable over an integer interval.
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
gum is the global namespace for all aGrUM entities
Header of gumRangeVariable.