DoubleRandomStrategy.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008-2011 LpzRobots development team                    *
00003  *    Joerg Weider   <joergweide84 at aol dot com> (robot12)               *
00004  *    Georg Martius  <georg dot martius at web dot de>                     *
00005  *    Frank Guettler <guettler at informatik dot uni-leipzig dot de        *
00006  *    Frank Hesse    <frank at nld dot ds dot mpg dot de>                  *
00007  *    Ralf Der       <ralfder at mis dot mpg dot de>                       *
00008  *    Joern Hoffmann <jhoffmann at informatik dot uni-leipzig dot de       *
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  *   This program is distributed in the hope that it will be useful,       *
00016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00018  *   GNU General Public License for more details.                          *
00019  *                                                                         *
00020  *   You should have received a copy of the GNU General Public License     *
00021  *   along with this program; if not, write to the                         *
00022  *   Free Software Foundation, Inc.,                                       *
00023  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00024  *                                                                         *
00025  ***************************************************************************/
00026 
00027 #ifndef DOUBLERANDOMSTRATEGY_H_
00028 #define DOUBLERANDOMSTRATEGY_H_
00029 
00030 //includes
00031 #include <selforg/randomgenerator.h>
00032 
00033 //forward declarations
00034 class IValue;
00035 
00036 //ga_tools includes
00037 #include "IRandomStrategy.h"
00038 
00039 /**
00040  * This class create a IValue (TemplateValue with type double) and initialize it with an random double value.
00041  * The value have basically a math. range from zero to one. With the parameter factor you can change it to zero to factor.
00042  * With the parameter base you can move the interval. With the last parameter you can defied the interval by zero and move
00043  * away from zero.
00044  */
00045 class DoubleRandomStrategy : public IRandomStrategy {
00046 public:
00047         /**
00048          * The constructor.
00049          * It becomes the 3 parameters which the class need to generate double value in a special range.
00050          * @param random (RandGen*) random generator which create double values in the range zero to one.
00051          * @param base (double) A parameter for the alg. it move a random value.
00052          * @param factor (double) A parameter which resize the interval of the random values.
00053          * @param epsilon (double) A parameter which dified the interval of the random values.
00054          */
00055         DoubleRandomStrategy(RandGen* random, double base=0.0, double factor=1.0, double epsilon=0.0);
00056 
00057         /**
00058          * default destructor
00059          */
00060         virtual ~DoubleRandomStrategy();
00061 
00062         /**
00063          * implementation for the interface. It create the random double value and give it as a IValue back (TemplateValue with type double)
00064          * @return (IValue*) the random value.
00065          */
00066         virtual IValue* getRandomValue(void);
00067 
00068 protected:
00069         /**
00070          * the random generator
00071          */
00072         RandGen* m_random;
00073 
00074         /**
00075          * base parameter. moves the random value interval.
00076          */
00077         double m_base;
00078 
00079         /**
00080          * factor parameter. resize the random value interval.
00081          */
00082         double m_factor;
00083 
00084         /**
00085          * epsilon parameter. dified the random value interval by zero and move it away.
00086          */
00087         double m_epsilon;
00088 
00089 private:
00090         /**
00091          * disable default constructor
00092          */
00093         DoubleRandomStrategy();
00094 };
00095 
00096 #endif /* DOUBLERANDOMSTRATEGY_H_ */
Generated on Thu Jun 28 14:45:36 2012 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.6.3