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
DoubleRandomStrategy.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 DOUBLERANDOMSTRATEGY_H_
28 #define DOUBLERANDOMSTRATEGY_H_
29 
30 //includes
31 #include <selforg/randomgenerator.h>
32 
33 //forward declarations
34 class IValue;
35 
36 //ga_tools includes
37 #include "IRandomStrategy.h"
38 
39 /**
40  * This class create a IValue (TemplateValue with type double) and initialize it with an random double value.
41  * The value have basically a math. range from zero to one. With the parameter factor you can change it to zero to factor.
42  * With the parameter base you can move the interval. With the last parameter you can defied the interval by zero and move
43  * away from zero.
44  */
46 public:
47  /**
48  * The constructor.
49  * It becomes the 3 parameters which the class need to generate double value in a special range.
50  * @param random (RandGen*) random generator which create double values in the range zero to one.
51  * @param base (double) A parameter for the alg. it move a random value.
52  * @param factor (double) A parameter which resize the interval of the random values.
53  * @param epsilon (double) A parameter which dified the interval of the random values.
54  */
55  DoubleRandomStrategy(RandGen* random, double base=0.0, double factor=1.0, double epsilon=0.0);
56 
57  /**
58  * default destructor
59  */
60  virtual ~DoubleRandomStrategy();
61 
62  /**
63  * implementation for the interface. It create the random double value and give it as a IValue back (TemplateValue with type double)
64  * @return (IValue*) the random value.
65  */
66  virtual IValue* getRandomValue(void);
67 
68 protected:
69  /**
70  * the random generator
71  */
73 
74  /**
75  * base parameter. moves the random value interval.
76  */
77  double m_base;
78 
79  /**
80  * factor parameter. resize the random value interval.
81  */
82  double m_factor;
83 
84  /**
85  * epsilon parameter. dified the random value interval by zero and move it away.
86  */
87  double m_epsilon;
88 
89 private:
90  /**
91  * disable default constructor
92  */
94 };
95 
96 #endif /* DOUBLERANDOMSTRATEGY_H_ */
virtual IValue * getRandomValue(void)
implementation for the interface.
Definition: DoubleRandomStrategy.cpp:46
RandGen * m_random
the random generator
Definition: DoubleRandomStrategy.h:72
double m_base
base parameter.
Definition: DoubleRandomStrategy.h:77
random generator with 48bit integer arithmentic
Definition: randomgenerator.h:34
This class create a IValue (TemplateValue with type double) and initialize it with an random double v...
Definition: DoubleRandomStrategy.h:45
this interface is to create a random IValue.
Definition: IRandomStrategy.h:36
virtual ~DoubleRandomStrategy()
default destructor
Definition: DoubleRandomStrategy.cpp:42
This class is a interface for a value which is part of a gen.
Definition: IValue.h:38
double m_factor
factor parameter.
Definition: DoubleRandomStrategy.h:82
double m_epsilon
epsilon parameter.
Definition: DoubleRandomStrategy.h:87