eoLinearDecreasingWeightUp.h

00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 //-----------------------------------------------------------------------------
00004 // eoLinearDecreasingWeightUp.h
00005 // (c) OPAC 2007
00006 /*
00007     Contact: paradiseo-help@lists.gforge.inria.fr
00008  */
00009 //-----------------------------------------------------------------------------
00010 
00011 #ifndef EOLINEARDECREASINGWEIGHTUP_H
00012 #define EOLINEARDECREASINGWEIGHTUP_H
00013 
00014 //-----------------------------------------------------------------------------
00015 #include <eoWeightUpdater.h>
00016 //-----------------------------------------------------------------------------
00017 
00018 
00027 template <class WeightType, class StopCriteriaType> class eoLinearDecreasingWeightUp:public eoWeightUpdater<WeightType>
00028 {
00029 public:
00030 
00034     eoLinearDecreasingWeightUp(
00035         const StopCriteriaType & _stop,
00036         const WeightType  & _initialValue,
00037         const WeightType & _finalValue,
00038         eoValueParam<StopCriteriaType> &  _counter):
00039             stop(_stop),
00040             initialValue(_initialValue),
00041             finalValue(_finalValue),
00042             counter(_counter){}
00043 
00047     void operator() (WeightType & _weight)
00048     {
00049         _weight=(initialValue-finalValue)* (WeightType)(stop-counter.value())/(WeightType)stop + finalValue;
00050 
00051     }
00052 
00053 protected:
00054     const StopCriteriaType & stop;
00055     const WeightType & initialValue,finalValue;
00056     eoValueParam<StopCriteriaType> & counter; // a counter of the number of past events (should say "generations")
00057 };
00058 
00059 
00060 
00061 #endif/*EOLINEARDECREASINGWEIGHTUP_H*/

Generated on Fri Jun 22 10:17:02 2007 for EO-PSO by  doxygen 1.4.7