eoRandomRealWeightUp.h

00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 //-----------------------------------------------------------------------------
00004 // eoRandomRealWeightUp.h
00005 // (c) OPAC 2007
00006 /*
00007     Contact: paradiseo-help@lists.gforge.inria.fr
00008  */
00009 //-----------------------------------------------------------------------------
00010 
00011 #ifndef EORANDOMREALWEIGHTUP_H
00012 #define EORANDOMREALWEIGHTUP_H
00013 
00014 //-----------------------------------------------------------------------------
00015 #include <eoWeightUpdater.h>
00016 #include <utils/eoRNG.h>
00017 //-----------------------------------------------------------------------------
00018 
00022 class eoRandomRealWeightUp:public eoWeightUpdater<double>
00023 {
00024 public:
00025 
00031     eoRandomRealWeightUp(
00032         double  _min,
00033         double  _max
00034     ):min(_min),max(_max)
00035     {
00036         // consistency check
00037         if (min > max)
00038         {
00039             std::string s;
00040             s.append (" min > max in eoRandomRealWeightUp");
00041             throw std::runtime_error (s);
00042         }
00043     }
00044 
00049     void operator() (double & _weight)
00050     {
00051         _weight=rng.uniform(max-min)+min;
00052     }
00053 
00054 
00055 protected:
00056     double min,max;
00057 
00058 };
00059 
00060 
00061 
00062 #endif/*EORANDOMREALWEIGHTUP_H*/

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