aGrUM  0.14.2
gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber > Class Template Reference

<agrum/BN/generator/MCayesNetGenerator.h> More...

#include <MCBayesNetGenerator.h>

+ Inheritance diagram for gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >:
+ Collaboration diagram for gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >:

Public Member Functions

Constructors / Destructor
 MCBayesNetGenerator (Size nbrNodes, Size maxArcs, Idx maxModality=2, Size iteration=5000, Idx p=30, Idx q=40)
 Constructor. More...
 
 MCBayesNetGenerator (BayesNet< GUM_SCALAR > bayesNet, Size iteration=5000, Idx p=30, Idx q=40)
 Constructor. More...
 
 ~MCBayesNetGenerator () override
 Destructor. More...
 
BN generation methods
void generateBN (BayesNet< GUM_SCALAR > &bayesNet) override
 Generates a random bayesian network. More...
 
void disturbBN (BayesNet< GUM_SCALAR > &bayesNetinit, Size iteration=0)
 Change randomly the topology of a specific bayesian networks. More...
 
Getters
Size iteration () const
 Return a constant reference to the number of iteration imposed on the Markov Chain BayesNetGenerator. More...
 
Idx p () const
 Return a constant reference to the probabilité p imposed on the Markov Chain BayesNetGenerator. More...
 
Idx q () const
 Return a constant reference to the probabilité imposed on the Markov Chain BayesNetGenerator. More...
 
Setters
void setIteration (Size iteration)
 Modifies the value of the number of iterations impose on the BayesNetGenerator. More...
 
void setP (Idx p)
 Modifies the value of the probability p imposed on the BayesNetGenerator. More...
 
void setQ (Idx q)
 Modifies the value of the probability q imposed on the BayesNetGenerator. More...
 
BN generation methods
void fillCPT ()
 function that insert random values in the CPT of each nodes according to the CPTGenerator. More...
 
Getters
Size nbrNodes () const
 Return a constant reference to the number of nodes imposed on the IBayesNetGenerator. More...
 
Size maxArcs () const
 Return a constant reference to the maximum number of arcs imposed on the IBayesNetGenerator. More...
 
Size maxModality () const
 Return a constant reference to the maximum modality imposed on the IBayesNetGenerator. More...
 
Setters
void setNbrNodes (Size nbrNodes)
 Modifies the value of the number of nodes imposed on the BayesGenerator. More...
 
void setMaxArcs (Size maxArcs)
 Modifies the value of the number of nodes imposed on the BayesGenerator. More...
 
void setMaxModality (Size maxModality)
 Modifies the value of the number of nodes imposed on the BayesGenerator. More...
 

Protected Attributes

Size _iteration
 
Idx _p
 
Idx _q
 
bool _disturbing
 
BayesNet< GUM_SCALAR > _bayesNettemp
 
HashTable< NodeId, Potential< GUM_SCALAR > *> _hashMarginal
 
Size _nbrNodes
 
Size _maxArcs
 
Size _maxModality
 
BayesNet< GUM_SCALAR > _bayesNet
 

Protected Member Functions

bool __isPolytree ()
 The function that verify if graph is a polytree. More...
 
bool __connect (NodeId i, NodeId j)
 The function that verify if node i and j are connected. More...
 
bool __directedPath (NodeId tail, NodeId head)
 The function that verify if there is a oriented path from node i to node j. More...
 
void __insertArc (NodeId i, NodeId j)
 The function that will insert an arc between node i to node j, but only if there isn't any cycle created. More...
 
void __eraseArc (NodeId i, NodeId j, bool mustbeconnex=true)
 The function that will remove the arc between node i and node j. More...
 
void __PMMx_poly ()
 In the case that the graph is a polytree, the function will, according to the probability p and q, choose which change of state must occure( AorR or AR or jump) then will assert that the imposed constraint are respected and if not, will return to the previous topology. More...
 
void __PMMx_multi ()
 In the case that the graph is a multiconnected graph, the function will, according to the probability p and q, choose which change of state must occure( AorR or jump) then will assert that the imposed constraint are respected and if not, will return to the previous topology. More...
 
void __jump_poly ()
 In the case that the graph is a polytree, the function will add a ramdom arc by the use of the function __insertArc if the arc does not exist allready. More...
 
void __jump_multi ()
 In the case that the graph is a multiconnect graph, the function will choose randomly two nodes and will remove the arc between them by the use of the function __insertArc if the arc exists. More...
 
void __AorR ()
 The function will add or remove a random arc in the graph using the functions __insertArc and __removeArc. More...
 
void __AR ()
 The function will remove and add a random arc changing the topology of the graph but asserting its connectivity. More...
 
virtual bool __checkConditions ()
 The boolean function that will assert the respect of the constraint. More...
 
bool __connect (NodeId i, NodeId j, NodeSet &excluded)
 The internal function used by the previous __connect. More...
 
bool __directedPath (NodeId tail, NodeId head, NodeSet &excluded)
 The internal function used by the previous __directedPath. More...
 
void __chooseNodes (NodeId &i, NodeId &j)
 The function that randomly choose two nodes of the graph. More...
 
void __chooseCloseNodes (NodeId &i, NodeId &j)
 The function that randomly choose two neighbours nodes of the graph. More...
 
void __transformPoly (Idx nbiter)
 The function that randomly change the simple tree into a polytree. More...
 
void __createTree (Size BNSize)
 The function that randomly generate a simple tree. More...
 
NodeId __createPartTree (Size BNSize, Idx &n)
 The internal function used by __createTree that randomly generate a simple tree. More...
 

Detailed Description

