00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- 00002 00003 // "moFitSolContinue.h" 00004 00005 // (c) OPAC Team (LIFL), Dolphin project (INRIA), 2003-2007 00006 00007 /* LICENCE TEXT 00008 00009 Contact: paradiseo-help@lists.gforge.inria.fr 00010 */ 00011 00012 #ifndef __moFitSolContinue_h 00013 #define __moFitSolContinue_h 00014 00015 #include "moSolContinue.h" 00016 00018 00021 template < class EOT > class moFitSolContinue:public moSolContinue < EOT > 00022 { 00023 00024 public: 00025 00027 typedef typename EOT::Fitness Fitness; 00028 00030 00034 moFitSolContinue (Fitness __fitness, bool __maximization=true): fitness (__fitness), maximization(__maximization) 00035 {} 00036 00038 00044 bool operator () (const EOT & __sol) 00045 { 00046 if(__sol.invalid()) 00047 { 00048 return true; 00049 } 00050 00051 if(maximization) 00052 { 00053 return __sol.fitness()<fitness; 00054 } 00055 return __sol.fitness()>fitness; 00056 } 00057 00059 void init () 00060 {} 00061 00062 private: 00063 00065 Fitness fitness; 00066 00068 00072 bool maximization; 00073 }; 00074 00075 #endif
1.5.2