eoUpdateGlobalIfBetter.h

00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 //-----------------------------------------------------------------------------
00004 // eoUpdateGlobalIfBetter.h
00005 // (c) OPAC 2007
00006 /*
00007     Contact: paradiseo-help@lists.gforge.inria.fr
00008  */
00009 //-----------------------------------------------------------------------------
00010 
00011 #ifndef EOUPDATEGLOBALIFBETTER_H
00012 #define EOUPDATEGLOBALIFBETTER_H
00013 
00014 //-----------------------------------------------------------------------------
00015 #include <eoParticleBestUpdater.h>
00016 #include <eoParticleArchive.h>
00017 //-----------------------------------------------------------------------------
00018 
00019 
00023 template < class POT > class eoUpdateGlobalIfBetter:public eoParticleBestUpdater <
00024             POT >
00025 {
00026 
00027 public:
00029     eoUpdateGlobalIfBetter (eoSingleParticleArchive < POT > &_archive):archive(_archive) {}
00030 
00031     void operator  () (POT & _po)
00032     {
00033         // if the particle is better than the best ...
00034         if (_po.fitness () > archive.best ().fitness())
00035             archive.best (_po);
00036     }
00037 
00038 protected:
00039     eoSingleParticleArchive < POT > &archive;
00040 
00041 };
00042 
00043 #endif /*EOUPDATEGLOBALIFBETTER_H */
00044 
00045 

Generated on Thu Apr 19 11:02:28 2007 for EO by  doxygen 1.4.7