00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _EOUPDATEIFBETTER_H
00012 #define _EOUPDATEIFBETTER_H
00013
00014
00015 #include <eoParticleBestUpdater.h>
00016
00017
00021 template < class POT > class eoUpdateIfBetter:public eoParticleBestUpdater <
00022 POT >
00023 {
00024
00025 public:
00026
00028 eoUpdateIfBetter () {}
00029
00030 void operator () (POT & _po)
00031 {
00032 if (_po.fitness () > _po.best ())
00033 {
00034
00035 for (unsigned i = 0; i < _po.size (); i++){
00036 _po.bestPositions[i] = _po[i];
00037 }
00038
00039 _po.invalidateBest();
00040
00041
00042 _po.best (_po.fitness ());
00043 }
00044 }
00045
00046 };
00047
00048 #endif