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 EXTREAMTESTFITNESSSTRATEGY_H_ 00028 #define EXTREAMTESTFITNESSSTRATEGY_H_ 00029 00030 //forward declaration 00031 class Individual; 00032 00033 //ga_tools includes 00034 #include "IFitnessStrategy.h" 00035 00036 /** 00037 * An example implementation and a extreme test for gen. Alg. 00038 */ 00039 class ExtreamTestFitnessStrategy: public IFitnessStrategy { 00040 public: 00041 /** 00042 * constructor 00043 * This strategy needs a other fitness strategy to calculate the resulting fitness. 00044 * @param fitness (IFitnessStrategy*) the other fitness 00045 */ 00046 ExtreamTestFitnessStrategy(IFitnessStrategy* fitness); 00047 00048 /** 00049 * default destructor 00050 * do nothing 00051 */ 00052 virtual ~ExtreamTestFitnessStrategy(); 00053 00054 /** 00055 * implementation for getFitness of IFitnessStrategy. 00056 * return aČ of the other fitness strategy if the value is lower than 10. 00057 * Else it return 100. 00058 * @param individual (const Indivual*) the individual for which the value is calculated 00059 * @return (double) the result 00060 */ 00061 virtual double getFitness(const Individual* individual); 00062 00063 private: 00064 /** 00065 * a other fitness strategy which is used as base calculation. 00066 */ 00067 IFitnessStrategy* m_strategy; 00068 00069 /** 00070 * disable the default constructor 00071 */ 00072 ExtreamTestFitnessStrategy(); 00073 }; 00074 00075 #endif /* EXTREAMTESTFITNESSSTRATEGY_H_ */