aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
clusteredLayerGenerator_tpl.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2026 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2026 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41#pragma once
42
49
50#include <agrum/PRM/generator/clusteredLayerGenerator.h> // to ease IDE parser
51
52namespace gum {
53 namespace prm {
54
55 template < GUM_Numeric GUM_SCALAR >
57 if (_layers_.size() == 0) {
58 GUM_ERROR(OperationNotAllowed, "cannot generate a layered PRM<GUM_SCALAR> without layers")
59 }
60
61 std::vector< MyData > l;
63 std::string type = _generateType_(factory);
64 _generateInterfaces_(factory, type, l);
65 _generateClasses_(factory, type, l);
66 _generateSystem_(factory, l);
67 return factory.prm();
68 }
69
70 template < GUM_Numeric GUM_SCALAR >
71 std::string
73 std::string name = this->name_gen_.nextName(PRMObject::prm_type::TYPE);
74 factory.startDiscreteType(name);
75
76 for (Size i = 0; i < _domain_size_; ++i) {
77 factory.addLabel(std::to_string(i));
78 }
79
80 factory.endDiscreteType();
81 return name;
82 }
83
84 template < GUM_Numeric GUM_SCALAR >
87 std::string_view type,
88 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l) {
89 for (Size lvl = 0; lvl < _layers_.size(); ++lvl) {
91 l[lvl].i = this->name_gen_.nextName(PRMObject::prm_type::PRM_INTERFACE);
92 f.startInterface(l[lvl].i);
93
94 for (Size a = 0; a < _layers_[lvl].a; ++a) {
95 l[lvl].a.push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT));
96 f.addAttribute(type, l[lvl].a.back());
97 }
98
99 if (lvl) {
100 for (Size g = 0; g < _layers_[lvl].g; ++g) {
101 l[lvl].g.push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT));
102 f.addAttribute("boolean", l[lvl].g.back());
103 }
104
105 l[lvl].r = this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT);
106 f.addReferenceSlot(l[lvl - 1].i, l[lvl].r, true);
107 }
108
109 f.endInterface();
110 }
111 }
112
113 template < GUM_Numeric GUM_SCALAR >
116 std::string_view type,
117 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l) {
118 // double ratio = getClusterRatio() + RAND_MAX;
120
121 for (Size lvl = 0; lvl < _layers_.size(); ++lvl) {
122 i.insert(l[lvl].i);
123
124 for (Size c = 0; c < _layers_[lvl].c; ++c) {
125 // if (std::rand() < ratio)
126 _generateCluster_(f, type, l, lvl, i);
127 // else
128 // _generateClass_(f, type, l, lvl, i);
129 }
130
131 i.erase(l[lvl].i);
132 }
133 }
134
135 template < GUM_Numeric GUM_SCALAR >
138 std::string_view type,
139 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l,
140 Size lvl,
142 Size size = 0;
143 GUM_SCALAR sum = 0.0;
144 std::string first, second, third;
145 std::vector< std::string >* v = 0;
146
147 switch (randomValue(2)) {
148 // Shape A->B
149 // v == [first, second, second.ref -> first]
150 case 0 : {
151 v = new std::vector< std::string >();
152 _generateClass_(f, type, l, lvl, i);
153 first = l[lvl].c.back();
154 v->push_back(first);
155 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS));
156 f.startClass(v->back());
157 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT));
158 f.addReferenceSlot(first, v->back(), true);
159 DAG dag;
161 _generateClassDag_(lvl, dag, names, l);
162
163 // Adding aggregates
164 for (std::vector< std::string >::iterator g = l[lvl].g.begin(); g != l[lvl].g.end();
165 ++g) {
166 std::vector< std::string > chain(
167 1,
168 std::format("{}.{}", v->back(), l[lvl].a[randomValue(l[lvl].a.size())])),
169 param(1, "1");
170 f.addAggregator(*g, "exists", chain, param);
171 }
172
173 // Adding attributes
174 for (std::vector< std::string >::iterator a = l[lvl].a.begin(); a != l[lvl].a.end();
175 ++a) {
176 f.startAttribute(type, *a, true);
177 size = getDomainSize();
178
179 for (const auto par: dag.parents(names.second(*a))) {
180 f.addParent(names.first(par));
181 size *= f.retrieveClass(l[lvl].c.back()).get(names.first(par)).type()->domainSize();
182 }
183
184 std::vector< GUM_SCALAR > cpf(size), val(getDomainSize());
185
186 for (size_t norms = 0; norms < size; norms += getDomainSize()) {
187 sum = 0.0;
188
189 for (size_t idx = 0; idx < getDomainSize(); ++idx) {
190 val[idx] = 1 + std::rand();
191 sum += val[idx];
192 }
193
194 for (size_t idx = 0; idx < getDomainSize(); ++idx)
195 cpf[norms + idx] = val[idx] / sum;
196 }
197
198 f.setRawCPFByLines(cpf);
199 f.endAttribute();
200 }
201
202 f.endClass();
203 break;
204 }
205
206 // Shape A -> B -> C
207 // v == [first, second, second.ref -> first, third, third.ref -> second]
208 case 1 : {
209 v = new std::vector< std::string >();
210 _generateClass_(f, type, l, lvl, i);
211 {
212 first = l[lvl].c.back();
213 v->push_back(first);
214 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS));
215 second = v->back();
216 f.startClass(second);
217 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT));
218 f.addReferenceSlot(first, v->back(), true);
219 DAG dag;
221 _generateClassDag_(lvl, dag, names, l);
222
223 // Adding aggregates
224 for (std::vector< std::string >::iterator g = l[lvl].g.begin(); g != l[lvl].g.end();
225 ++g) {
226 std::vector< std::string > chain(
227 1,
228 std::format("{}.{}", v->back(), l[lvl].a[randomValue(l[lvl].a.size())])),
229 param(1, "1");
230 f.addAggregator(*g, "exists", chain, param);
231 }
232
233 // Adding attributes
234 for (std::vector< std::string >::iterator a = l[lvl].a.begin(); a != l[lvl].a.end();
235 ++a) {
236 f.startAttribute(type, *a, true);
237 size = getDomainSize();
238
239 for (const auto par: dag.parents(names.second(*a))) {
240 f.addParent(names.first(par));
241 size *= f.retrieveClass(l[lvl].c.back()).get(names.first(par)).type()->domainSize();
242 }
243
244 std::vector< GUM_SCALAR > cpf(size), val(getDomainSize());
245
246 for (size_t norms = 0; norms < size; norms += getDomainSize()) {
247 sum = 0.0;
248
249 for (size_t idx = 0; idx < getDomainSize(); ++idx) {
250 val[idx] = 1 + std::rand();
251 sum += val[idx];
252 }
253
254 for (size_t idx = 0; idx < getDomainSize(); ++idx)
255 cpf[norms + idx] = val[idx] / sum;
256 }
257
258 f.setRawCPFByLines(cpf);
259 f.endAttribute();
260 }
261
262 f.endClass();
263 }
264 {
265 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS));
266 third = v->back();
267 f.startClass(third);
268 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT));
269 f.addReferenceSlot(second, v->back(), true);
270 DAG dag;
272 _generateClassDag_(lvl, dag, names, l);
273
274 // Adding aggregates
275 for (std::vector< std::string >::iterator g = l[lvl].g.begin(); g != l[lvl].g.end();
276 ++g) {
277 std::vector< std::string > chain(
278 1,
279 std::format("{}.{}", v->back(), l[lvl].a[randomValue(l[lvl].a.size())])),
280 param(1, "1");
281 f.addAggregator(*g, "exists", chain, param);
282 }
283
284 // Adding attributes
285 for (std::vector< std::string >::iterator a = l[lvl].a.begin(); a != l[lvl].a.end();
286 ++a) {
287 f.startAttribute(type, *a, true);
288 size = getDomainSize();
289
290 for (const auto par: dag.parents(names.second(*a))) {
291 f.addParent(names.first(par));
292 size *= f.retrieveClass(l[lvl].c.back()).get(names.first(par)).type()->domainSize();
293 }
294
295 std::vector< GUM_SCALAR > cpf(size), val(getDomainSize());
296
297 for (size_t norms = 0; norms < size; norms += getDomainSize()) {
298 sum = 0.0;
299
300 for (size_t idx = 0; idx < getDomainSize(); ++idx) {
301 val[idx] = 1 + std::rand();
302 sum += val[idx];
303 }
304
305 for (size_t idx = 0; idx < getDomainSize(); ++idx)
306 cpf[norms + idx] = val[idx] / sum;
307 }
308
309 f.setRawCPFByLines(cpf);
310 f.endAttribute();
311 }
312
313 f.endClass();
314 }
315 break;
316 }
317
318 default : {
319 GUM_ERROR(OperationNotAllowed, "unexpected value")
320 }
321 }
322
323 _cluster_map_.insert(first, v);
324 }
325
326 template < GUM_Numeric GUM_SCALAR >
329 std::string_view type,
330 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l,
331 Size lvl,
333 Size size = 0;
334 GUM_SCALAR sum = 0.0;
335 l[lvl].c.push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS));
336 f.startClass(l[lvl].c.back(), "", &i);
337
338 if (lvl) f.addReferenceSlot(l[lvl - 1].i, l[lvl].r, true);
339
340 DAG dag;
342 _generateClassDag_(lvl, dag, names, l);
343
344 // Adding aggregates
345 if (lvl) {
346 for (const auto& agg: l[lvl].g) {
347 std::vector< std::string > chain(
348 1,
349 std::format("{}.{}", l[lvl].r, l[lvl - 1].a[randomValue(l[lvl - 1].a.size())])),
350 param(1, "1");
351 f.addAggregator(agg, "exists", chain, param);
352 }
353 }
354
355 // Adding attributes
356 for (const auto& attr: l[lvl].a) {
357 f.startAttribute(type, attr, true);
358 size = getDomainSize();
359
360 for (const auto par: dag.parents(names.second(attr))) {
361 f.addParent(names.first(par));
362 size *= f.retrieveClass(l[lvl].c.back()).get(names.first(par)).type()->domainSize();
363 }
364
365 std::vector< GUM_SCALAR > cpf(size), val(getDomainSize());
366
367 for (size_t norms = 0; norms < size; norms += getDomainSize()) {
368 sum = 0.0;
369
370 for (size_t idx = 0; idx < getDomainSize(); ++idx) {
371 val[idx] = 1 + std::rand();
372 sum += val[idx];
373 }
374
375 for (size_t idx = 0; idx < getDomainSize(); ++idx)
376 cpf[norms + idx] = val[idx] / sum;
377 }
378
379 f.setRawCPFByLines(cpf);
380 f.endAttribute();
381 }
382
383 f.endClass();
384 }
385
386 template < GUM_Numeric GUM_SCALAR >
388 Size lvl,
389 DAG& dag,
391 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l) {
392 float density = _layers_[lvl].inner_density;
393 std::vector< NodeId > nodes;
394 NodeId id = 0;
395
396 if (lvl) {
397 for (std::vector< std::string >::iterator g = l[lvl].g.begin(); g != l[lvl].g.end(); ++g) {
398 id = dag.addNode();
399 names.insert(*g, id);
400 nodes.push_back(id);
401 }
402 }
403
404 for (std::vector< std::string >::iterator a = l[lvl].a.begin(); a != l[lvl].a.end(); ++a) {
405 id = dag.addNode();
406 names.insert(*a, id);
407
408 for (std::vector< NodeId >::iterator prnt = nodes.begin(); prnt != nodes.end(); ++prnt)
409 if (randomProba() < density) dag.addArc(*prnt, names.second(*a));
410
411 nodes.push_back(id);
412 }
413
414 // For each nodes with #parents > _max_parents_ we randomly remove parents
415 // until
416 // #parents <= _max_parents_
417 for (const auto node: dag.nodes()) {
418 if (dag.parents(node).size() > getMaxParents()) {
419 std::vector< NodeId > v;
420
421 for (const auto par: dag.parents(node))
422 v.push_back(par);
423
424 while (dag.parents(node).size() > getMaxParents()) {
425 size_t idx = randomValue(v.size());
426 Arc arc(v[idx], node);
427 GUM_ASSERT(dag.existsArc(arc));
428 dag.eraseArc(arc);
429 v[idx] = v.back();
430 v.pop_back();
431 }
432 }
433 }
434 }
435
436 template < GUM_Numeric GUM_SCALAR >
439 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l) {
440 factory.startSystem(this->name_gen_.nextName(PRMObject::prm_type::SYSTEM));
441 std::vector< std::vector< std::string > > o(_layers_.size());
442 std::string name, c, first, second, third;
443 std::vector< std::string >* v = 0;
444 size_t idx = 0;
445
446 for (size_t lvl = 0; lvl < _layers_.size(); ++lvl) {
447 float density = _layers_[lvl].outter_density;
448
449 for (size_t count = 0; count < _layers_[lvl].o; ++count) {
450 c = l[lvl].c[randomValue(l[lvl].c.size())];
451
452 if (_cluster_map_.exists(c)) {
453 v = _cluster_map_[c];
454
455 switch (v->size()) {
456 case 3 : {
457 first = this->name_gen_.nextName(PRMObject::prm_type::INSTANCE);
458 factory.addInstance(c, first);
459 second = this->name_gen_.nextName(PRMObject::prm_type::INSTANCE);
460 factory.addInstance(v->at(1), second);
461 factory.setReferenceSlot(std::format("{}.{}", second, v->at(2)), first);
462 break;
463 }
464
465 case 5 : {
466 first = this->name_gen_.nextName(PRMObject::prm_type::INSTANCE);
467 factory.addInstance(c, first);
468 second = this->name_gen_.nextName(PRMObject::prm_type::INSTANCE);
469 factory.addInstance(v->at(1), second);
470 factory.setReferenceSlot(std::format("{}.{}", second, v->at(2)), first);
471 third = this->name_gen_.nextName(PRMObject::prm_type::INSTANCE);
472 factory.addInstance(v->at(3), third);
473 factory.setReferenceSlot(std::format("{}.{}", third, v->at(4)), second);
474 break;
475 }
476
477 default : {
478 GUM_ERROR(OperationNotAllowed, "unexpected vector size")
479 }
480 }
481
482 // _cluster_map_.erase(c);
483 // delete v;
484 name = first;
485 } else {
486 name = this->name_gen_.nextName(PRMObject::prm_type::INSTANCE);
487 factory.addInstance(c, name);
488 }
489
490 o[lvl].push_back(name);
491
492 if (lvl) {
493 std::string chain = std::format("{}.{}", name, l[lvl].r);
494 std::vector< std::string > ref2add;
495
496 for (std::vector< std::string >::iterator iter = o[lvl - 1].begin();
497 iter != o[lvl - 1].end();
498 ++iter)
499 if (randomProba() <= density) ref2add.push_back(*iter);
500
501 if (ref2add.empty())
502 factory.setReferenceSlot(chain, o[lvl - 1][randomValue(o[lvl - 1].size())]);
503
504 while (ref2add.size() > getMaxParents()) {
505 idx = randomValue(ref2add.size());
506 ref2add[idx] = ref2add.back();
507 ref2add.pop_back();
508 }
509
510 for (std::vector< std::string >::iterator iter = ref2add.begin(); iter != ref2add.end();
511 ++iter)
512 factory.setReferenceSlot(chain, *iter);
513 }
514 }
515 }
516
517 factory.endSystem();
518 }
519
520 template < GUM_Numeric GUM_SCALAR >
525
526 template < GUM_Numeric GUM_SCALAR >
533
534 template < GUM_Numeric GUM_SCALAR >
538
539 template < GUM_Numeric GUM_SCALAR >
547
548 template < GUM_Numeric GUM_SCALAR >
552
553 template < GUM_Numeric GUM_SCALAR >
557
558 template < GUM_Numeric GUM_SCALAR >
562
563 template < GUM_Numeric GUM_SCALAR >
567
568 template < GUM_Numeric GUM_SCALAR >
573
574 template < GUM_Numeric GUM_SCALAR >
575 std::vector< typename LayerGenerator< GUM_SCALAR >::LayerData >&
579
580 template < GUM_Numeric GUM_SCALAR >
581 const std::vector< typename LayerGenerator< GUM_SCALAR >::LayerData >&
585
586 template < GUM_Numeric GUM_SCALAR >
590
591 template < GUM_Numeric GUM_SCALAR >
595
596 } /* namespace prm */
597} /* namespace gum */
bool existsArc(const Arc &arc) const
indicates whether a given arc exists
const NodeSet & parents(NodeId id) const
returns the set of nodes with arc ingoing to a given node
virtual void eraseArc(const Arc &arc)
removes an arc from the ArcGraphPart
The base class for all directed edges.
Base class for dag.
Definition DAG.h:121
void addArc(NodeId tail, NodeId head) final
insert a new arc into the directed graph
Definition DAG_inl.h:75
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
virtual NodeId addNode()
insert a new node and return its id
Exception : operation not allowed.
void insert(const Key &k)
Inserts a new element into the set.
Definition set_tpl.h:510
Size size() const noexcept
Returns the number of elements in the set.
Definition set_tpl.h:607
void _generateSystem_(PRMFactory< GUM_SCALAR > &factory, std::vector< typename ClusteredLayerGenerator::MyData > &l)
std::vector< typename LayerGenerator< GUM_SCALAR >::LayerData > & getLayer()
Getters and setters.
void _generateClassDag_(Size lvl, DAG &dag, Bijection< std::string, NodeId > &names, std::vector< typename ClusteredLayerGenerator::MyData > &l)
std::string _generateType_(PRMFactory< GUM_SCALAR > &f)
virtual PRM< GUM_SCALAR > * generate()
Proceeds with the generation of the PRM<GUM_SCALAR>.
Size getDomainSize() const
Getters and setters.
void _generateClasses_(PRMFactory< GUM_SCALAR > &f, std::string_view type, std::vector< typename ClusteredLayerGenerator::MyData > &l)
void _generateClass_(PRMFactory< GUM_SCALAR > &f, std::string_view type, std::vector< typename ClusteredLayerGenerator::MyData > &l, Size lvl, Set< std::string > &i)
void _generateCluster_(PRMFactory< GUM_SCALAR > &f, std::string_view type, std::vector< typename ClusteredLayerGenerator::MyData > &l, Size lvl, Set< std::string > &i)
void setLayers(const std::vector< typename LayerGenerator< GUM_SCALAR >::LayerData > &v)
Defines the structure of each layers.
std::vector< typename LayerGenerator< GUM_SCALAR >::LayerData > _layers_
void setClusterRatio(double ratio)
Define the odds of a given class to be replaced by a cluster.
HashTable< std::string, std::vector< std::string > * > _cluster_map_
void _generateInterfaces_(PRMFactory< GUM_SCALAR > &f, std::string_view type, std::vector< MyData > &l)
double getClusterRatio() const
Returns the odds of a given class to be replaced by a cluster.
Size getMaxParents() const
Returns the max number of parents allowed for any attribute or aggregator.
void setMaxParents(Size s)
Returns the max number of parents allowed for any attribute or aggregator.
ClusteredLayerGenerator & operator=(const ClusteredLayerGenerator &source)
Copy operator.
void setDomainSize(Size s)
Set the domain size of generated types.
Factory which builds a PRM<GUM_SCALAR>.
Definition PRMFactory.h:90
void addLabel(std::string_view l, std::string_view ext="") override
Add a label to the current discrete type.
void startDiscreteType(std::string_view name, std::string_view super="") override
Start a discrete subtype declaration.
void addReferenceSlot(std::string_view type, std::string_view name, bool isArray) override
Tells the factory that we started declaring a slot.
void endInterface() override
Tells the factory that we finished an interface declaration.
void setReferenceSlot(std::string_view left_instance, std::string_view left_reference, std::string_view right_instance) override
Instantiate a reference in the current model.
void startInterface(std::string_view i, std::string_view ext="", bool delayInheritance=false) override
Tells the factory that we start an interface declaration.
PRM< GUM_SCALAR > * prm() const
Returns a pointer on the PRM<GUM_SCALAR> created by this factory.
void addAttribute(std::string_view type, std::string_view name) override
Add an attribute to an interface.
void setRawCPFByLines(const std::vector< GUM_SCALAR > &array)
Gives the factory the CPF in its raw form.
PRMClass< GUM_SCALAR > & retrieveClass(std::string_view name)
Returns a reference over a Class<GUM_SCALAR> given its name.
void startSystem(std::string_view name) override
Tells the factory that we started declaring a model.
void addInstance(std::string_view type, std::string_view name) override
Add an instance to the model.
void addAggregator(std::string_view name, std::string_view agg_type, const std::vector< std::string > &chains, const std::vector< std::string > &params, std::string_view type="") override
Add an aggregator in the current declared class.
void startAttribute(std::string_view type, std::string_view name, bool scalar_atttr=false) override
Tells the factory that we start an attribute declaration.
void endClass(bool checkImplementations=true) override
Tells the factory that we finished a class declaration.
void startClass(std::string_view c, std::string_view ext="", const Set< std::string > *implements=nullptr, bool delayInheritance=false) override
Tells the factory that we start a class declaration.
void endAttribute() override
Tells the factory that we finished declaring an attribute.
void endSystem() override
Tells the factory that we finished declaring a model.
void addParent(std::string_view name) override
Tells the factory that we add a parent to the current declared attribute.
void endDiscreteType() override
End the current discrete type declaration.
NameGenerator name_gen_
The name generator used by this class.
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
Definition PRM.h:74
Headers of ClusteredLayerGenerator.
#define GUM_ERROR(type, msg)
Definition exceptions.h:76
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74
Size NodeId
Type for node ids.
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
double randomProba()
Returns a random double between 0 and 1 included (i.e.
namespace for all probabilistic relational models entities
Definition agrum.h:68
gum is the global namespace for all aGrUM entities
Definition agrum.h:46