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 is a interface of a strategy for the mutation which is used by * 00027 * the GenPrototype to give the GenFactory a knowledge of the kind how * 00028 * to mutate a gen. * 00029 * * 00030 * $Log: IMutationStrategy.h,v $ 00031 * Revision 1.4 2009/07/21 08:37:59 robot12 00032 * add some comments 00033 * 00034 * Revision 1.3 2009/06/17 11:25:52 robot12 00035 * finishing the mutation strategy and add some comments. 00036 * 00037 * Revision 1.2 2009/05/14 15:29:56 robot12 00038 * bugfix: mutation change the oldGen, not the new!!! now fixed 00039 * 00040 * Revision 1.1 2009/05/04 15:27:57 robot12 00041 * rename of some files and moving files to other positions 00042 * - SingletonGenAlgAPI has one error!!! --> is not ready now 00043 * 00044 * Revision 1.2 2009/05/04 09:06:00 robot12 00045 * some implements... Part7 00046 * 00047 * Revision 1.1 2009/04/30 11:35:53 robot12 00048 * some changes: 00049 * - insert a SelectStrategie 00050 * - insert a MutationStrategie 00051 * - reorganisation of the design 00052 * 00053 * 00054 * 00055 ***************************************************************************/ 00056 00057 #ifndef IMUTATIONSTRATEGY_H_ 00058 #define IMUTATIONSTRATEGY_H_ 00059 00060 //forward declarations 00061 class Gen; 00062 class GenContext; 00063 class Individual; 00064 class SingletonGenFactory; 00065 00066 /** 00067 * This interface gives the structur for the mutation of a gen. 00068 */ 00069 class IMutationStrategy { 00070 public: 00071 /** 00072 * default constructor 00073 */ 00074 IMutationStrategy(); 00075 00076 /** 00077 * default destructor 00078 */ 00079 virtual ~IMutationStrategy(); 00080 00081 /** 00082 * mutate a gen 00083 * @param context (GenContext*) the context in which the new gen comes (needed by the factory 00084 * @param individual (Individual*) the individual, which the new gen becomes 00085 * @param oldGen (Gen*) the old gen, which mutate 00086 * @param oldContext (GenContext*) the Context in which the old gen are. 00087 * @param factory (SingletonGenFactory*) the GenFactory which create the new gen. 00088 * @return (Gen*) the new mutated gen 00089 */ 00090 virtual Gen* mutate(GenContext* context, Individual* individual, Gen* oldGen, GenContext* oldContext, SingletonGenFactory* factory) = 0; 00091 00092 /** 00093 * gives the Probability of a mutation back. 00094 * @return 00095 */ 00096 virtual int getMutationProbability(void) = 0; 00097 }; 00098 00099 #endif /* IMUTATIONSTRATEGY_H_ */