00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- 00002 00003 // "moImprAspirCrit.h" 00004 00005 // (c) OPAC Team, LIFL, 2003-2006 00006 00007 /* LICENCE TEXT 00008 00009 Contact: paradiseo-help@lists.gforge.inria.fr 00010 */ 00011 00012 #ifndef __moImprBestFitAspirCrit_h 00013 #define __moImprBestFitAspirCrit_h 00014 00015 #include "moAspirCrit.h" 00016 00018 00022 template < class M > class moImprBestFitAspirCrit:public moAspirCrit < M > 00023 { 00024 00025 public: 00026 00028 typedef typename M::EOType::Fitness Fitness; 00029 00031 moImprBestFitAspirCrit () 00032 { 00033 00034 first_time = true; 00035 } 00036 00038 void init () 00039 { 00040 00041 first_time = true; 00042 } 00043 00045 00052 bool operator () (const M & __move, const Fitness & __fit) 00053 { 00054 00055 if (first_time) 00056 { 00057 00058 best_fit = __fit; 00059 first_time = false; 00060 00061 return true; 00062 } 00063 else if (__fit < best_fit) 00064 return false; 00065 00066 else 00067 { 00068 00069 best_fit = __fit; 00070 00071 return true; 00072 } 00073 } 00074 00075 private: 00076 00078 Fitness best_fit; 00079 00081 bool first_time; 00082 }; 00083 00084 #endif
1.5.1