RandomSelectStrategy.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 RANDOMSELECTSTRATEGY_H_
00028 #define RANDOMSELECTSTRATEGY_H_
00029 
00030 //includes
00031 #include <selforg/randomgenerator.h>
00032 
00033 //forward declaration
00034 class Generation;
00035 
00036 //ga_tools includes
00037 #include "ISelectStrategy.h"
00038 
00039 /**
00040  * This class makes a select by randomized comparison of one individual of the old generation
00041  * with a random number. If it lost, so it dosn't comes in the next generation. If enough
00042  * individual "killed", comes the living in the next generation.
00043  *
00044  * With this method it is possible that a bad individual comes in the next generation. So you dosn't
00045  * becomes a to elite generation and save some alternatives in the gens.
00046  * This way is in this point better than the EliteSelectStrategy. But worse than the TournamentSelectStrategy.
00047  */
00048 class RandomSelectStrategy :public ISelectStrategy {
00049 public:
00050         /**
00051          * constructor
00052          * @param random (RandGen*) a random generator. Is needed for the <<<randomized>>> comparison
00053          */
00054         RandomSelectStrategy(RandGen* random);
00055 
00056         /**
00057          * default destructor
00058          */
00059         virtual ~RandomSelectStrategy();
00060 
00061         /**
00062          * implementation for the interface ISelectStrategy
00063          * @param oldGeneration (Generation*) the old generation
00064          * @param newGeneration (Generation*) the next generation
00065          */
00066         virtual void select(Generation* oldGeneration, Generation* newGeneration);
00067 
00068 protected:
00069         /**
00070          * the random generator
00071          */
00072         RandGen* m_random;
00073 
00074 private:
00075         /**
00076          * disable the default constructor.
00077          */
00078         RandomSelectStrategy();
00079 };
00080 
00081 #endif /* RANDOMSELECTSTRATEGY_H_ */
Generated on Thu Jun 28 14:45:37 2012 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.6.3