aGrUM  0.14.2
layerGenerator.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
27 #ifndef GUM_LAYER_GENERATOR_H
28 #define GUM_LAYER_GENERATOR_H
29 #include <cstdlib>
30 #include <ctime>
31 #include <list>
32 #include <sstream>
33 #include <string>
34 #include <vector>
35 
37 
38 #include <agrum/PRM/PRMFactory.h>
41 
42 namespace gum {
43  namespace prm {
44 
52  template < typename GUM_SCALAR >
53  class LayerGenerator : public PRMGenerator< GUM_SCALAR > {
54  public:
55  // ========================================================================
57  // ========================================================================
59 
63  LayerGenerator(const LayerGenerator& source);
65  LayerGenerator& operator=(const LayerGenerator& source);
67  virtual ~LayerGenerator();
68 
70  // ========================================================================
72  // ========================================================================
74 
77  struct LayerData {
78  // Number of attributes for the layer's interface.
80  // Number of aggregates for the layer's interface.
82  // Number of classes for this layer.
84  // Number of instances for this layer.
86  // Density of arcs between attributes of the same classe in this layer.
88  // The odds of an instance of the precedent layer to be added to a
89  // reference slot of a class of this layer.
91  };
92 
94  Size getDomainSize() const;
95 
97  void setDomainSize(Size s);
98 
101  Size getMaxParents() const;
102 
105  void setMaxParents(Size s);
106 
114  void setLayers(const std::vector< LayerData >& v);
115 
116  std::vector< LayerData >& getLayer();
117  const std::vector< LayerData >& getLayer() const;
118 
120  virtual PRM< GUM_SCALAR >* generate();
121 
123  private:
124  std::vector< LayerData > __layers;
127 
128  struct MyData {
129  // interface name
130  std::string i;
131  std::vector< std::string > a;
132  std::vector< std::string > g;
133  std::string r;
134  std::vector< std::string > c;
135  };
136 
138 
140  const std::string& type,
141  std::vector< MyData >& l);
142 
144  const std::string& type,
145  std::vector< typename LayerGenerator::MyData >& l);
146 
147  void __generateClassDag(Size lvl,
148  DAG& dag,
150  std::vector< typename LayerGenerator::MyData >& l);
151 
153  std::vector< typename LayerGenerator::MyData >& l);
154  };
155 
156  } /* namespace prm */
157 } /* namespace gum */
158 
160 
161 #endif /* GUM_LAYER_GENERATOR_H */
This class is the base class to all PRM generators.
Definition: PRMGenerator.h:46
Headers of PRMGenerator.
Class for generating bayesian networks.
gum is the global namespace for all aGrUM entities
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:47
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:63
virtual ~LayerGenerator()
Destructor.
std::vector< LayerData > & getLayer()
Returns the domain size of generated types.
Headers of PRMGenerator.
std::vector< std::string > g
Inline implementation of LayerGenerator.
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:45
std::vector< std::string > c
Base class for dag.
Definition: DAG.h:99
LayerGenerator & operator=(const LayerGenerator &source)
Copy operator.
Headers of PRMFactory.
void __generateClassDag(Size lvl, DAG &dag, Bijection< std::string, NodeId > &names, std::vector< typename LayerGenerator::MyData > &l)
std::string __generateType(PRMFactory< GUM_SCALAR > &f)