DoubleRandomStrategy.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2009 by Robot Group Leipzig                        *
00003  *    martius@informatik.uni-leipzig.de                                    *
00004  *    fhesse@informatik.uni-leipzig.de                                     *
00005  *    der@informatik.uni-leipzig.de                                        *
00006  *    guettler@informatik.uni-leipzig.de                                   *
00007  *    jhoffmann@informatik.uni-leipzig.de                                  *
00008  *    joergweide84@aol.com (robot12)                                       *
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  *   This class is a implementation for the IRandomStrategy interface and  *
00027  *   for the random strategy of the GenPrototype. It create a IValue from  *
00028  *   type double with a random double value.                               *
00029  *                                                                         *
00030  *   $Log: DoubleRandomStrategy.h,v $
00031  *   Revision 1.3  2009/07/21 08:37:59  robot12
00032  *   add some comments
00033  *
00034  *   Revision 1.2  2009/06/25 10:02:38  robot12
00035  *   finish the Random strategy and add some comments
00036  *
00037  *   Revision 1.1  2009/05/04 15:27:57  robot12
00038  *   rename of some files and moving files to other positions
00039  *    - SingletonGenAlgAPI has one error!!! --> is not ready now
00040  *
00041  *   Revision 1.2  2009/04/30 14:32:34  robot12
00042  *   some implements... Part5
00043  *
00044  *   Revision 1.1  2009/04/30 11:51:26  robot12
00045  *   some implements... new classes
00046  *
00047  *
00048  *
00049  ***************************************************************************/
00050 
00051 #ifndef DOUBLERANDOMSTRATEGY_H_
00052 #define DOUBLERANDOMSTRATEGY_H_
00053 
00054 //includes
00055 #include <selforg/randomgenerator.h>
00056 
00057 //forward declarations
00058 class IValue;
00059 
00060 //ga_tools includes
00061 #include "IRandomStrategy.h"
00062 
00063 /**
00064  * This class create a IValue (TemplateValue with type double) and initialize it with an random double value.
00065  * The value have basically a math. range from zero to one. With the parameter factor you can change it to zero to factor.
00066  * With the parameter base you can move the interval. With the last parameter you can defied the interval by zero and move
00067  * away from zero.
00068  */
00069 class DoubleRandomStrategy : public IRandomStrategy {
00070 public:
00071         /**
00072          * The constructor.
00073          * It becomes the 3 parameters which the class need to generate double value in a special range.
00074          * @param random (RandGen*) random generator which create double values in the range zero to one.
00075          * @param base (double) A parameter for the alg. it move a random value.
00076          * @param factor (double) A parameter which resize the interval of the random values.
00077          * @param epsilon (double) A parameter which dified the interval of the random values.
00078          */
00079         DoubleRandomStrategy(RandGen* random, double base=0.0, double factor=1.0, double epsilon=0.0);
00080 
00081         /**
00082          * default destructor
00083          */
00084         virtual ~DoubleRandomStrategy();
00085 
00086         /**
00087          * implementation for the interface. It create the random double value and give it as a IValue back (TemplateValue with type double)
00088          * @return (IValue*) the random value.
00089          */
00090         virtual IValue* getRandomValue(void);
00091 
00092 protected:
00093         /**
00094          * the random generator
00095          */
00096         RandGen* m_random;
00097 
00098         /**
00099          * base parameter. moves the random value interval.
00100          */
00101         double m_base;
00102 
00103         /**
00104          * factor parameter. resize the random value interval.
00105          */
00106         double m_factor;
00107 
00108         /**
00109          * epsilon parameter. dified the random value interval by zero and move it away.
00110          */
00111         double m_epsilon;
00112 
00113 private:
00114         /**
00115          * disable default constructor
00116          */
00117         DoubleRandomStrategy();
00118 };
00119 
00120 #endif /* DOUBLERANDOMSTRATEGY_H_ */

Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7