template<typename GUM_SCALAR, template< typename > class ICPTGenerator = SimpleCPTGenerator, template< typename > class ICPTDisturber = SimpleCPTDisturber>
class gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >

<agrum/BN/generator/MCayesNetGenerator.h>

Class for generating bayesian networks with Markov chains.

This class randomly generates a bayesian network given 6 parameters: the number of nodes, the maximum number of arcs the and of iterations the maximum modality.

Warning
Be Careful when entering the parameters, high Values may cause the density of the Bayesian Network to be too high resulting in the failure of most of the inference Methods.

This Generation method require the use of two probability parameters(p, q) defining the choice of processes that will provoke the change of state. You can see in the graph below how the probabilities are used.

Definition at line 157 of file MCBayesNetGenerator.h.

Constructor & Destructor Documentation

◆ MCBayesNetGenerator() [1/2]

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::MCBayesNetGenerator ( Size  nbrNodes,
Size  maxArcs,
Idx  maxModality = 2,
Size  iteration = 5000,
Idx  p = 30,
Idx  q = 40 
)

Constructor.

Use by default the SimpleCPTGenerator for generating the BNs CPT and the SimpleCPTDisturber to tweak the CPT when the dimension of the table changes.

Parameters
nbrNodesThe number of nodes in the generated BN.
maxArcsThe maximum number of Arcs.
maxModalityEach DRV has from 2 to maxModality modalities
iterationThe number of iterations wanted to repeat the algorithm
pprobability for the change of the state (see use of p and q )
qprobability for the change of the state (see use of p and q )

