Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SingletonGenAlgAPI.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2008-2011 LpzRobots development team *
3  * Joerg Weider <joergweide84 at aol dot com> (robot12) *
4  * Georg Martius <georg dot martius at web dot de> *
5  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
6  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
7  * Ralf Der <ralfder at mis dot mpg dot de> *
8  * Joern Hoffmann <jhoffmann at informatik dot uni-leipzig dot de *
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  * This program is distributed in the hope that it will be useful, *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18  * GNU General Public License for more details. *
19  * *
20  * You should have received a copy of the GNU General Public License *
21  * along with this program; if not, write to the *
22  * Free Software Foundation, Inc., *
23  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24  * *
25  ***************************************************************************/
26 
27 #ifndef SINGLETONGENALGAPI_H_
28 #define SINGLETONGENALGAPI_H_
29 
30 //includes
31 #include <string>
32 #include <list>
33 #include <selforg/randomgenerator.h>
34 
35 //forward declaration
36 class Gen;
37 class GenPrototype;
38 class GenContext;
39 class Individual;
40 class Generation;
41 class IMutationStrategy;
43 class ISelectStrategy;
45 class IRandomStrategy;
46 class IValue;
47 class IFitnessStrategy;
48 
49 //forward declaration for LPZROBOTS
50 class PlotOptionEngine;
51 class PlotOption;
52 
53 //ga_tools includes
54 #include "SingletonGenEngine.h"
55 
56 /**
57  * This is a facade for the gen. alg.
58  *
59  * Over this is the class as singleton concepted. Only one API for a run.
60  */
62 public:
63  // Action
64  /**
65  * starts the selection
66  * @param createNextGeneration (bool) normal=true should be the next generation be prepare?
67  */
68  void select(bool createNextGeneration=true);
69  /**
70  * create the children from to fill up the next generation
71  * @param random (RandGen*) random generator
72  */
73  void crossover(RandGen* random);
74  /**
75  * update the internal statistical data
76  * @param factor (double) normal=1.5 is needed for the whisker distance
77  */
78  void update(double factor = 1.5);
79  /**
80  * prepares the first generation and optional the enabled measure
81  * @param startSize (int) Number of individual at begin of the gen. alg.
82  * @param startChildren (int) Number of individual which will be created by crossover
83  * @param random (RandGen*) A random generator
84  * @param withUpdate (bool) is needed for "generateFirstGeneration"
85  */
86  void prepare(int startSize, int numChildren, RandGen* random, bool withUpdate = true);
87  /**
88  * prepares the next generation and optional the enabled measure
89  */
90  void prepare();
91  /**
92  * makes a step in the measure
93  * @param time (double) time stamp in the measure
94  */
95  void measureStep(double time);
96  /**
97  * start the sequenz of select, crossover, update in a automatically loop
98  * @param startSize (int) Number of individual at begin of the gen. alg.
99  * @param numChildren (int) Number of individual which will be created by crossover
100  * @param numGeneration (int) Number of generation which the alg. max. runs
101  * @param random (RandGen*) random generator
102  */
103  void runGenAlg(int startSize, int numChildren, int numGeneration, RandGen* random);
104 
105  //measure
106  /**
107  * enables data measure with more than one plotOption.
108  * @param plotOptions (list<PöotOption>&) the list
109  */
110  void enableMeasure(std::list<PlotOption>& plotOptions);
111  /**
112  * enables da : public Storableta measure.
113  * @param plotOption (PlotOption&) the plot option
114  */
115  void enableMeasure(PlotOption& plotOption);
116  /**
117  * returns the active plotOptionEngine for data measure.
118  * @return (PlotOptionEngine*) the plot option engine
119  */
120  inline PlotOptionEngine* getPlotOptionEngine(void)const {return m_plotEngine;}
121  /**
122  * enable data measure inside the GenContexts with more than one plotOption
123  * @param plotOptions (list<PlotOption>&) the list
124  */
125  void enableGenContextMeasure(std::list<PlotOption>& plotOptions);
126  /**
127  * enable data measure inside the GenContexts.
128  * @param plotOption (PlotOption&) the plot option
129  */
130  void enableGenContextMeasure(PlotOption& plotOption);
131  /**
132  * returns the active plotOptionEngine for data measure inside the GenContexts.
133  * @return (PlotOptionEngine*) the plot option engine.
134  */
136 
137  // set static strategies
138  /**
139  * set the generation size strategy
140  * @param strategy (IGenerationSizeStrategy*) the strategy
141  */
143  /**
144  * set the fitness strategy
145  * @param strategy (IFitnessStrategy*) the strategy
146  */
148  /**
149  * set the select strategy
150  * @param strategy (ISelectStrategy*) the strategy
151  */
153 
154  // gets
155  /**
156  * returns the GenAlgEngine
157  * @return (SingletonGenEngine*) the engine
158  */
159  SingletonGenEngine* getEngine(void)const;
160 
161  // default interface creation
162  /**
163  * creates a SumFitnessStrategy. This strategy make the sum of all gens with a double value.
164  * @return (IFitnessStrategy*) the strategy
165  */
167  /**
168  * creates a EuclidicFitnessStrategy. This strategy calculate the euclidic distance of all gens with a double value.
169  * @return (IFitnessStrategy*) the strategy
170  */
172  /**
173  * creates a TestFitnessStrategy which is the hardest test for a gen. alg. Only a smale area has a fitness. All other gives no information!
174  * @param fitness (IFitnessStrategy*) a other fitness strat* Over this is the class as singleton concepted. Only one engine for a run.egy which define the smal area.
175  * @return (IFitnessStrategy*) the strategy
176  */
178  /**
179  * creates the test function fitness strategy from the papper tp this alg.
180  * f(x,y) = 10.0 * (x² + 2.5y² - y) * exp(1 - (x² + y²)) + 2.4 + 0.1x² + 0.1y² * @return (IFitnessStrategy*) the strategy */ IFitnessStrategy* createTestFitnessStrategy()const; /** * returns a fitness strategy which calculate the inverse value from a other strategy. * @param strategy (IFitnessStrategy*) the other strategy * @return (IFitnessStrategy*) the resulting strategy */ IFitnessStrategy* createInvertedFitnessStrategy(IFitnessStrategy* strategy)const; /** * creates a random strategy for double values. * The values will be generated in the intervals [base-epsilon:-epsilon] or [epsilon:factor+base+epsilon] * * This means a random value in the interval [0:1] will be mul. with factor => [0:factor] * After this it will be shifted by base => [base:factor+base] * And than divided at the point zero and moved away by epsilon from the point zero * => [base-epsilon:-epsilon], [epsilon:factor+base+epsilon] * * For example: * We want values in the intervals [-10:-5] and [5:10]. * ==> epsilon=5 * ==> [-5:5] * ==> base=-5 * ==> [0:10] * ==> factor=10 * * @param random (RandGen*) random generator * @param base (double) normal=0.0 moves the ground interval * @param factor (double) normal=1.0 resize the interval * @param epsilon (double) normal=0.0 devided the interval at the point zero and move the * values by epsilon away from point zero * @return (IRandomStrategy*) the strategy */ IRandomStrategy* createDoubleRandomStrategy(RandGen* random, double base=0.0, double factor=1.0, double epsilon = 0.0)const; /** * creates mutation strategy which change the old values by add a other value * @param strategy (IMutationFactorStrategy*) this strategy define what the other value is. * @param mutationProbability (int) the probability of mutation in one per tausend (1/1000) * @return (IMutationStrategy*) the strategy */ IMutationStrategy* createValueMutationStrategy(IMutationFactorStrategy* strategy, int mutationProbability)const; /** * creates a mutation factor strategy with a fix value * @param value (IValue*) the fix value. * @return (IMutationFactorStrategy*) the strategy */ IMutationFactorStrategy* createFixMutationFactorStrategy(IValue* value)const; /** * creates a mutation factor strategy with a optimized value (varianz about all existing gens) * @return (IMutationFactorStrategy*) the strategy */ IMutationFactorStrategy* createStandartMutationFactorStrategy(void)const; /** * creates a generation size strategy with a fix value * @param value (int) the size of the generation * @return (IGenerationSizeStrategy*) the strategy */ IGenerationSizeStrategy* createFixGenerationSizeStrategy(int value)const; /** * creates a generation size strategy with a optimized size for the generation (changing by speed of development) * @param startSize (int) the size at the start time * @param numGeneration (int) number of generation. (needed for the speed calculation * @return (IGenerationSizeStrategy*) the strategy */ IGenerationSizeStrategy* createStandartGenerationSizeStrategy(int startSize, int numGeneration)const; /** * creates a elite select strategy * @return (ISelectStrategy*) the strategy */ ISelectStrategy* createEliteSelectStrategy(void)const; /** * creates a tournament SelctStrategy. By this strategy will two individual fight again * (the individual with the higher fitness lives longer). * @param random (RandGen*) random generator * @return (ISelectStrategy*) the strategy */ ISelectStrategy* createTournamentSelectStrategy(RandGen* random)const; /** * creates a random select strategy. By this strategy will a random selected individual fight again a random number. * If the random number higher than the fitness from the individual, than it will be die. * @param random (RandGen*) ranom generator * @return (ISelectStrategy*) the strategy */ ISelectStrategy* createRandomSelectStrategy(RandGen* random)const; /** * creates a IValue (TemplateValue<double) from type double. * @param value (double) the value * @return (IValue*) the new object */ IValue* createDoubleValue(double value)const; //Storable /** stores the object to the given file stream (binary). */ bool storeGA(FILE* f) const; /** loads the object from the given file stream (binary). */ bool restoreGA(FILE* f) const; // inserts /** * add a GenPrototype to the alg. * @param prototype (GenPrototype*) the prototype */ void insertGenPrototype(GenPrototype* prototype); // object creation /** * create a prototype. * @param name (STRING) THE NAME OF THE PROTOTYPE * @param randomStrategy (IRandomStrategy*) the random strategy to generate values of the type * which the prototype represent * @param mutationStrategy (IMutationStrategy*) the mutation strategy to change a value (Gen) * @return (GenPrototype*) the prototype */ GenPrototype* createPrototype(std::string name, IRandomStrategy* randomStrategy, IMutationStrategy* mutationStrategy)const; // singleton /** * returns the one and only API to the alg. * @return (SingletonGenAlgAPI*) the api */ inline static SingletonGenAlgAPI* getInstance(void) {if(m_api==0)m_api = new SingletonGenAlgAPI();return m_api;} /** * destroy the api * @param cleanStrategies (bool) default = false set a flag to clean the strategies, which are seted. */ inline static void destroyAPI(bool cleanStrategies=false) {getInstance()->m_cleanStrategies=cleanStrategies; if(m_api!=0){delete m_api;m_api=0;}} // data access /** * returns the best individual which the alg. have found * @return (Individual*) the best */ inline Individual* getBestIndividual(void)const {return SingletonGenEngine::getInstance()->getBestIndividual();} protected: /** * the api */ static SingletonGenAlgAPI* m_api; /** * plot option engine for data measure */ PlotOptionEngine* m_plotEngine; /** * plot option engine for gen contexts */ PlotOptionEngine* m_plotEngineGenContext; private: /** * disable the default contructor */ SingletonGenAlgAPI(); /** * disable the default destructor */ virtual ~SingletonGenAlgAPI(); /** * help declaration for prepare */ void* m_generation; /** * help declaration for prepare */ void* m_inspectable; /** * Flag for clean the strategies */ bool m_cleanStrategies; }; #endif /* SINGLETONGENALGAPI_H_ */
181  * @return (IFitnessStrategy*) the strategy
182  */
184  /**
185  * returns a fitness strategy which calculate the inverse value from a other strategy.
186  * @param strategy (IFitnessStrategy*) the other strategy
187  * @return (IFitnessStrategy*) the resulting strategy
188  */
190  /**
191  * creates a random strategy for double values.
192  * The values will be generated in the intervals [base-epsilon:-epsilon] or [epsilon:factor+base+epsilon]
193  *
194  * This means a random value in the interval [0:1] will be mul. with factor => [0:factor]
195  * After this it will be shifted by base => [base:factor+base]
196  * And than divided at the point zero and moved away by epsilon from the point zero
197  * => [base-epsilon:-epsilon], [epsilon:factor+base+epsilon]
198  *
199  * For example:
200  * We want values in the intervals [-10:-5] and [5:10].
201  * ==> epsilon=5
202  * ==> [-5:5]
203  * ==> base=-5
204  * ==> [0:10]
205  * ==> factor=10
206  *
207  * @param random (RandGen*) random generator
208  * @param base (double) normal=0.0 moves the ground interval
209  * @param factor (double) normal=1.0 resize the interval
210  * @param epsilon (double) normal=0.0 devided the interval at the point zero and move the
211  * values by epsilon away from point zero
212  * @return (IRandomStrategy*) the strategy
213  */
214  IRandomStrategy* createDoubleRandomStrategy(RandGen* random, double base=0.0, double factor=1.0, double epsilon = 0.0)const;
215  /**
216  * creates mutation strategy which change the old values by add a other value
217  * @param strategy (IMutationFactorStrategy*) this strategy define what the other value is.
218  * @param mutationProbability (int) the probability of mutation in one per tausend (1/1000)
219  * @return (IMutationStrategy*) the strategy
220  */
221  IMutationStrategy* createValueMutationStrategy(IMutationFactorStrategy* strategy, int mutationProbability)const;
222  /**
223  * creates a mutation factor strategy with a fix value
224  * @param value (IValue*) the fix value.
225  * @return (IMutationFactorStrategy*) the strategy
226  */
228  /**
229  * creates a mutation factor strategy with a optimized value (varianz about all existing gens)
230  * @return (IMutationFactorStrategy*) the strategy
231  */
233  /**
234  * creates a generation size strategy with a fix value
235  * @param value (int) the size of the generation
236  * @return (IGenerationSizeStrategy*) the strategy
237  */
239  /**
240  * creates a generation size strategy with a optimized size for the generation (changing by speed of development)
241  * @param startSize (int) the size at the start time
242  * @param numGeneration (int) number of generation. (needed for the speed calculation
243  * @return (IGenerationSizeStrategy*) the strategy
244  */
245  IGenerationSizeStrategy* createStandartGenerationSizeStrategy(int startSize, int numGeneration)const;
246  /**
247  * creates a elite select strategy
248  * @return (ISelectStrategy*) the strategy
249  */
251  /**
252  * creates a tournament SelctStrategy. By this strategy will two individual fight again
253  * (the individual with the higher fitness lives longer).
254  * @param random (RandGen*) random generator
255  * @return (ISelectStrategy*) the strategy
256  */
258  /**
259  * creates a random select strategy. By this strategy will a random selected individual fight again a random number.
260  * If the random number higher than the fitness from the individual, than it will be die.
261  * @param random (RandGen*) ranom generator
262  * @return (ISelectStrategy*) the strategy
263  */
265  /**
266  * creates a IValue (TemplateValue<double) from type double.
267  * @param value (double) the value
268  * @return (IValue*) the new object
269  */
270  IValue* createDoubleValue(double value)const;
271 
272  //Storable
273  /** stores the object to the given file stream (binary).
274  */
275  bool storeGA(FILE* f) const;
276 
277  /** loads the object from the given file stream (binary).
278  */
279  bool restoreGA(FILE* f) const;
280 
281  // inserts
282  /**
283  * add a GenPrototype to the alg.
284  * @param prototype (GenPrototype*) the prototype
285  */
286  void insertGenPrototype(GenPrototype* prototype);
287 
288  // object creation
289  /**
290  * create a prototype.
291  * @param name (STRING) THE NAME OF THE PROTOTYPE
292  * @param randomStrategy (IRandomStrategy*) the random strategy to generate values of the type
293  * which the prototype represent
294  * @param mutationStrategy (IMutationStrategy*) the mutation strategy to change a value (Gen)
295  * @return (GenPrototype*) the prototype
296  */
297  GenPrototype* createPrototype(std::string name, IRandomStrategy* randomStrategy, IMutationStrategy* mutationStrategy)const;
298 
299  // singleton
300  /**
301  * returns the one and only API to the alg.
302  * @return (SingletonGenAlgAPI*) the api
303  */
304  inline static SingletonGenAlgAPI* getInstance(void) {if(m_api==0)m_api = new SingletonGenAlgAPI();return m_api;}
305  /**
306  * destroy the api
307  * @param cleanStrategies (bool) default = false set a flag to clean the strategies, which are seted.
308  */
309  inline static void destroyAPI(bool cleanStrategies=false) {getInstance()->m_cleanStrategies=cleanStrategies; if(m_api!=0){delete m_api;m_api=0;}}
310 
311  // data access
312  /**
313  * returns the best individual which the alg. have found
314  * @return (Individual*) the best
315  */
317 
318 protected:
319  /**
320  * the api
321  */
323 
324  /**
325  * plot option engine for data measure
326  */
328 
329  /**
330  * plot option engine for gen contexts
331  */
333 
334 private:
335  /**
336  * disable the default contructor
337  */
339  /**
340  * disable the default destructor
341  */
342  virtual ~SingletonGenAlgAPI();
343 
344  /**
345  * help declaration for prepare
346  */
347  void* m_generation;
348 
349  /**
350  * help declaration for prepare
351  */
352  void* m_inspectable;
353 
354  /**
355  * Flag for clean the strategies
356  */
357  bool m_cleanStrategies;
358 };
359 
360 #endif /* SINGLETONGENALGAPI_H_ */
ISelectStrategy * createTournamentSelectStrategy(RandGen *random) const
creates a tournament SelctStrategy.
Definition: SingletonGenAlgAPI.cpp:137
void select(bool createNextGeneration=true)
starts the selection
Definition: SingletonGenAlgAPI.cpp:153
Individual * getBestIndividual(void)
returns the best individual (where the fitness is next to zero) which the alg.
Definition: SingletonGenEngine.cpp:311
IFitnessStrategy * createEuclidicDistanceFitnessStrategy() const
creates a EuclidicFitnessStrategy.
Definition: SingletonGenAlgAPI.cpp:93
this interface is for a select strategy of the generation class.
Definition: ISelectStrategy.h:36
IFitnessStrategy * createExtreamTestFitnessStrategy(IFitnessStrategy *fitness) const
creates a TestFitnessStrategy which is the hardest test for a gen.
Definition: SingletonGenAlgAPI.cpp:97
void enableGenContextMeasure(std::list< PlotOption > &plotOptions)
enable data measure inside the GenContexts with more than one plotOption
Definition: SingletonGenAlgAPI.cpp:227
void setSelectStrategy(ISelectStrategy *strategy)
decid the select strategy
Definition: SingletonGenEngine.h:217
Individual * getBestIndividual(void) const
returns the best individual which the alg.
Definition: SingletonGenAlgAPI.h:316
IFitnessStrategy * createSumFitnessStrategy() const
creates a SumFitnessStrategy.
Definition: SingletonGenAlgAPI.cpp:89
IMutationFactorStrategy * createFixMutationFactorStrategy(IValue *value) const
creates a mutation factor strategy with a fix value
Definition: SingletonGenAlgAPI.cpp:117
IMutationFactorStrategy * createStandartMutationFactorStrategy(void) const
creates a mutation factor strategy with a optimized value (varianz about all existing gens) ...
Definition: SingletonGenAlgAPI.cpp:121
This interface gives the structur for the mutation of a gen.
Definition: IMutationStrategy.h:39
void setFitnessStrategy(IFitnessStrategy *strategy)
decide the fitness strategy.
Definition: SingletonGenEngine.h:229
IFitnessStrategy * createTestFitnessStrategy() const
creates the test function fitness strategy from the papper tp this alg.
Definition: SingletonGenAlgAPI.cpp:101
IGenerationSizeStrategy * createStandartGenerationSizeStrategy(int startSize, int numGeneration) const
creates a generation size strategy with a optimized size for the generation (changing by speed of dev...
Definition: SingletonGenAlgAPI.cpp:129
void runGenAlg(int startSize, int numChildren, int numGeneration, RandGen *random)
start the sequenz of select, crossover, update in a automatically loop
Definition: SingletonGenAlgAPI.cpp:192
The Gen class.
Definition: Gen.h:51
The GenContext class.
Definition: GenContext.h:51
Definition: plotoptionengine.h:38
random generator with 48bit integer arithmentic
Definition: randomgenerator.h:34
ISelectStrategy * createRandomSelectStrategy(RandGen *random) const
creates a random select strategy.
Definition: SingletonGenAlgAPI.cpp:141
void setGenerationSizeStrategy(IGenerationSizeStrategy *strategy)
set the generation size strategy
Definition: SingletonGenAlgAPI.h:142
This is a interface for a strategy, which is used by ValueMutationStrategy.
Definition: IMutationFactorStrategy.h:40
PlotOptionEngine * getPlotOptionEngine(void) const
returns the active plotOptionEngine for data measure.
Definition: SingletonGenAlgAPI.h:120
The interface for the fitness strategy of an individual.
Definition: IFitnessStrategy.h:36
static SingletonGenAlgAPI * m_api
the api
Definition: SingletonGenAlgAPI.h:322
GenPrototype * createPrototype(std::string name, IRandomStrategy *randomStrategy, IMutationStrategy *mutationStrategy) const
create a prototype.
Definition: SingletonGenAlgAPI.cpp:196
This class contains options for the use of an external plot utility like guilogger or neuronviz or ju...
Definition: plotoption.h:66
void prepare()
prepares the next generation and optional the enabled measure
Definition: SingletonGenAlgAPI.cpp:170
ISelectStrategy * createEliteSelectStrategy(void) const
creates a elite select strategy
Definition: SingletonGenAlgAPI.cpp:133
This is the engine of the gen.
Definition: SingletonGenEngine.h:64
IValue * createDoubleValue(double value) const
creates a IValue (TemplateValue<double) from type double.
Definition: SingletonGenAlgAPI.cpp:145
this interface is to create a random IValue.
Definition: IRandomStrategy.h:36
IMutationStrategy * createValueMutationStrategy(IMutationFactorStrategy *strategy, int mutationProbability) const
creates mutation strategy which change the old values by add a other value
Definition: SingletonGenAlgAPI.cpp:113
This interface is to specify how big the next generation should be.
Definition: IGenerationSizeStrategy.h:36
The GenPrototype class.
Definition: GenPrototype.h:55
void enableMeasure(std::list< PlotOption > &plotOptions)
enables data measure with more than one plotOption.
Definition: SingletonGenAlgAPI.cpp:211
PlotOptionEngine * m_plotEngineGenContext
plot option engine for gen contexts
Definition: SingletonGenAlgAPI.h:332
PlotOptionEngine * m_plotEngine
plot option engine for data measure
Definition: SingletonGenAlgAPI.h:327
The Generation class.
Definition: Generation.h:53
This class is a interface for a value which is part of a gen.
Definition: IValue.h:38
IRandomStrategy * createDoubleRandomStrategy(RandGen *random, double base=0.0, double factor=1.0, double epsilon=0.0) const
creates a random strategy for double values.
Definition: SingletonGenAlgAPI.cpp:109
static void destroyAPI(bool cleanStrategies=false)
destroy the api
Definition: SingletonGenAlgAPI.h:309
bool restoreGA(FILE *f) const
loads the object from the given file stream (binary).
Definition: SingletonGenAlgAPI.cpp:240
This is a facade for the gen.
Definition: SingletonGenAlgAPI.h:61
void measureStep(double time)
makes a step in the measure
Definition: SingletonGenAlgAPI.cpp:188
void setFitnessStrategy(IFitnessStrategy *strategy)
set the fitness strategy
Definition: SingletonGenAlgAPI.h:147
SingletonGenEngine * getEngine(void) const
returns the GenAlgEngine
Definition: SingletonGenAlgAPI.cpp:149
void insertGenPrototype(GenPrototype *prototype)
add a GenPrototype to the alg.
Definition: SingletonGenAlgAPI.cpp:200
bool storeGA(FILE *f) const
stores the object to the given file stream (binary).
Definition: SingletonGenAlgAPI.cpp:236
static SingletonGenAlgAPI * getInstance(void)
returns the one and only API to the alg.
Definition: SingletonGenAlgAPI.h:304
void setGenerationSizeStrategy(IGenerationSizeStrategy *strategy)
decide the generation size strategy.
Definition: SingletonGenEngine.h:223
This class represent one individual of the complete gen.
Definition: Individual.h:45
void update(double factor=1.5)
update the internal statistical data
Definition: SingletonGenAlgAPI.cpp:162
IFitnessStrategy * createInvertedFitnessStrategy(IFitnessStrategy *strategy) const
returns a fitness strategy which calculate the inverse value from a other strategy.
Definition: SingletonGenAlgAPI.cpp:105
void setSelectStrategy(ISelectStrategy *strategy)
set the select strategy
Definition: SingletonGenAlgAPI.h:152
IGenerationSizeStrategy * createFixGenerationSizeStrategy(int value) const
creates a generation size strategy with a fix value
Definition: SingletonGenAlgAPI.cpp:125
static SingletonGenEngine * getInstance(void)
returns the only existing engine.
Definition: SingletonGenEngine.h:269
void crossover(RandGen *random)
create the children from to fill up the next generation
Definition: SingletonGenAlgAPI.cpp:157
PlotOptionEngine * getPlotOptionEngineForGenContext(void) const
returns the active plotOptionEngine for data measure inside the GenContexts.
Definition: SingletonGenAlgAPI.h:135