Robot Simulator of the Robotics Group for Self-Organization of Control: ValueMutationStrategy.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- File List
- File Members

# ValueMutationStrategy.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 of the interface IMutationStrategy.    *
    00027  *                                                                         *
    00028  *   $Log: ValueMutationStrategy.h,v $
    00029  *   Revision 1.4  2009/07/21 08:37:59  robot12
    00030  *   add some comments
    00031  *
    00032  *   Revision 1.3  2009/06/17 11:25:52  robot12
    00033  *   finishing the mutation strategy and add some comments.
    00034  *
    00035  *   Revision 1.2  2009/05/14 15:29:56  robot12
    00036  *   bugfix: mutation change the oldGen, not the new!!! now fixed
    00037  *
    00038  *   Revision 1.1  2009/05/04 15:27:57  robot12
    00039  *   rename of some files and moving files to other positions
    00040  *    - SingletonGenAlgAPI has one error!!! --> is not ready now
    00041  *
    00042  *   Revision 1.2  2009/05/04 09:06:00  robot12
    00043  *   some implements... Part7
    00044  *
    00045  *   Revision 1.1  2009/04/30 11:51:25  robot12
    00046  *   some implements... new classes
    00047  *
    00048  *
    00049  *
    00050  ***************************************************************************/
    00051
    00052 #ifndef VALUEMUTATIONSTRATEGY_H_
    00053 #define VALUEMUTATIONSTRATEGY_H_
    00054
    00055 //forward declarations
    00056 class Gen;
    00057 class Individual;
    00058 class GenContext;
    00059 class SingletonGenFactory;
    00060 class IMutationFactorStrategy;
    00061
    00062 //ga_tools includes
    00063 #include "IMutationStrategy.h"
    00064
    00065 /**
    00066  * this mutation strategy clculate a mutation factor by using a
    00067  * mutation factor strategy an add this factor to the old gen.
    00068  */
    00069 class ValueMutationStrategy : public IMutationStrategy {
    00070 public:
    00071         /**
    00072          * constructor
    00073          * @param strategy (IMutationFactorStrategy*) this strategie is used to calculate the mutation factor.
    00074          * @param mutationProbability (int) the mutation probability which is give back.
    00075          */
    00076         ValueMutationStrategy(IMutationFactorStrategy* strategy, int mutationProbability);
    00077
    00078         /**
    00079          * default destructor
    00080          */
    00081         virtual ~ValueMutationStrategy();
    00082
    00083         /**
    00084          * mutate a gen
    00085          * @param context (GenContext*) the context in which the new gen comes (needed by the factory
    00086          * @param individual (Individual*) the individual, which the new gen becomes
    00087          * @param oldGen (Gen*) the old gen, which mutate
    00088          * @param oldContext (GenContext*) the Context in which the old gen are.
    00089          * @param factory (SingletonGenFactory*) the GenFactory which create the new gen.
    00090          * @return (Gen*) the new mutated gen
    00091          */
    00092         virtual Gen* mutate(GenContext* context, Individual* individual, Gen* oldGen, GenContext* oldContext, SingletonGenFactory* factory);
    00093
    00094         /**
    00095          * gives the Probability of a mutation back.
    00096          * @return
    00097          */
    00098         virtual int getMutationProbability(void);
    00099
    00100 protected:
    00101         /**
    00102          * the mutation factor strategy
    00103          */
    00104         IMutationFactorStrategy* m_strategy;
    00105
    00106         /**
    00107          * the mutation probability
    00108          */
    00109         int m_mutationProbability;
    00110
    00111 private:
    00112         /**
    00113          * disable the default constructor
    00114          */
    00115         ValueMutationStrategy();
    00116 };
    00117
    00118 #endif /* VALUEMUTATIONSTRATEGY_H_ */