aGrUM  0.16.0
layerGenerator.h
Go to the documentation of this file.
1 
30 #ifndef GUM_LAYER_GENERATOR_H
31 #define GUM_LAYER_GENERATOR_H
32 #include <cstdlib>
33 #include <ctime>
34 #include <list>
35 #include <sstream>
36 #include <string>
37 #include <vector>
38 
40 
41 #include <agrum/PRM/PRMFactory.h>
44 
45 namespace gum {
46  namespace prm {
47 
55  template < typename GUM_SCALAR >
56  class LayerGenerator : public PRMGenerator< GUM_SCALAR > {
57  public:
58  // ========================================================================
60  // ========================================================================
62 
66  LayerGenerator(const LayerGenerator& source);
68  LayerGenerator& operator=(const LayerGenerator& source);
70  virtual ~LayerGenerator();
71 
73  // ========================================================================
75  // ========================================================================
77 
80  struct LayerData {
81  // Number of attributes for the layer's interface.
83  // Number of aggregates for the layer's interface.
85  // Number of classes for this layer.
87  // Number of instances for this layer.
89  // Density of arcs between attributes of the same classe in this layer.
91  // The odds of an instance of the precedent layer to be added to a
92  // reference slot of a class of this layer.
94  };
95 
97  Size getDomainSize() const;
98 
100  void setDomainSize(Size s);
101 
104  Size getMaxParents() const;
105 
108  void setMaxParents(Size s);
109 
117  void setLayers(const std::vector< LayerData >& v);
118 
119  std::vector< LayerData >& getLayer();
120  const std::vector< LayerData >& getLayer() const;
121 
123  virtual PRM< GUM_SCALAR >* generate();
124 
126  private:
127  std::vector< LayerData > __layers;
130 
131  struct MyData {
132  // interface name
133  std::string i;
134  std::vector< std::string > a;
135  std::vector< std::string > g;
136  std::string r;
137  std::vector< std::string > c;
138  };
139 
141 
143  const std::string& type,
144  std::vector< MyData >& l);
145 
147  const std::string& type,
148  std::vector< typename LayerGenerator::MyData >& l);
149 
150  void __generateClassDag(Size lvl,
151  DAG& dag,
153  std::vector< typename LayerGenerator::MyData >& l);
154 
156  std::vector< typename LayerGenerator::MyData >& l);
157  };
158 
159  } /* namespace prm */
160 } /* namespace gum */
161 
163 
164 #endif /* GUM_LAYER_GENERATOR_H */
This class is the base class to all PRM generators.
Definition: PRMGenerator.h:49
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
void __generateInterfaces(PRMFactory< GUM_SCALAR > &f, const std::string &type, std::vector< MyData > &l)
std::vector< LayerData > __layers
LayerGenerator()
Default constructor.
std::vector< std::string > a
void __generateClasses(PRMFactory< GUM_SCALAR > &f, const std::string &type, std::vector< typename LayerGenerator::MyData > &l)
void setDomainSize(Size s)
Set the domain size of generated types.
Factory which builds a PRM<GUM_SCALAR>.
Definition: PRMType.h:50
Size getMaxParents() const
Returns the max number of parents allowed for any attribute or aggregator.
Size getDomainSize() const
Returns the domain size of generated types.
void __generateSystem(PRMFactory< GUM_SCALAR > &factory, std::vector< typename LayerGenerator::MyData > &l)
<agrum/PRM/generator/layerGenerator.h>
void setLayers(const std::vector< LayerData > &v)
Defines the structure of each layers.
virtual PRM< GUM_SCALAR > * generate()
Proceeds with the generation of the PRM<GUM_SCALAR>.
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
Definition: PRM.h:66
virtual ~LayerGenerator()
Destructor.
std::vector< LayerData > & getLayer()
Returns the domain size of generated types.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::vector< std::string > g
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void setMaxParents(Size s)
Returns the max number of parents allowed for any attribute or aggregator.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
std::vector< std::string > c
Base class for dag.
Definition: DAG.h:102
LayerGenerator & operator=(const LayerGenerator &source)
Copy operator.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void __generateClassDag(Size lvl, DAG &dag, Bijection< std::string, NodeId > &names, std::vector< typename LayerGenerator::MyData > &l)
std::string __generateType(PRMFactory< GUM_SCALAR > &f)