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 generation size strategy of the* 00027 * genAlgEngine. It calculate the new generation size over the speed of * 00028 * enhancement between the generation. If it to slow so the generation * 00029 * size will be lower and is it to fast so the generation size will be * 00030 * greater. * 00031 * * 00032 * $Log: StandartGenerationSizeStrategy.h,v $ 00033 * Revision 1.3 2009/07/21 08:37:58 robot12 00034 * add some comments 00035 * 00036 * Revision 1.2 2009/06/16 12:25:31 robot12 00037 * finishing the generation size strategy and implements the comments. 00038 * 00039 * Revision 1.1 2009/05/04 15:27:57 robot12 00040 * rename of some files and moving files to other positions 00041 * - SingletonGenAlgAPI has one error!!! --> is not ready now 00042 * 00043 * Revision 1.4 2009/05/04 09:06:00 robot12 00044 * some implements... Part7 00045 * 00046 * Revision 1.3 2009/05/04 07:06:14 robot12 00047 * some implements... Part6 00048 * 00049 * Revision 1.2 2009/04/30 14:32:34 robot12 00050 * some implements... Part5 00051 * 00052 * Revision 1.1 2009/04/30 11:51:25 robot12 00053 * some implements... new classes 00054 * 00055 * 00056 * 00057 ***************************************************************************/ 00058 00059 #ifndef STANDARTGENERATIONSIZESTRATEGY_H_ 00060 #define STANDARTGENERATIONSIZESTRATEGY_H_ 00061 00062 //forward declaration 00063 class Generation; 00064 00065 //ga_tools includes 00066 #include "IGenerationSizeStrategy.h" 00067 00068 /** 00069 * this class calculate the new generation size over the enhancement speed 00070 */ 00071 class StandartGenerationSizeStrategy : public IGenerationSizeStrategy{ 00072 public: 00073 /** 00074 * constructor 00075 * @param startSize (int) is the size of the first generation. is needed as basic of the calculation 00076 * @param numGeneration (int) is the number of generation which the alg. will be create 00077 */ 00078 StandartGenerationSizeStrategy(int startSize, int numGeneration); 00079 00080 /** 00081 * default destructor 00082 */ 00083 virtual ~StandartGenerationSizeStrategy(); 00084 00085 /** 00086 * this function calculate the new generation size 00087 * @param oldGeneration (Generation*) the old generation 00088 * @return (int) the new generation size 00089 */ 00090 virtual int calcGenerationSize(Generation* oldGeneration); 00091 00092 protected: 00093 /** 00094 * is the first generation over? 00095 */ 00096 bool m_firstIsSet; 00097 00098 /** 00099 * the start size of the first generation 00100 */ 00101 int m_startSize; 00102 00103 /** 00104 * the number of generation 00105 */ 00106 int m_numGeneration; 00107 00108 /** 00109 * the best value of the first generation 00110 */ 00111 double m_best_first; 00112 00113 /** 00114 * the best value of the last generation. 00115 */ 00116 double m_best_old; 00117 00118 /** 00119 * the best value of the new generation. 00120 */ 00121 double m_best_new; 00122 00123 private: 00124 /** 00125 * disable the default constructor 00126 */ 00127 StandartGenerationSizeStrategy(); 00128 }; 00129 00130 #endif /* STANDARTGENERATIONSIZESTRATEGY_H_ */