Definition at line 56 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_disturbing, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_iteration, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_p, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_q, GUM_ERROR, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::iteration(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::p(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::q().

Referenced by gum::getMaxModality().

61  :
62  IBNG(nbrNodes, maxArcs, maxModality),
64  if (p + q > 100)
65  GUM_ERROR(
66  OperationNotAllowed,
67  "the sum of the probabilities p and q must be at most equal to 100");
68 
70  _p = p;
71  _q = q;
72  _disturbing = false;
73 
74  GUM_CONSTRUCTOR(MCBayesNetGenerator);
75  }
MCBayesNetGenerator(Size nbrNodes, Size maxArcs, Idx maxModality=2, Size iteration=5000, Idx p=30, Idx q=40)
Constructor.
Idx q() const
Return a constant reference to the probabilité imposed on the Markov Chain BayesNetGenerator.
Size nbrNodes() const
Return a constant reference to the number of nodes imposed on the IBayesNetGenerator.
#define IBNG
Size maxArcs() const
Return a constant reference to the maximum number of arcs imposed on the IBayesNetGenerator.
BayesNet< GUM_SCALAR > _bayesNettemp
Size iteration() const
Return a constant reference to the number of iteration imposed on the Markov Chain BayesNetGenerator...
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:52
HashTable< NodeId, Potential< GUM_SCALAR > *> _hashMarginal
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MCBayesNetGenerator() [2/2]

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::MCBayesNetGenerator ( BayesNet< GUM_SCALAR >  bayesNet,
Size  iteration = 5000,
Idx  p = 30,
Idx  q = 40 
)
explicit

Constructor.

Use by default the SimpleCPTGenerator for generating the BNs CPT and the SimpleCPTDisturber to tweak the CPT when the dimension of the table changes.

Parameters
bayesNetthe IBayesNet used as reference to fill the parameters nbrNodes, maxArcs and maxModality
iterationThe number of iterations wanted to repeat the algorithm
pprobability for the change of the state (see probability_p_q )
qprobability for the change of the state (see probability_p_q )

Definition at line 83 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_disturbing, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_iteration, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_p, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_q, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::iteration(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::p(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::q(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::~MCBayesNetGenerator().

86  :
87  MCBayesNetGenerator(bayesNet.size(),
88  (Size)(bayesNet.sizeArcs() * 1.1),
89  getMaxModality(bayesNet)) {
91  _p = p;
92  _q = q;
93  _disturbing = false;
94  }
MCBayesNetGenerator(Size nbrNodes, Size maxArcs, Idx maxModality=2, Size iteration=5000, Idx p=30, Idx q=40)
Constructor.
Idx q() const
Return a constant reference to the probabilité imposed on the Markov Chain BayesNetGenerator.
gum::Size getMaxModality(gum::BayesNet< GUM_SCALAR > &bayesNet)
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:45
Idx p() const
Return a constant reference to the probabilité p imposed on the Markov Chain BayesNetGenerator.
+ Here is the call graph for this function:

◆ ~MCBayesNetGenerator()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::~MCBayesNetGenerator ( )
override

Destructor.

Definition at line 103 of file MCBayesNetGenerator_tpl.h.

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::MCBayesNetGenerator().

103  {
104  GUM_DESTRUCTOR(MCBayesNetGenerator);
105  }
MCBayesNetGenerator(Size nbrNodes, Size maxArcs, Idx maxModality=2, Size iteration=5000, Idx p=30, Idx q=40)
Constructor.
+ Here is the caller graph for this function:

Member Function Documentation

◆ __AorR()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AorR ( )
protected

The function will add or remove a random arc in the graph using the functions __insertArc and __removeArc.

Definition at line 292 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseNodes(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__eraseArc(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__insertArc(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, and gum::ArcGraphPart::existsArc().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_multi(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_poly().

292  {
293  NodeId i, j;
294  __chooseNodes(i, j);
295  const DAG __dag = this->_bayesNet.dag();
296 
297  if (__dag.existsArc(i, j)) {
298  __eraseArc(i, j);
299 
300  return;
301  } else
302  __insertArc(i, j);
303  }
BayesNet< GUM_SCALAR > _bayesNet
void __chooseNodes(NodeId &i, NodeId &j)
The function that randomly choose two nodes of the graph.
void __insertArc(NodeId i, NodeId j)
The function that will insert an arc between node i to node j, but only if there isn&#39;t any cycle crea...
void __eraseArc(NodeId i, NodeId j, bool mustbeconnex=true)
The function that will remove the arc between node i and node j.
Size NodeId
Type for node ids.
Definition: graphElements.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __AR()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AR ( )
protected

The function will remove and add a random arc changing the topology of the graph but asserting its connectivity.

Definition at line 310 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseNodes(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__connect(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_poly(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::ArcGraphPart::children(), gum::ArcGraphPart::existsArc(), gum::Set< Key, Alloc >::insert(), gum::ArcGraphPart::parents(), and gum::randomValue().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_poly().

310  {
311  NodeId i, j, head, tail;
312  __chooseNodes(i, j);
313  const DAG __dag = this->_bayesNet.dag();
314 
315  if (__dag.existsArc(i, j) || __dag.existsArc(j, i)) {
316  return;
317  } else {
318  Idx per = randomValue(100);
319 
320  if (per < 50) {
321  head = i;
322  tail = j;
323  } else {
324  head = j;
325  tail = i;
326  }
327 
328  for (auto node : __dag.parents(j)) {
329  NodeSet excluded;
330  excluded.insert(j);
331 
332  if (__connect(node, i, excluded)) {
333  this->_bayesNet.eraseArc(node, j); // TODO reflect
334  this->_bayesNet.addArc(head, tail);
335  return;
336  }
337  }
338 
339  for (auto node : __dag.children(j)) {
340  NodeSet excluded;
341  excluded.insert(j);
342 
343  if (__connect(node, i, excluded)) {
344  this->_bayesNet.eraseArc(j, node);
345  this->_bayesNet.addArc(head, tail);
346  return;
347  }
348  }
349  }
350  }
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
bool __connect(NodeId i, NodeId j)
The function that verify if node i and j are connected.
BayesNet< GUM_SCALAR > _bayesNet
void __chooseNodes(NodeId &i, NodeId &j)
The function that randomly choose two nodes of the graph.
Size NodeId
Type for node ids.
Definition: graphElements.h:97
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:610
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __checkConditions()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE bool gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__checkConditions ( )
protectedvirtual

The boolean function that will assert the respect of the constraint.

Reimplemented in gum::MaxParentsMCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >, and gum::MaxInducedWidthMCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >.

Definition at line 185 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_poly(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, and gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_maxArcs.

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_multi(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_poly(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__transformPoly(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN().

185  {
186  return this->_maxArcs >= this->_bayesNet.sizeArcs();
187  }
BayesNet< GUM_SCALAR > _bayesNet
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __chooseCloseNodes()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseCloseNodes ( NodeId i,
NodeId j 
)
protected

The function that randomly choose two neighbours nodes of the graph.

Definition at line 446 of file MCBayesNetGenerator_tpl.h.

References gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, GUM_ERROR, and gum::randomValue().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseNodes(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__transformPoly().

446  {
447  NodeId temp = randomValue(this->_bayesNet.size());
448  Size co = 0;
449 
450  if (this->_bayesNet.parents(temp).size()) {
451  j = temp;
452  auto it = this->_bayesNet.parents(j).begin();
453  co = randomValue(this->_bayesNet.parents(j).size());
454 
455  while (co--) {
456  ++it;
457  }
458 
459  i = *it;
460  } else if (this->_bayesNet.children(temp).size()) {
461  i = temp;
462  auto it = this->_bayesNet.children(i).begin();
463  co = randomValue(this->_bayesNet.children(i).size());
464 
465  while (co--) {
466  ++it;
467  }
468 
469  j = *it;
470  } else {
471  GUM_ERROR(FatalError, "Sorry Misconstructed BN because of isolated node.");
472  }
473  }
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
BayesNet< GUM_SCALAR > _bayesNet
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
Size NodeId
Type for node ids.
Definition: graphElements.h:97
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __chooseNodes()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseNodes ( NodeId i,
NodeId j 
)
protected

The function that randomly choose two nodes of the graph.

Definition at line 432 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseCloseNodes(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, and gum::randomValue().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AorR(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AR(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__eraseArc(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_multi(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_poly().

432  {
433  i = randomValue(this->_bayesNet.size());
434  j = randomValue(this->_bayesNet.size());
435 
436  while (i == j)
437  j = randomValue(this->_bayesNet.size());
438  }
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
BayesNet< GUM_SCALAR > _bayesNet
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __connect() [1/2]

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
bool gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__connect ( NodeId  i,
NodeId  j 
)
protected

The function that verify if node i and j are connected.

Definition at line 560 of file MCBayesNetGenerator_tpl.h.

References gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::ArcGraphPart::children(), gum::Set< Key, Alloc >::exists(), gum::ArcGraphPart::existsArc(), gum::Set< Key, Alloc >::insert(), and gum::ArcGraphPart::parents().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AR(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__connect(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__eraseArc().

561  {
562  const DAG __dag = this->_bayesNet.dag();
563 
564  if (__dag.existsArc(i, j) || __dag.existsArc(j, i))
565  return true;
566  else {
567  NodeSet excluded;
568  excluded.insert(i);
569 
570  for (auto par : __dag.parents(i)) {
571  if (!excluded.exists(par) && __connect(par, j, excluded)) return true;
572  }
573 
574  for (auto chi : __dag.children(i)) {
575  if (!excluded.exists(chi) && __connect(chi, j, excluded)) return true;
576  }
577 
578  return false;
579  }
580  }
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
bool __connect(NodeId i, NodeId j)
The function that verify if node i and j are connected.
BayesNet< GUM_SCALAR > _bayesNet
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:610
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __connect() [2/2]

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
bool gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__connect ( NodeId  i,
NodeId  j,
NodeSet excluded 
)
protected

The internal function used by the previous __connect.

It asserts the existence of an unoriented path between node i and node j avoiding passing through nodes listed in excluded.

Definition at line 587 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__connect(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__directedPath(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::ArcGraphPart::children(), gum::Set< Key, Alloc >::exists(), gum::ArcGraphPart::existsArc(), gum::Set< Key, Alloc >::insert(), and gum::ArcGraphPart::parents().

588  {
589  const DAG __dag = this->_bayesNet.dag();
590 
591  if (__dag.existsArc(i, j) || __dag.existsArc(j, i))
592  return true;
593  else {
594  excluded.insert(i);
595 
596  for (auto par : __dag.parents(i)) {
597  if (!excluded.exists(par) && __connect(par, j, excluded)) return true;
598  }
599 
600  for (auto chi : __dag.children(i)) {
601  if (!excluded.exists(chi) && __connect(chi, j, excluded)) return true;
602  }
603 
604  return false;
605  }
606  }
bool __connect(NodeId i, NodeId j)
The function that verify if node i and j are connected.
BayesNet< GUM_SCALAR > _bayesNet
+ Here is the call graph for this function:

◆ __createPartTree()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
NodeId gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__createPartTree ( Size  BNSize,
Idx n 
)
protected

The internal function used by __createTree that randomly generate a simple tree.

n : id number for node label

Definition at line 506 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__transformPoly(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_maxModality, and gum::randomValue().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__createTree().

506  {
507  Size nb_mod = 2 + randomValue(this->_maxModality - 1);
508  std::stringstream strBuff;
509  strBuff << "n_" << n++;
510  NodeId root =
511  this->_bayesNet.add(LabelizedVariable(strBuff.str(), "", nb_mod));
512  Size maxNodes = BNSize - 1;
513  Size SubG = 0;
514 
515  while (maxNodes) {
516  SubG = randomValue(maxNodes) + 1;
517  maxNodes = maxNodes - SubG;
518  NodeId rootS = __createPartTree(SubG, n);
519  this->_bayesNet.addArc(root, rootS);
520  }
521 
522  return root;
523  }
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
BayesNet< GUM_SCALAR > _bayesNet
NodeId __createPartTree(Size BNSize, Idx &n)
The internal function used by __createTree that randomly generate a simple tree.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
Size NodeId
Type for node ids.
Definition: graphElements.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __createTree()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__createTree ( Size  BNSize)
protected

The function that randomly generate a simple tree.

Definition at line 481 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__createPartTree(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_maxModality, and gum::randomValue().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::generateBN().

482  {
483  Idx n = 0;
484  Size nb_mod = 2 + randomValue(this->_maxModality - 1);
485  std::stringstream strBuff;
486  strBuff << "n_" << n++;
487  NodeId root =
488  this->_bayesNet.add(LabelizedVariable(strBuff.str(), "", nb_mod));
489  Size maxNodes = BNSize - 1;
490  Size SubG = 0;
491 
492  while (maxNodes) {
493  SubG = randomValue(maxNodes) + 1;
494  maxNodes = maxNodes - SubG;
495  NodeId rootS = __createPartTree(SubG, n);
496  this->_bayesNet.addArc(root, rootS);
497  }
498  }
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
BayesNet< GUM_SCALAR > _bayesNet
NodeId __createPartTree(Size BNSize, Idx &n)
The internal function used by __createTree that randomly generate a simple tree.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
Size NodeId
Type for node ids.
Definition: graphElements.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __directedPath() [1/2]

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
bool gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__directedPath ( NodeId  tail,
NodeId  head 
)
protected

The function that verify if there is a oriented path from node i to node j.

Definition at line 614 of file MCBayesNetGenerator_tpl.h.

References gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::ArcGraphPart::children(), gum::ArcGraphPart::existsArc(), and gum::Set< Key, Alloc >::insert().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__connect(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__directedPath(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__insertArc().

614  {
615  const DAG __dag = this->_bayesNet.dag();
616 
617  if (__dag.existsArc(tail, head))
618  return true;
619  else {
620  NodeSet excluded;
621  excluded.insert(tail);
622 
623  for (auto node : __dag.children(tail)) {
624  if (__directedPath(node, head, excluded)) return true;
625  }
626 
627  return false;
628  }
629  }
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
BayesNet< GUM_SCALAR > _bayesNet
bool __directedPath(NodeId tail, NodeId head)
The function that verify if there is a oriented path from node i to node j.
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:610
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __directedPath() [2/2]

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
bool gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__directedPath ( NodeId  tail,
NodeId  head,
NodeSet excluded 
)
protected

The internal function used by the previous __directedPath.

It asserts the existence of an oriented path between node i and node j avoiding passing through nodes listed in excluded.

Definition at line 637 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__directedPath(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::ArcGraphPart::children(), gum::Set< Key, Alloc >::exists(), gum::ArcGraphPart::existsArc(), and gum::Set< Key, Alloc >::insert().

637  {
638  const DAG __dag = this->_bayesNet.dag();
639 
640  if (__dag.existsArc(tail, head))
641  return true;
642  else {
643  excluded.insert(tail);
644 
645  for (auto node : __dag.children(tail)) {
646  if (!excluded.exists(node) && __directedPath(node, head, excluded))
647  return true;
648  }
649 
650  return false;
651  }
652  }
BayesNet< GUM_SCALAR > _bayesNet
bool __directedPath(NodeId tail, NodeId head)
The function that verify if there is a oriented path from node i to node j.
+ Here is the call graph for this function:

◆ __eraseArc()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__eraseArc ( NodeId  i,
NodeId  j,
bool  mustbeconnex = true 
)
protected

The function that will remove the arc between node i and node j.

If the boolean parameter mustbeconnex is true, the function will assert that the graph remain connected and will restore the arc otherwise.

Definition at line 405 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseNodes(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__connect(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_disturbing, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_hashMarginal, and gum::MultiDimContainer< GUM_SCALAR >::copy().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AorR(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_multi(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__transformPoly().

406  {
407  if (_disturbing) {
408  const BayesNet< GUM_SCALAR > bayesNet(this->_bayesNet);
409  Potential< GUM_SCALAR > potj;
410  potj.copy(this->_bayesNet.cpt(j));
411  this->_bayesNet.eraseArc(i, j);
412 
413  if (__connect(i, j) || !mustbeconnex) {
414  auto marg = *_hashMarginal[i];
415 
416  this->disturbReducCPT(j, this->_bayesNet, potj, marg);
417  } else
418  this->_bayesNet.addArc(i, j);
419  } else {
420  this->_bayesNet.eraseArc(i, j);
421 
422  if (!__connect(i, j) && mustbeconnex) { this->_bayesNet.addArc(i, j); }
423  }
424  }
bool __connect(NodeId i, NodeId j)
The function that verify if node i and j are connected.
BayesNet< GUM_SCALAR > _bayesNet
HashTable< NodeId, Potential< GUM_SCALAR > *> _hashMarginal
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __insertArc()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__insertArc ( NodeId  i,
NodeId  j 
)
protected

The function that will insert an arc between node i to node j, but only if there isn't any cycle created.

Definition at line 386 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__directedPath(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_disturbing.

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AorR(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_poly().

387  {
388  if (__directedPath(j, i)) return;
389 
390  if (_disturbing) {
391  auto potj = this->_bayesNet.cpt(j);
392  this->_bayesNet.addArc(i, j);
393 
394  this->disturbAugmCPT(j, this->_bayesNet, potj, (GUM_SCALAR)0.5);
395  } else
396  this->_bayesNet.addArc(i, j);
397  }
BayesNet< GUM_SCALAR > _bayesNet
bool __directedPath(NodeId tail, NodeId head)
The function that verify if there is a oriented path from node i to node j.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __isPolytree()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE bool gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__isPolytree ( )
protected

The function that verify if graph is a polytree.

Definition at line 550 of file MCBayesNetGenerator_tpl.h.

References gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet.

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_multi(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__transformPoly(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN().

550  {
551  const DAG __dag = this->_bayesNet.dag();
552  return this->_bayesNet.size() - 1 == this->_bayesNet.sizeArcs();
553  }
BayesNet< GUM_SCALAR > _bayesNet
+ Here is the caller graph for this function:

◆ __jump_multi()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_multi ( )
protected

In the case that the graph is a multiconnect graph, the function will choose randomly two nodes and will remove the arc between them by the use of the function __insertArc if the arc exists.

Definition at line 372 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseNodes(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__eraseArc(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, and gum::ArcGraphPart::existsArc().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_poly(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_multi().

372  {
373  NodeId i, j;
374  __chooseNodes(i, j);
375  const DAG __dag = this->_bayesNet.dag();
376 
377  if (__dag.existsArc(i, j)) { __eraseArc(i, j); }
378  }
BayesNet< GUM_SCALAR > _bayesNet
void __chooseNodes(NodeId &i, NodeId &j)
The function that randomly choose two nodes of the graph.
void __eraseArc(NodeId i, NodeId j, bool mustbeconnex=true)
The function that will remove the arc between node i and node j.
Size NodeId
Type for node ids.
Definition: graphElements.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __jump_poly()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_poly ( )
protected

In the case that the graph is a polytree, the function will add a ramdom arc by the use of the function __insertArc if the arc does not exist allready.

Definition at line 358 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseNodes(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__insertArc(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_multi(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, and gum::ArcGraphPart::existsArc().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AR(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_poly().

358  {
359  NodeId i, j;
360  __chooseNodes(i, j);
361  const DAG __dag = this->_bayesNet.dag();
362 
363  if (!__dag.existsArc(i, j)) __insertArc(i, j);
364  }
BayesNet< GUM_SCALAR > _bayesNet
void __chooseNodes(NodeId &i, NodeId &j)
The function that randomly choose two nodes of the graph.
void __insertArc(NodeId i, NodeId j)
The function that will insert an arc between node i to node j, but only if there isn&#39;t any cycle crea...
Size NodeId
Type for node ids.
Definition: graphElements.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __PMMx_multi()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_multi ( )
protected

In the case that the graph is a multiconnected graph, the function will, according to the probability p and q, choose which change of state must occure( AorR or jump) then will assert that the imposed constraint are respected and if not, will return to the previous topology.

Definition at line 244 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AorR(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__checkConditions(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__isPolytree(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_multi(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_poly(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_bayesNettemp, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_iteration, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_p, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_q, and gum::randomValue().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_poly(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN().

244  {
245  if (!_iteration--) return;
246 
247  Idx per = randomValue(100);
248 
249  if (per < _p + _q) {
250  __AorR();
251 
252  if (__checkConditions()) {
253  if (__isPolytree()) {
254  if (per < _p) {
255  _bayesNettemp = this->_bayesNet;
256  __PMMx_poly();
257  } else {
258  this->_bayesNet = _bayesNettemp;
259  __PMMx_multi();
260  }
261  } else {
262  _bayesNettemp = this->_bayesNet;
263  __PMMx_multi();
264  }
265  } else {
266  this->_bayesNet = _bayesNettemp;
267  __PMMx_multi();
268  }
269  } else {
270  __jump_multi();
271 
272  if (__checkConditions()) {
273  _bayesNettemp = this->_bayesNet;
274 
275  if (__isPolytree())
276  __PMMx_poly();
277  else
278  __PMMx_multi(); // TODO verification required
279 
280  } else {
281  this->_bayesNet = _bayesNettemp;
282  __PMMx_multi();
283  }
284  }
285  }
virtual bool __checkConditions()
The boolean function that will assert the respect of the constraint.
void __PMMx_poly()
In the case that the graph is a polytree, the function will, according to the probability p and q...
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
void __jump_multi()
In the case that the graph is a multiconnect graph, the function will choose randomly two nodes and w...
bool __isPolytree()
The function that verify if graph is a polytree.
BayesNet< GUM_SCALAR > _bayesNet
BayesNet< GUM_SCALAR > _bayesNettemp
void __AorR()
The function will add or remove a random arc in the graph using the functions __insertArc and __remov...
void __PMMx_multi()
In the case that the graph is a multiconnected graph, the function will, according to the probability...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __PMMx_poly()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_poly ( )
protected

In the case that the graph is a polytree, the function will, according to the probability p and q, choose which change of state must occure( AorR or AR or jump) then will assert that the imposed constraint are respected and if not, will return to the previous topology.

Definition at line 198 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AorR(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AR(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__checkConditions(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_poly(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_multi(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_bayesNettemp, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_iteration, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_p, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_q, and gum::randomValue().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__checkConditions(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_multi(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::generateBN().

198  {
199  if (!_iteration--) return;
200 
201  Idx per = randomValue(100);
202 
203  if (per < _p) {
204  __AorR();
205 
206  if (__checkConditions()) {
207  _bayesNettemp = this->_bayesNet;
208  __PMMx_multi();
209  } else {
210  this->_bayesNet = _bayesNettemp;
211  __PMMx_poly();
212  }
213  } else {
214  if (per < _p + _q) {
215  __AR();
216 
217  if (!__checkConditions()) {
218  this->_bayesNet = _bayesNettemp;
219  } else
220  _bayesNettemp = this->_bayesNet;
221 
222  __PMMx_poly();
223  } else {
224  __jump_poly();
225 
226  if (__checkConditions()) {
227  _bayesNettemp = this->_bayesNet;
228  __PMMx_multi();
229 
230  } else {
231  this->_bayesNet = _bayesNettemp;
232  __PMMx_poly();
233  }
234  }
235  }
236  }
virtual bool __checkConditions()
The boolean function that will assert the respect of the constraint.
void __PMMx_poly()
In the case that the graph is a polytree, the function will, according to the probability p and q...
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
BayesNet< GUM_SCALAR > _bayesNet
BayesNet< GUM_SCALAR > _bayesNettemp
void __jump_poly()
In the case that the graph is a polytree, the function will add a ramdom arc by the use of the functi...
void __AR()
The function will remove and add a random arc changing the topology of the graph but asserting its co...
void __AorR()
The function will add or remove a random arc in the graph using the functions __insertArc and __remov...
void __PMMx_multi()
In the case that the graph is a multiconnected graph, the function will, according to the probability...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __transformPoly()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__transformPoly ( Idx  nbiter)
protected

The function that randomly change the simple tree into a polytree.

Definition at line 532 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__checkConditions(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseCloseNodes(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__eraseArc(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__isPolytree(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_bayesNettemp.

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__createPartTree(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::generateBN().

532  {
533  while (nbiter--) {
534  NodeId i, j;
535  __chooseCloseNodes(i, j);
536  _bayesNettemp = this->_bayesNet;
537  __eraseArc(i, j, false);
538  this->_bayesNet.addArc(j, i);
539 
540  if (!__checkConditions()) this->_bayesNet = _bayesNettemp;
541  }
542  }
virtual bool __checkConditions()
The boolean function that will assert the respect of the constraint.
BayesNet< GUM_SCALAR > _bayesNet
BayesNet< GUM_SCALAR > _bayesNettemp
void __eraseArc(NodeId i, NodeId j, bool mustbeconnex=true)
The function that will remove the arc between node i and node j.
void __chooseCloseNodes(NodeId &i, NodeId &j)
The function that randomly choose two neighbours nodes of the graph.
Size NodeId
Type for node ids.
Definition: graphElements.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disturbBN()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN ( BayesNet< GUM_SCALAR > &  bayesNetinit,
Size  iteration = 0 
)

Change randomly the topology of a specific bayesian networks.

Parameters
bayesNetinitIBayesNet to be modify
iterationThe number of iterations wanted to repeat the algorithm
Returns
null but modify inputed Bayesian Network
Exceptions
OperationNotAllowif the initial state of the IBayesNet is not respecting the wanted conditions if iteration = 0, it is assumed that the number of iteration wanted is the same as the one specified in the constructor

Definition at line 134 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__checkConditions(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__isPolytree(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_multi(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_poly(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_bayesNettemp, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_disturbing, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_hashMarginal, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_iteration, gum::MultiDimContainer< GUM_SCALAR >::copy(), GUM_ERROR, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::iteration(), gum::BayesNetInference< GUM_SCALAR >::makeInference(), gum::DAGmodel::nodes(), and gum::JointTargetedInference< GUM_SCALAR >::posterior().

136  { // insert option for the variation
137  _disturbing = true;
138  Size iter = _iteration;
139 
141 
142  this->_bayesNet = bayesNetinit;
143 
144  if (__checkConditions()) {
145  LazyPropagation< GUM_SCALAR > inf(&bayesNetinit);
146  inf.makeInference();
147 
148  for (auto node : bayesNetinit.nodes()) {
149  auto pottemp = new Potential< GUM_SCALAR >();
150  pottemp->copy(inf.posterior(node));
151  _hashMarginal.insert(node, pottemp);
152  }
153 
154  _bayesNettemp = this->_bayesNet;
155 
156  if (__isPolytree())
157  __PMMx_poly();
158  else
159  __PMMx_multi();
160 
161  bayesNetinit = (this->_bayesNet);
162 
163  while (_hashMarginal.size()) {
164  delete (_hashMarginal.begin().val());
165  _hashMarginal.erase(
166  _hashMarginal.beginSafe()); // safe iterator needed here.
167  }
168 
169  } else {
170  std::cout << this->_bayesNet.toDot() << std::endl;
171  GUM_ERROR(OperationNotAllowed,
172  "BN is not valid cause it does not respect constraint ");
173  }
174 
175  _iteration = iter;
176  _disturbing = false;
177  }
virtual bool __checkConditions()
The boolean function that will assert the respect of the constraint.
void __PMMx_poly()
In the case that the graph is a polytree, the function will, according to the probability p and q...
bool __isPolytree()
The function that verify if graph is a polytree.
BayesNet< GUM_SCALAR > _bayesNet
BayesNet< GUM_SCALAR > _bayesNettemp
Size iteration() const
Return a constant reference to the number of iteration imposed on the Markov Chain BayesNetGenerator...
void __PMMx_multi()
In the case that the graph is a multiconnected graph, the function will, according to the probability...
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
HashTable< NodeId, Potential< GUM_SCALAR > *> _hashMarginal
+ Here is the call graph for this function:

◆ fillCPT()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator>
void gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::fillCPT ( )
inherited

function that insert random values in the CPT of each nodes according to the CPTGenerator.

Returns
null but modify inputed empty Bayesian Network

Definition at line 61 of file IBayesNetGenerator_tpl.h.

References gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet.

Referenced by gum::SimpleBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::generateBN(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::generateBN().

61  {
62  for (auto node : _bayesNet.nodes())
63  this->generateCPT(_bayesNet.cpt(node).pos(_bayesNet.variable(node)),
64  _bayesNet.cpt(node)); // TODO ASSERT THE LINE
65  }
BayesNet< GUM_SCALAR > _bayesNet
+ Here is the caller graph for this function:

◆ generateBN()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::generateBN ( BayesNet< GUM_SCALAR > &  bayesNet)
overridevirtual

Generates a random bayesian network.

Parameters
bayesNetempty IBayesNet to generate.
Returns
null but modify inputed Bayesian Network

Implements gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >.

Definition at line 112 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__createTree(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_poly(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__transformPoly(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_bayesNettemp, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_iteration, gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_nbrNodes, gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::fillCPT(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::iteration().

113  {
115 
116  // this->_bayesNet = bayesNet;
117  __createTree(this->_nbrNodes);
118  __transformPoly(this->_nbrNodes / 2);
119  _bayesNettemp = this->_bayesNet;
120  __PMMx_poly();
121 
122  this->fillCPT();
124 
125  bayesNet = this->_bayesNet;
126  }
void __PMMx_poly()
In the case that the graph is a polytree, the function will, according to the probability p and q...
void fillCPT()
function that insert random values in the CPT of each nodes according to the CPTGenerator.
BayesNet< GUM_SCALAR > _bayesNet
BayesNet< GUM_SCALAR > _bayesNettemp
void __transformPoly(Idx nbiter)
The function that randomly change the simple tree into a polytree.
Size iteration() const
Return a constant reference to the number of iteration imposed on the Markov Chain BayesNetGenerator...
void __createTree(Size BNSize)
The function that randomly generate a simple tree.
+ Here is the call graph for this function:

◆ iteration()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE Size gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::iteration ( ) const

Return a constant reference to the number of iteration imposed on the Markov Chain BayesNetGenerator.

Definition at line 660 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_iteration.

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::generateBN(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::MCBayesNetGenerator(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::setIteration().

661  {
662  return _iteration;
663  }
+ Here is the caller graph for this function:

◆ maxArcs()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator>
INLINE Size gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::maxArcs ( ) const
inherited

Return a constant reference to the maximum number of arcs imposed on the IBayesNetGenerator.

Definition at line 79 of file IBayesNetGenerator_tpl.h.

References gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_maxArcs.

Referenced by gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::IBayesNetGenerator(), and gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::setMaxArcs().

79  {
80  return _maxArcs;
81  }
+ Here is the caller graph for this function:

◆ maxModality()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator>
INLINE Size gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::maxModality ( ) const
inherited

Return a constant reference to the maximum modality imposed on the IBayesNetGenerator.

Definition at line 69 of file IBayesNetGenerator_tpl.h.

References gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_maxModality.

Referenced by gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::IBayesNetGenerator(), and gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::setMaxModality().

69  {
70  return _maxModality;
71  }
+ Here is the caller graph for this function:

◆ nbrNodes()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator>
INLINE Size gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::nbrNodes ( ) const
inherited

Return a constant reference to the number of nodes imposed on the IBayesNetGenerator.

Definition at line 74 of file IBayesNetGenerator_tpl.h.

References gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_nbrNodes.

Referenced by gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::IBayesNetGenerator(), and gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::setNbrNodes().

74  {
75  return _nbrNodes;
76  }
+ Here is the caller graph for this function:

◆ p()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE Idx gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::p ( ) const

Return a constant reference to the probabilité p imposed on the Markov Chain BayesNetGenerator.

Definition at line 671 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_p.

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::MCBayesNetGenerator(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::setP().

671  {
672  return _p;
673  }
+ Here is the caller graph for this function:

◆ q()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE Idx gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::q ( ) const

Return a constant reference to the probabilité imposed on the Markov Chain BayesNetGenerator.

Definition at line 681 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_q.

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::MCBayesNetGenerator(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::setQ().

681  {
682  return _q;
683  }
+ Here is the caller graph for this function:

◆ setIteration()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::setIteration ( Size  iteration)

Modifies the value of the number of iterations impose on the BayesNetGenerator.

Definition at line 691 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_iteration, and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::iteration().

692  {
694  }
Size iteration() const
Return a constant reference to the number of iteration imposed on the Markov Chain BayesNetGenerator...
+ Here is the call graph for this function:

◆ setMaxArcs()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator>
INLINE void gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::setMaxArcs ( Size  maxArcs)
inherited

Modifies the value of the number of nodes imposed on the BayesGenerator.

Definition at line 103 of file IBayesNetGenerator_tpl.h.

References gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_maxArcs, gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_nbrNodes, GUM_ERROR, and gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::maxArcs().

103  {
104  if (maxArcs < _nbrNodes - 1 || maxArcs > (_nbrNodes * (_nbrNodes - 1)) / 2)
105  GUM_ERROR(OperationNotAllowed, " maxArcs value not possible ");
106 
107  _maxArcs = maxArcs;
108  }
Size maxArcs() const
Return a constant reference to the maximum number of arcs imposed on the IBayesNetGenerator.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
+ Here is the call graph for this function:

◆ setMaxModality()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator>
INLINE void gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::setMaxModality ( Size  maxModality)
inherited

Modifies the value of the number of nodes imposed on the BayesGenerator.

Definition at line 84 of file IBayesNetGenerator_tpl.h.

References gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_maxModality, GUM_ERROR, and gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::maxModality().

85  {
86  if (maxModality < 2)
87  GUM_ERROR(OperationNotAllowed,
88  " maxModality must be at least equal to two ");
89 
91  }
Size maxModality() const
Return a constant reference to the maximum modality imposed on the IBayesNetGenerator.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
+ Here is the call graph for this function:

◆ setNbrNodes()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator>
INLINE void gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::setNbrNodes ( Size  nbrNodes)
inherited

Modifies the value of the number of nodes imposed on the BayesGenerator.

Definition at line 94 of file IBayesNetGenerator_tpl.h.

References gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_maxArcs, gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_nbrNodes, GUM_ERROR, and gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::nbrNodes().

94  {
95  if ((_maxArcs < nbrNodes - 1) || (_maxArcs > (nbrNodes * (nbrNodes - 1)) / 2))
96  GUM_ERROR(OperationNotAllowed, " nbrNodes value not possible ");
97 
99  }
Size nbrNodes() const
Return a constant reference to the number of nodes imposed on the IBayesNetGenerator.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
+ Here is the call graph for this function:

◆ setP()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::setP ( Idx  p)

Modifies the value of the probability p imposed on the BayesNetGenerator.

Definition at line 701 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_p, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_q, GUM_ERROR, and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::p().

701  {
702  _p = p;
703 
704  if (p + _q > 100)
705  GUM_ERROR(
706  OperationNotAllowed,
707  "the sum of the probabilities p and q must be at most equal to 100");
708  }
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:52
+ Here is the call graph for this function:

◆ setQ()

template<typename GUM_SCALAR , template< typename > class ICPTGenerator, template< typename > class ICPTDisturber>
INLINE void gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::setQ ( Idx  q)

Modifies the value of the probability q imposed on the BayesNetGenerator.

Definition at line 715 of file MCBayesNetGenerator_tpl.h.

References gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_p, gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_q, GUM_ERROR, and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::q().

715  {
716  _q = q;
717 
718  if (_p + q > 100)
719  GUM_ERROR(
720  OperationNotAllowed,
721  "the sum of the probabilities p and q must be at most equal to 100");
722  }
Idx q() const
Return a constant reference to the probabilité imposed on the Markov Chain BayesNetGenerator.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
+ Here is the call graph for this function:

Member Data Documentation

◆ _bayesNet

template<typename GUM_SCALAR , template< typename > class ICPTGenerator>
BayesNet< GUM_SCALAR > gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::_bayesNet
protectedinherited

Definition at line 165 of file IBayesNetGenerator.h.

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AorR(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AR(), gum::MaxInducedWidthMCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__checkConditions(), gum::MaxParentsMCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__checkConditions(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__checkConditions(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseCloseNodes(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__chooseNodes(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__connect(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__createPartTree(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__createTree(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__directedPath(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__eraseArc(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__insertArc(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__isPolytree(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_multi(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_poly(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_multi(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__PMMx_poly(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__transformPoly(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN(), gum::IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::fillCPT(), gum::SimpleBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::generateBN(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::generateBN().

◆ _bayesNettemp

◆ _disturbing

template<typename GUM_SCALAR , template< typename > class ICPTGenerator = SimpleCPTGenerator, template< typename > class ICPTDisturber = SimpleCPTDisturber>
bool gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_disturbing
protected

◆ _hashMarginal

template<typename GUM_SCALAR , template< typename > class ICPTGenerator = SimpleCPTGenerator, template< typename > class ICPTDisturber = SimpleCPTDisturber>
HashTable< NodeId, Potential< GUM_SCALAR >* > gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_hashMarginal
protected

◆ _iteration

◆ _maxArcs

◆ _maxModality

◆ _nbrNodes

◆ _p

◆ _q


The documentation for this class was generated from the following files: