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
RandomSelectStrategy.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 RANDOMSELECTSTRATEGY_H_
28 #define RANDOMSELECTSTRATEGY_H_
29 
30 //includes
31 #include <selforg/randomgenerator.h>
32 
33 //forward declaration
34 class Generation;
35 
36 //ga_tools includes
37 #include "ISelectStrategy.h"
38 
39 /**
40  * This class makes a select by randomized comparison of one individual of the old generation
41  * with a random number. If it lost, so it dosn't comes in the next generation. If enough
42  * individual "killed", comes the living in the next generation.
43  *
44  * With this method it is possible that a bad individual comes in the next generation. So you dosn't
45  * becomes a to elite generation and save some alternatives in the gens.
46  * This way is in this point better than the EliteSelectStrategy. But worse than the TournamentSelectStrategy.
47  */
49 public:
50  /**
51  * constructor
52  * @param random (RandGen*) a random generator. Is needed for the <<<randomized>>> comparison
53  */
55 
56  /**
57  * default destructor
58  */
59  virtual ~RandomSelectStrategy();
60 
61  /**
62  * implementation for the interface ISelectStrategy
63  * @param oldGeneration (Generation*) the old generation
64  * @param newGeneration (Generation*) the next generation
65  */
66  virtual void select(Generation* oldGeneration, Generation* newGeneration);
67 
68 protected:
69  /**
70  * the random generator
71  */
73 
74 private:
75  /**
76  * disable the default constructor.
77  */
79 };
80 
81 #endif /* RANDOMSELECTSTRATEGY_H_ */
this interface is for a select strategy of the generation class.
Definition: ISelectStrategy.h:36
random generator with 48bit integer arithmentic
Definition: randomgenerator.h:34
This class makes a select by randomized comparison of one individual of the old generation with a ran...
Definition: RandomSelectStrategy.h:48
virtual ~RandomSelectStrategy()
default destructor
Definition: RandomSelectStrategy.cpp:46
The Generation class.
Definition: Generation.h:53
virtual void select(Generation *oldGeneration, Generation *newGeneration)
implementation for the interface ISelectStrategy
Definition: RandomSelectStrategy.cpp:50
RandGen * m_random
the random generator
Definition: RandomSelectStrategy.h:72