aGrUM 2.3.2
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-2025 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-2025 *
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#pragma once
41
48
49namespace gum {
50 namespace prm {
51
52 template < typename GUM_SCALAR >
54 if (_layers_.size() == 0) {
55 GUM_ERROR(OperationNotAllowed, "cannot generate a layered PRM<GUM_SCALAR> without layers")
56 }
57
58 std::vector< MyData > l;
60 std::string type = _generateType_(factory);
61 _generateInterfaces_(factory, type, l);
62 _generateClasses_(factory, type, l);
63 _generateSystem_(factory, l);
64 return factory.prm();
65 }
66
67 template < typename GUM_SCALAR >
68 std::string
70 std::string name = this->name_gen_.nextName(PRMObject::prm_type::TYPE);
71 factory.startDiscreteType(name);
72
73 for (Size i = 0; i < _domain_size_; ++i) {
74 std::stringstream sBuff;
75 sBuff << i;
76 factory.addLabel(sBuff.str());
77 }
78
79 factory.endDiscreteType();
80 return name;
81 }
82
83 template < typename GUM_SCALAR >
86 const std::string& type,
87 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l) {
88 for (Size lvl = 0; lvl < _layers_.size(); ++lvl) {
90 l[lvl].i = this->name_gen_.nextName(PRMObject::prm_type::PRM_INTERFACE);
91 f.startInterface(l[lvl].i);
92
93 for (Size a = 0; a < _layers_[lvl].a; ++a) {
94 l[lvl].a.push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT));
95 f.addAttribute(type, l[lvl].a.back());
96 }
97
98 if (lvl) {
99 for (Size g = 0; g < _layers_[lvl].g; ++g) {
100 l[lvl].g.push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT));
101 f.addAttribute("boolean", l[lvl].g.back());
102 }
103
104 l[lvl].r = this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT);
105 f.addReferenceSlot(l[lvl - 1].i, l[lvl].r, true);
106 }
107
108 f.endInterface();
109 }
110 }
111
112 template < typename GUM_SCALAR >
115 const std::string& type,
116 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l) {
117 // double ratio = getClusterRatio() + RAND_MAX;
119
120 for (Size lvl = 0; lvl < _layers_.size(); ++lvl) {
121 i.insert(l[lvl].i);
122
123 for (Size c = 0; c < _layers_[lvl].c; ++c) {
124 // if (std::rand() < ratio)
125 _generateCluster_(f, type, l, lvl, i);
126 // else
127 // _generateClass_(f, type, l, lvl, i);
128 }
129
130 i.erase(l[lvl].i);
131 }
132 }
133
134 template < typename GUM_SCALAR >
137 const std::string& type,
138 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l,
139 Size lvl,
141 Size size = 0;
142 GUM_SCALAR sum = 0.0;
143 std::string first, second, third;
144 std::vector< std::string >* v = 0;
145
146 switch (randomValue(2)) {
147 // Shape A->B
148 // v == [first, second, second.ref -> first]
149 case 0 : {
150 v = new std::vector< std::string >();
151 _generateClass_(f, type, l, lvl, i);
152 first = l[lvl].c.back();
153 v->push_back(first);
154 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS));
155 f.startClass(v->back());
156 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT));
157 f.addReferenceSlot(first, v->back(), true);
158 DAG dag;
160 _generateClassDag_(lvl, dag, names, l);
161
162 // Adding aggregates
163 for (std::vector< std::string >::iterator g = l[lvl].g.begin(); g != l[lvl].g.end();
164 ++g) {
165 std::stringstream s;
166 s << v->back() << "." << l[lvl].a[randomValue(l[lvl].a.size())];
167 std::vector< std::string > chain(1, s.str()), param(1, "1");
168 f.addAggregator(*g, "exists", chain, param);
169 }
170
171 // Adding attributes
172 for (std::vector< std::string >::iterator a = l[lvl].a.begin(); a != l[lvl].a.end();
173 ++a) {
174 f.startAttribute(type, *a, true);
175 size = getDomainSize();
176
177 for (const auto par: dag.parents(names.second(*a))) {
178 f.addParent(names.first(par));
179 size *= f.retrieveClass(l[lvl].c.back()).get(names.first(par)).type()->domainSize();
180 }
181
182 std::vector< GUM_SCALAR > cpf(size), val(getDomainSize());
183
184 for (size_t norms = 0; norms < size; norms += getDomainSize()) {
185 sum = 0.0;
186
187 for (size_t idx = 0; idx < getDomainSize(); ++idx) {
188 val[idx] = 1 + std::rand();
189 sum += val[idx];
190 }
191
192 for (size_t idx = 0; idx < getDomainSize(); ++idx)
193 cpf[norms + idx] = val[idx] / sum;
194 }
195
196 f.setRawCPFByLines(cpf);
197 f.endAttribute();
198 }
199
200 f.endClass();
201 break;
202 }
203
204 // Shape A -> B -> C
205 // v == [first, second, second.ref -> first, third, third.ref -> second]
206 case 1 : {
207 v = new std::vector< std::string >();
208 _generateClass_(f, type, l, lvl, i);
209 {
210 first = l[lvl].c.back();
211 v->push_back(first);
212 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS));
213 second = v->back();
214 f.startClass(second);
215 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT));
216 f.addReferenceSlot(first, v->back(), true);
217 DAG dag;
219 _generateClassDag_(lvl, dag, names, l);
220
221 // Adding aggregates
222 for (std::vector< std::string >::iterator g = l[lvl].g.begin(); g != l[lvl].g.end();
223 ++g) {
224 std::stringstream s;
225 s << v->back() << "." << l[lvl].a[randomValue(l[lvl].a.size())];
226 std::vector< std::string > chain(1, s.str()), param(1, "1");
227 f.addAggregator(*g, "exists", chain, param);
228 }
229
230 // Adding attributes
231 for (std::vector< std::string >::iterator a = l[lvl].a.begin(); a != l[lvl].a.end();
232 ++a) {
233 f.startAttribute(type, *a, true);
234 size = getDomainSize();
235
236 for (const auto par: dag.parents(names.second(*a))) {
237 f.addParent(names.first(par));
238 size *= f.retrieveClass(l[lvl].c.back()).get(names.first(par)).type()->domainSize();
239 }
240
241 std::vector< GUM_SCALAR > cpf(size), val(getDomainSize());
242
243 for (size_t norms = 0; norms < size; norms += getDomainSize()) {
244 sum = 0.0;
245
246 for (size_t idx = 0; idx < getDomainSize(); ++idx) {
247 val[idx] = 1 + std::rand();
248 sum += val[idx];
249 }
250
251 for (size_t idx = 0; idx < getDomainSize(); ++idx)
252 cpf[norms + idx] = val[idx] / sum;
253 }
254
255 f.setRawCPFByLines(cpf);
256 f.endAttribute();
257 }
258
259 f.endClass();
260 }
261 {
262 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS));
263 third = v->back();
264 f.startClass(third);
265 v->push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS_ELT));
266 f.addReferenceSlot(second, v->back(), true);
267 DAG dag;
269 _generateClassDag_(lvl, dag, names, l);
270
271 // Adding aggregates
272 for (std::vector< std::string >::iterator g = l[lvl].g.begin(); g != l[lvl].g.end();
273 ++g) {
274 std::stringstream s;
275 s << v->back() << "." << l[lvl].a[randomValue(l[lvl].a.size())];
276 std::vector< std::string > chain(1, s.str()), param(1, "1");
277 f.addAggregator(*g, "exists", chain, param);
278 }
279
280 // Adding attributes
281 for (std::vector< std::string >::iterator a = l[lvl].a.begin(); a != l[lvl].a.end();
282 ++a) {
283 f.startAttribute(type, *a, true);
284 size = getDomainSize();
285
286 for (const auto par: dag.parents(names.second(*a))) {
287 f.addParent(names.first(par));
288 size *= f.retrieveClass(l[lvl].c.back()).get(names.first(par)).type()->domainSize();
289 }
290
291 std::vector< GUM_SCALAR > cpf(size), val(getDomainSize());
292
293 for (size_t norms = 0; norms < size; norms += getDomainSize()) {
294 sum = 0.0;
295
296 for (size_t idx = 0; idx < getDomainSize(); ++idx) {
297 val[idx] = 1 + std::rand();
298 sum += val[idx];
299 }
300
301 for (size_t idx = 0; idx < getDomainSize(); ++idx)
302 cpf[norms + idx] = val[idx] / sum;
303 }
304
305 f.setRawCPFByLines(cpf);
306 f.endAttribute();
307 }
308
309 f.endClass();
310 }
311 break;
312 }
313
314 default : {
315 GUM_ERROR(OperationNotAllowed, "unexpected value")
316 }
317 }
318
319 _cluster_map_.insert(first, v);
320 }
321
322 template < typename GUM_SCALAR >
325 const std::string& type,
326 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l,
327 Size lvl,
329 Size size = 0;
330 GUM_SCALAR sum = 0.0;
331 l[lvl].c.push_back(this->name_gen_.nextName(PRMObject::prm_type::CLASS));
332 f.startClass(l[lvl].c.back(), "", &i);
333
334 if (lvl) f.addReferenceSlot(l[lvl - 1].i, l[lvl].r, true);
335
336 DAG dag;
338 _generateClassDag_(lvl, dag, names, l);
339
340 // Adding aggregates
341 if (lvl) {
342 for (const auto& agg: l[lvl].g) {
343 std::stringstream s;
344 s << l[lvl].r << "." << l[lvl - 1].a[randomValue(l[lvl - 1].a.size())];
345 std::vector< std::string > chain(1, s.str()), param(1, "1");
346 f.addAggregator(agg, "exists", chain, param);
347 }
348 }
349
350 // Adding attributes
351 for (const auto& attr: l[lvl].a) {
352 f.startAttribute(type, attr, true);
353 size = getDomainSize();
354
355 for (const auto par: dag.parents(names.second(attr))) {
356 f.addParent(names.first(par));
357 size *= f.retrieveClass(l[lvl].c.back()).get(names.first(par)).type()->domainSize();
358 }
359
360 std::vector< GUM_SCALAR > cpf(size), val(getDomainSize());
361
362 for (size_t norms = 0; norms < size; norms += getDomainSize()) {
363 sum = 0.0;
364
365 for (size_t idx = 0; idx < getDomainSize(); ++idx) {
366 val[idx] = 1 + std::rand();
367 sum += val[idx];
368 }
369
370 for (size_t idx = 0; idx < getDomainSize(); ++idx)
371 cpf[norms + idx] = val[idx] / sum;
372 }
373
374 f.setRawCPFByLines(cpf);
375 f.endAttribute();
376 }
377
378 f.endClass();
379 }
380
381 template < typename GUM_SCALAR >
383 Size lvl,
384 DAG& dag,
386 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l) {
387 float density = _layers_[lvl].inner_density;
388 std::vector< NodeId > nodes;
389 NodeId id = 0;
390
391 if (lvl) {
392 for (std::vector< std::string >::iterator g = l[lvl].g.begin(); g != l[lvl].g.end(); ++g) {
393 id = dag.addNode();
394 names.insert(*g, id);
395 nodes.push_back(id);
396 }
397 }
398
399 for (std::vector< std::string >::iterator a = l[lvl].a.begin(); a != l[lvl].a.end(); ++a) {
400 id = dag.addNode();
401 names.insert(*a, id);
402
403 for (std::vector< NodeId >::iterator prnt = nodes.begin(); prnt != nodes.end(); ++prnt)
404 if (randomProba() < density) dag.addArc(*prnt, names.second(*a));
405
406 nodes.push_back(id);
407 }
408
409 // For each nodes with #parents > _max_parents_ we randomly remove parents
410 // until
411 // #parents <= _max_parents_
412 for (const auto node: dag.nodes()) {
413 if (dag.parents(node).size() > getMaxParents()) {
414 std::vector< NodeId > v;
415
416 for (const auto par: dag.parents(node))
417 v.push_back(par);
418
419 while (dag.parents(node).size() > getMaxParents()) {
420 size_t idx = randomValue(v.size());
421 Arc arc(v[idx], node);
422 GUM_ASSERT(dag.existsArc(arc));
423 dag.eraseArc(arc);
424 v[idx] = v.back();
425 v.pop_back();
426 }
427 }
428 }
429 }
430
431 template < typename GUM_SCALAR >
434 std::vector< typename ClusteredLayerGenerator< GUM_SCALAR >::MyData >& l) {
435 factory.startSystem(this->name_gen_.nextName(PRMObject::prm_type::SYSTEM));
436 std::vector< std::vector< std::string > > o(_layers_.size());
437 std::string name, c, first, second, third;
438 std::vector< std::string >* v = 0;
439 size_t idx = 0;
440
441 for (size_t lvl = 0; lvl < _layers_.size(); ++lvl) {
442 float density = _layers_[lvl].outter_density;
443
444 for (size_t count = 0; count < _layers_[lvl].o; ++count) {
445 c = l[lvl].c[randomValue(l[lvl].c.size())];
446
447 if (_cluster_map_.exists(c)) {
448 v = _cluster_map_[c];
449
450 switch (v->size()) {
451 case 3 : {
452 first = this->name_gen_.nextName(PRMObject::prm_type::INSTANCE);
453 factory.addInstance(c, first);
454 second = this->name_gen_.nextName(PRMObject::prm_type::INSTANCE);
455 factory.addInstance(v->at(1), second);
456 std::stringstream chain;
457 chain << second << "." << v->at(2);
458 factory.setReferenceSlot(chain.str(), first);
459 break;
460 }
461
462 case 5 : {
463 first = this->name_gen_.nextName(PRMObject::prm_type::INSTANCE);
464 factory.addInstance(c, first);
465 second = this->name_gen_.nextName(PRMObject::prm_type::INSTANCE);
466 factory.addInstance(v->at(1), second);
467 std::stringstream chain_1, chain_2;
468 chain_1 << second << "." << v->at(2);
469 factory.setReferenceSlot(chain_1.str(), first);
470 third = this->name_gen_.nextName(PRMObject::prm_type::INSTANCE);
471 factory.addInstance(v->at(3), third);
472 chain_2 << third << "." << v->at(4);
473 factory.setReferenceSlot(chain_2.str(), 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::stringstream chain;
494 chain << name << "." << l[lvl].r;
495 std::vector< std::string > ref2add;
496
497 for (std::vector< std::string >::iterator iter = o[lvl - 1].begin();
498 iter != o[lvl - 1].end();
499 ++iter)
500 if (randomProba() <= density) ref2add.push_back(*iter);
501
502 if (ref2add.empty())
503 factory.setReferenceSlot(chain.str(), o[lvl - 1][randomValue(o[lvl - 1].size())]);
504
505 while (ref2add.size() > getMaxParents()) {
506 idx = randomValue(ref2add.size());
507 ref2add[idx] = ref2add.back();
508 ref2add.pop_back();
509 }
510
511 for (std::vector< std::string >::iterator iter = ref2add.begin(); iter != ref2add.end();
512 ++iter)
513 factory.setReferenceSlot(chain.str(), *iter);
514 }
515 }
516 }
517
518 factory.endSystem();
519 }
520
521 template < typename GUM_SCALAR >
526
527 template < typename GUM_SCALAR >
534
535 template < typename GUM_SCALAR >
539
540 template < typename GUM_SCALAR >
548
549 template < typename GUM_SCALAR >
553
554 template < typename GUM_SCALAR >
558
559 template < typename GUM_SCALAR >
563
564 template < typename GUM_SCALAR >
568
569 template < typename GUM_SCALAR >
571 const std::vector< typename LayerGenerator< GUM_SCALAR >::LayerData >& v) {
572 _layers_ = v;
573 }
574
575 template < typename GUM_SCALAR >
576 INLINE std::vector< typename LayerGenerator< GUM_SCALAR >::LayerData >&
580
581 template < typename GUM_SCALAR >
582 INLINE const std::vector< typename LayerGenerator< GUM_SCALAR >::LayerData >&
586
587 template < typename GUM_SCALAR >
591
592 template < typename GUM_SCALAR >
594 _cluster_ratio_ = ratio;
595 }
596
597 } /* namespace prm */
598} /* 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:63
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
virtual NodeId addNode()
insert a new node and return its id
Exception : operation not allowed.
Size size() const noexcept
Returns the number of elements in the set.
Definition set_tpl.h:636
void insert(const Key &k)
Inserts a new element into the set.
Definition set_tpl.h:539
Size getDomainSize() const
Getters and setters.
void _generateClasses_(PRMFactory< GUM_SCALAR > &f, const std::string &type, std::vector< typename ClusteredLayerGenerator::MyData > &l)
void _generateSystem_(PRMFactory< GUM_SCALAR > &factory, std::vector< typename ClusteredLayerGenerator::MyData > &l)
ClusteredLayerGenerator & operator=(const ClusteredLayerGenerator &source)
Copy operator.
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>.
void _generateInterfaces_(PRMFactory< GUM_SCALAR > &f, const std::string &type, std::vector< MyData > &l)
double getClusterRatio() const
Returns the odds of a given class to be replaced by a cluster.
void setLayers(const std::vector< typename LayerGenerator< GUM_SCALAR >::LayerData > &v)
Defines the structure of each layers.
void setClusterRatio(double ratio)
Define the odds of a given class to be replaced by a cluster.
void _generateClass_(PRMFactory< GUM_SCALAR > &f, const std::string &type, std::vector< typename ClusteredLayerGenerator::MyData > &l, Size lvl, Set< std::string > &i)
std::vector< typename LayerGenerator< GUM_SCALAR >::LayerData > _layers_
HashTable< std::string, std::vector< std::string > * > _cluster_map_
Size getMaxParents() const
Returns the max number of parents allowed for any attribute or aggregator.
void _generateCluster_(PRMFactory< GUM_SCALAR > &f, const std::string &type, std::vector< typename ClusteredLayerGenerator::MyData > &l, Size lvl, Set< std::string > &i)
void setMaxParents(Size s)
Returns the max number of parents allowed for any attribute or aggregator.
void setDomainSize(Size s)
Set the domain size of generated types.
Factory which builds a PRM<GUM_SCALAR>.
Definition PRMFactory.h:88
virtual void startAttribute(const std::string &type, const std::string &name, bool scalar_atttr=false) override
Tells the factory that we start an attribute declaration.
virtual void addAggregator(const std::string &name, const std::string &agg_type, const std::vector< std::string > &chains, const std::vector< std::string > &params, std::string type="") override
Add an aggregator in the current declared class.
virtual void addInstance(const std::string &type, const std::string &name) override
Add an instance to the model.
virtual void addParent(const std::string &name) override
Tells the factory that we add a parent to the current declared attribute.
void setRawCPFByLines(const std::vector< GUM_SCALAR > &array)
Gives the factory the CPF in its raw form.
virtual void endSystem() override
Tells the factory that we finished declaring a model.
virtual void setReferenceSlot(const std::string &left_instance, const std::string &left_reference, const std::string &right_instance) override
Instantiate a reference in the current model.
PRMClass< GUM_SCALAR > & retrieveClass(const std::string &name)
Returns a reference over a Class<GUM_SCALAR> given its name.
virtual void addReferenceSlot(const std::string &type, const std::string &name, bool isArray) override
Tells the factory that we started declaring a slot.
virtual void endAttribute() override
Tells the factory that we finished declaring an attribute.
virtual void startClass(const std::string &c, const std::string &ext="", const Set< std::string > *implements=nullptr, bool delayInheritance=false) override
Tells the factory that we start a class declaration.
virtual void endClass(bool checkImplementations=true) override
Tells the factory that we finished a class declaration.
virtual void startSystem(const std::string &name) override
Tells the factory that we started declaring a model.
virtual void addAttribute(const std::string &type, const std::string &name) override
Add an attribute to an interface.
virtual void endInterface() override
Tells the factory that we finished an interface declaration.
virtual void startDiscreteType(const std::string &name, std::string super="") override
Start a discrete subtype declaration.
PRM< GUM_SCALAR > * prm() const
Returns a pointer on the PRM<GUM_SCALAR> created by this factory.
virtual void startInterface(const std::string &i, const std::string &ext="", bool delayInheritance=false) override
Tells the factory that we start an interface declaration.
virtual void endDiscreteType() override
End the current discrete type declaration.
virtual void addLabel(const std::string &l, std::string ext="") override
Add a label to the current discrete type.
NameGenerator name_gen_
The name generator used by this class.
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
Definition PRM.h:74
#define GUM_ERROR(type, msg)
Definition exceptions.h:72
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