LoveBrains  1.0.0
simulator_config.h
1 /*
2 ** simulatior_config.h for LoveBrains in /home/robin_f/Programming/Git/CPP/LoveBrains
3 **
4 ** Made by Guillaume ROBIN
5 ** Login <robin_f@epitech.eu>
6 **
7 ** Started on Thu Jul 23 13:51:41 2015 Guillaume ROBIN
8 ** Last update Wed Aug 26 12:45:10 2015 Guillaume ROBIN
9 */
10 
11 #ifndef SIMULATOR_CONFIG_H_
12 # define SIMULATOR_CONFIG_H_
13 
14 # include <vector>
15 # include <string>
16 
17 # include "Simulator/simulator_exception.h"
18 # include "ANN/neural_net.h"
19 
20 namespace Simulator
21 {
26  class SConfig
27  {
28  public:
32  enum class DisplayMode { NONE, ENVIRONMENT_2D };
36  SConfig(void) throw();
40  ~SConfig(void) throw();
41 
42  /*
43  ** Setters.
44  */
45 
51  void setCrossingRate(double rate);
57  void setMutationRate(double rate);
63  void setSelectionRate(double rate);
68  void setExpectedFitness(double rate) throw();
74  void setPoolSize(unsigned int size);
79  void setMaxEpochs(int max) throw();
84  void setReportInterval(unsigned int interval) throw();
90  void setPopulationSize(unsigned int size);
96  void setANNInfos(std::string infos);
103  void setActivation(GANN::ANNLayer::FActivate function, GANN::ANN::ActivationType type);
110  void setOutputsActivation(GANN::ANNLayer::FActivate function,
111  GANN::ANN::ActivationType type);
118  void setEnvironmentSize(unsigned int width, unsigned int height);
123  void setIsTournament(bool isTournament) throw();
128  void setDisplayMode(DisplayMode display) throw();
129 
130  /*
131  ** Getters.
132  */
133 
138  double getCrossingRate(void) const throw();
143  double getMutationRate(void) const throw();
148  double getSelectionRate(void) const throw();
153  double getExpectedFitness(void) const throw();
158  unsigned int getPoolSize(void) const throw();
163  int getMaxEpochs(void) const throw();
168  unsigned int getReportInterval(void) const throw();
173  unsigned int getPopulationSize(void) const throw();
178  std::vector<unsigned int> const& getANNInfos(void) const throw();
183  GANN::ANNLayer::FActivate getActivation(void) const throw();
188  GANN::ANNLayer::FActivate getOutputsActivation(void) const throw();
193  unsigned int getEnvironmentWidth(void) const throw();
198  unsigned int getEnvironmentHeight(void) const throw();
203  GANN::ANN::ActivationType getLayerActivationType(void) const throw();
208  GANN::ANN::ActivationType getOutputActivationType(void) const throw();
213  bool isTournament(void) const throw();
218  DisplayMode getDisplayMode(void) const throw();
219 
220  /*
221  ** Overlaod.
222  */
223  SConfig& operator=(SConfig const& config);
224 
225  private:
226  DisplayMode _display;
227  bool _isTournament;
228  double _crossing_rate;
229  double _mutation_rate;
230  double _selection_rate;
231  double _expected_fitness;
232  unsigned int _pool_size;
233  int _max_epochs;
234  unsigned int _report_interval;
235  unsigned int _pop_size;
236  unsigned int _env_width;
237  unsigned int _env_height;
238  GANN::ANNLayer::FActivate _activation;
239  GANN::ANNLayer::FActivate _output_activation;
240  std::vector<unsigned int> _infos;
241  GANN::ANN::ActivationType _layer_ftype;
242  GANN::ANN::ActivationType _out_ftype;
243  };
244 }
245 
246 #endif /* !SIMULATOR_CONFIG_H_ */
void setOutputsActivation(GANN::ANNLayer::FActivate function, GANN::ANN::ActivationType type)
Set the activation function for the output layer of the neural network.
Definition: simulator_config.cc:141
void setPopulationSize(unsigned int size)
Set the population size of the GAEngine.
Definition: simulator_config.cc:93
void setActivation(GANN::ANNLayer::FActivate function, GANN::ANN::ActivationType type)
Set the activation function for the intern layers of the neural network.
Definition: simulator_config.cc:133
DisplayMode
Contains several display options.
Definition: simulator_config.h:32
void setPoolSize(unsigned int size)
Set the pool size for the tournament in the GAEngine.
Definition: simulator_config.cc:75
unsigned int getEnvironmentHeight(void) const
Get the window's height.
Definition: simulator_config.cc:231
SConfig(void)
Constructor.
Definition: simulator_config.cc:23
unsigned int getEnvironmentWidth(void) const
Get the window's width.
Definition: simulator_config.cc:226
Manage the configuration of the simulator.
Definition: simulator_config.h:26
unsigned int getReportInterval(void) const
Get the report interval member.
Definition: simulator_config.cc:201
GANN::ANN::ActivationType getOutputActivationType(void) const
Get the type of the activation function pointer inside the output layer.
Definition: simulator_config.cc:241
Definition: json.h:1186
int getMaxEpochs(void) const
Get the maximum epochs member.
Definition: simulator_config.cc:196
void setMaxEpochs(int max)
Set the maximum epochs for the GAEngine.
Definition: simulator_config.cc:83
void setDisplayMode(DisplayMode display)
Set the display mode of the environment.
Definition: simulator_config.cc:163
unsigned int getPoolSize(void) const
Get the pool size member.
Definition: simulator_config.cc:191
unsigned int getPopulationSize(void) const
Get the population size member.
Definition: simulator_config.cc:206
void setSelectionRate(double rate)
Set the selection rate that will be used by the GAEngine.
Definition: simulator_config.cc:62
Contains objects that manage the simulation.
std::vector< unsigned int > const & getANNInfos(void) const
Get the neural network topology member.
Definition: simulator_config.cc:211
GANN::ANN::ActivationType getLayerActivationType(void) const
Get the type of the activation function pointer inside an intern layer.
Definition: simulator_config.cc:236
void setANNInfos(std::string infos)
Set the topology of the neural network used by the AI objects.
Definition: simulator_config.cc:101
GANN::ANNLayer::FActivate getActivation(void) const
Get the activation function pointer of the intern layers.
Definition: simulator_config.cc:216
void setEnvironmentSize(unsigned int width, unsigned int height)
Set the environment size (window size).
Definition: simulator_config.cc:150
double getMutationRate(void) const
Get the mutation rate member.
Definition: simulator_config.cc:176
void setCrossingRate(double rate)
Set the crossing rate that will be used by the GAEngine.
Definition: simulator_config.cc:46
Contains all the objects that provide the management for the genetic algorithm with neural networks...
Definition: ann_exception.h:16
double getExpectedFitness(void) const
Get the expected fitness member.
Definition: simulator_config.cc:186
void setReportInterval(unsigned int interval)
Set the report interval for the GAEngine.
Definition: simulator_config.cc:88
void setIsTournament(bool isTournament)
Set if it's a tournament or not.
Definition: simulator_config.cc:158
void setExpectedFitness(double rate)
Set the expected fitness that will be used by the GAEngine.
Definition: simulator_config.cc:70
void setMutationRate(double rate)
Set the mutation rate that will be used by the GAEngine.
Definition: simulator_config.cc:54
bool isTournament(void) const
Get the boolean that says if it's a tournament.
Definition: simulator_config.cc:246
GANN::ANNLayer::FActivate getOutputsActivation(void) const
Get the activation function pointer of the output layer.
Definition: simulator_config.cc:221
double getSelectionRate(void) const
Get the selection rate member.
Definition: simulator_config.cc:181
double getCrossingRate(void) const
Get the crossing rate member.
Definition: simulator_config.cc:171
DisplayMode getDisplayMode(void) const
Get the current display mode of the environment.
Definition: simulator_config.cc:251