EvolvingObjects
|
00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- 00002 00003 //----------------------------------------------------------------------------- 00004 // eoRealBoundModifier.h 00005 // (c) OPAC 2007 00006 /* 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 00021 Contact: thomas.legrand@lifl.fr 00022 */ 00023 00024 #ifndef EOREALBOUNDMODIFIER_H 00025 #define EOREALBOUNDMODIFIER_H 00026 00027 #include <eoFunctor.h> 00028 #include <utils/eoRealVectorBounds.h> 00029 00044 class eoRealBoundModifier: public eoBF < eoRealBaseVectorBounds &,unsigned,void > {}; 00045 00046 00051 class eoDummyRealBoundModifier: public eoRealBoundModifier 00052 { 00053 public: 00054 00055 eoDummyRealBoundModifier (){} 00056 00057 void operator() (eoRealBaseVectorBounds & _bnds,unsigned _i) 00058 { 00059 (void)_bnds; 00060 (void)_i; 00061 } 00062 }; 00063 00064 00065 00075 class eoExpDecayingBoundModifier: public eoRealBoundModifier 00076 { 00077 public: 00078 00085 eoExpDecayingBoundModifier (unsigned _stopCriteria, 00086 double _alpha, 00087 eoValueParam<unsigned> & _genCounter): 00088 stopCriteria(_stopCriteria), 00089 alpha(_alpha), 00090 genCounter(_genCounter){} 00091 00092 00093 void operator() (eoRealBaseVectorBounds & _bnds,unsigned _i) 00094 { 00095 double newMaxBound=(1-pow((double)genCounter.value()/stopCriteria,alpha))*_bnds.maximum(_i); 00096 00097 // should delete the old eoRealBounds ? 00098 _bnds[_i]=new eoRealInterval(_bnds.minimum(_i),std::max(_bnds.minimum(_i),newMaxBound)); 00099 } 00100 00101 00102 protected: 00103 unsigned stopCriteria; 00104 double alpha; 00105 eoValueParam<unsigned> & genCounter; 00106 00107 }; 00108 00109 #endif/*EOREALBOUNDMODIFIER_H*/