aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
maxInducedWidthMCBayesNetGenerator_tpl.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /** @file
23  * @brief Source implementation of MaxInducedWidthMCBayesNetGenerator
24  *
25  * @author Pierre-Henri WUILLEMIN(@LIP6) and Ariele Maesano
26  *
27  */
28 
29 #include <agrum/BN/generator/maxInducedWidthMCBayesNetGenerator.h>
30 
31 namespace gum {
32 #ifdef _MSC_VER
33 # define MCBG MCBayesNetGenerator
34 # define IBNG IBayesNetGenerator
35 #else
36 # define MCBG MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >
37 # define IBNG IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >
38 #endif
39  // Default constructor.
40  // Use the SimpleCPTGenerator for generating the BNs CPT.
41  template < typename GUM_SCALAR,
42  template < typename >
43  class ICPTGenerator,
44  template < typename >
45  class ICPTDisturber >
46  INLINE MaxInducedWidthMCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::
48  Size maxArcs,
51  Idx iteration,
52  Idx p,
53  Idx q) :
55  if (maxInducedWidth == 0)
57  "maxInducedWidth must be at least equal "
58  "to 1 to have a connexe graph");
59 
62  }
63 
64  template < typename GUM_SCALAR,
65  template < typename >
66  class ICPTGenerator,
67  template < typename >
68  class ICPTDisturber >
72  Idx iteration,
73  Idx p,
74  Idx q) :
75  MCBG(bayesNet, iteration, p, q) {
78  }
79 
80  // Use this constructor if you want to use a different policy for generating
81  // CPT than the default one.
82  // The cptGenerator will be erased when the destructor is called.
83  // @param cptGenerator The policy used to generate CPT.
84  /*template<typename GUM_SCALAR, template<class> class ICPTGenerator,
85  template<class> class ICPDisturber>
86  MaxInducedWidthMCBayesNetGenerator<GUM_SCALAR,ICPTGenerator,ICPTDisturber>::MaxInducedWidthMCBayesNetGenerator(
87  CPTGenerator* cptGenerator,Size nbrNodes, Idx p,Idx q,Idx iteration,float
88  maxDensity , Size max_modality, Size maxInducedWidth):
89  MCBG<GUM_SCALAR,ICPTGenerator,ICPTDisturber>(cptGenerator,
90  nbrNodes,p,q,iteration, maxDensity,max_modality, maxInducedWidth){
91  GUM_CONSTRUCTOR(MaxInducedWidthMCBayesNetGenerator);
92  }*/
93 
94  // Destructor.
95  template < typename GUM_SCALAR,
96  template < typename >
97  class ICPTGenerator,
98  template < typename >
99  class ICPTDisturber >
103  // delete BayesNetGenerator<GUM_SCALAR>::cptGenerator_;
104  }
105 
106  template < typename GUM_SCALAR,
107  template < typename >
108  class ICPTGenerator,
109  template < typename >
110  class ICPTDisturber >
114 
115  for (auto node: this->bayesNet_.nodes())
117 
119 
120  if (tri.maxLog10CliqueDomainSize() > maxlog10InducedWidth_) return false;
121 
122  return MCBG::_checkConditions_();
123  }
124 
125  template < typename GUM_SCALAR,
126  template < typename >
127  class ICPTGenerator,
128  template < typename >
129  class ICPTDisturber >
132  return maxlog10InducedWidth_;
133  }
134  template < typename GUM_SCALAR,
135  template < typename >
136  class ICPTGenerator,
137  template < typename >
138  class ICPTDisturber >
141  if (maxlog10InducedWidth == 0)
143  "maxInducedWidth must be at least equal "
144  "to 1 to have a connexe graph");
145 
147  }
148 } /* namespace gum */
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643