LoveBrains  1.0.0
ann_generator.h
1 /*
2 ** ann_generator.h for GANNEngine in /home/robin_f/Programming/Git/CPP/GANNEngine
3 **
4 ** Made by Guillaume ROBIN
5 ** Login <robin_f@epitech.eu>
6 **
7 ** Started on Tue Jul 21 16:39:03 2015 Guillaume ROBIN
8 ** Last update Fri Aug 21 23:23:30 2015 Guillaume ROBIN
9 */
10 
11 #ifndef ANN_GENERATOR_H_
12 # define ANN_GENERATOR_H_
13 
14 # include <vector>
15 
16 #include "ANN/neural_net.h"
17 # include "ANN/ann_layer.h"
18 # include "GA/i_generator.h"
19 # include "GA/i_dna.h"
20 
21 namespace GANN
22 {
28  {
29  public:
33  ANNGenerator(void) throw();
39  ANNGenerator(std::vector<unsigned int> const& infos, double crossing_rate) throw();
43  ~ANNGenerator(void) throw();
44 
45  /*
46  ** Setters.
47  */
48 
54  void init(std::vector<unsigned int> const& infos, double crossing_rate) throw();
60  void setRandomize(double min, double max) throw();
67  ANN::ActivationType type) throw();
74  ANN::ActivationType type) throw();
75 
76  /*
77  ** Getters.
78  */
79 
84  std::vector<unsigned int> const& getInfos(void) const throw();
89  double getCrossingRate(void) const throw();
94  double getRandomMin(void) const throw();
99  double getRandomMax(void) const throw();
104  ANNLayer::FActivate getActivation(void) const throw();
109  ANNLayer::FActivate getOutputsActivation(void) const throw();
114  ANN::ActivationType getOutputType(void) const throw();
119  ANN::ActivationType getLayerType(void) const throw();
120 
121  /*
122  ** Overload.
123  */
124  ANNGenerator& operator=(ANNGenerator const& gen) throw();
125 
126  /*
127  ** Methods.
128  */
129 
134  GA::IDNA *Generate(void) const throw();
135 
136  private:
137  std::vector<unsigned int> _infos;
138  double _crossing_rate;
139  double _rand_min;
140  double _rand_max;
141  ANNLayer::FActivate _activation;
142  ANNLayer::FActivate _output_function;
143  ANN::ActivationType _out_ftype;
144  ANN::ActivationType _layer_ftype;
145  };
146 }
147 
148 #endif /* !ANN_GENERATOR_H_ */
ANNLayer::FActivate getOutputsActivation(void) const
Get the activation function pointer of the output layer.
Definition: ann_generator.cc:98
Define the interface that will be used to create an supported individual for the GAEngine.
Definition: i_dna.h:22
Define the interface that allow to define a new generator of individual for the GAEngine.
Definition: i_generator.h:22
Define the generator of a neural network.
Definition: ann_generator.h:27
std::vector< unsigned int > const & getInfos(void) const
Get the topology of the neural network.
Definition: ann_generator.cc:73
void setActivationFunction(ANNLayer::FActivate function, ANN::ActivationType type)
Set the activation function of the intern layers.
Definition: ann_generator.cc:56
ANN::ActivationType getOutputType(void) const
Get the activation function's type of the intern layers.
Definition: ann_generator.cc:103
void setOutputsActivation(ANNLayer::FActivate function, ANN::ActivationType type)
Set the activation function of the output layer.
Definition: ann_generator.cc:63
double(* FActivate)(double)
Function pointer of an activation function.
Definition: ann_layer.h:31
ANNLayer::FActivate getActivation(void) const
Get the activation function pointer of the intern layers.
Definition: ann_generator.cc:93
ANNGenerator(void)
Constructor.
Definition: ann_generator.cc:23
Contains all the objects that provide the management for the genetic algorithm with neural networks...
Definition: ann_exception.h:16
ActivationType
Define the type of the activation function.
Definition: neural_net.h:30
double getRandomMin(void) const
Get the minimum value of the randomization range.
Definition: ann_generator.cc:83
void setRandomize(double min, double max)
Set the range of the randomization.
Definition: ann_generator.cc:50
double getRandomMax(void) const
Get the maximum value of the randomization range.
Definition: ann_generator.cc:88
~ANNGenerator(void)
Destructor.
Definition: ann_generator.cc:37
ANN::ActivationType getLayerType(void) const
Get the activaton function's type of the output layer.
Definition: ann_generator.cc:108
double getCrossingRate(void) const
Get the crossing rate of the neural network.
Definition: ann_generator.cc:78
void init(std::vector< unsigned int > const &infos, double crossing_rate)
Initialize the generator.
Definition: ann_generator.cc:44
GA::IDNA * Generate(void) const
Generate a new neural network.
Definition: ann_generator.cc:132