00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _eoInitializer_H
00028 #define _eoInitializer_H
00029
00030 #include <utils/eoRealVectorBounds.h>
00031 #include <eoVelocityInit.h>
00032 #include <eoPop.h>
00033 #include <eoParticleBestInit.h>
00034 #include <eoTopology.h>
00035
00036
00037
00038
00039
00040 template <class POT> class eoInitializerBase : public eoFunctorBase
00041 {
00042 public :
00043
00044 virtual ~eoInitializerBase()
00045 {}
00046
00047 virtual void operator()()
00048 {};
00049 };
00050
00056 template <class POT> class eoInitializer : public eoInitializerBase <POT>
00057 {
00058 public:
00059
00065 eoInitializer(
00066 eoUF<POT&, void>& _proc,
00067 eoVelocityInit < POT > &_initVelo,
00068 eoParticleBestInit <POT> &_initBest,
00069 eoTopology <POT> &_topology,
00070 eoPop < POT > &_pop
00071 ) : proc(_proc), initVelo(_initVelo), procPara(dummyEval), initBest(_initBest), topology(_topology), pop(_pop)
00072 {}
00073
00079 eoInitializer(
00080 eoPopEvalFunc <POT>& _proc,
00081 eoVelocityInit < POT > &_initVelo,
00082 eoParticleBestInit <POT> &_initBest,
00083 eoTopology <POT> &_topology,
00084 eoPop < POT > &_pop
00085 ) : proc(dummy), procPara(_proc), initVelo(_initVelo), initBest(_initBest), topology(_topology), pop(_pop)
00086 {}
00087
00088
00091 virtual std::string className (void) const
00092 {
00093 return "eoInitializer";
00094 }
00095
00096
00097
00098 virtual void operator() ()
00099 {
00100 eoPop<POT> empty_pop;
00101 apply(proc, pop);
00102 procPara(empty_pop, pop);
00103 apply < POT > (initVelo, pop);
00104 apply < POT > (initBest, pop);
00105 topology.setup(pop);
00106 }
00107
00108 private :
00109
00110
00111
00112
00113
00114
00115 eoUF<POT&, void>& proc;
00116 eoVelocityInit < POT > & initVelo;
00117 eoParticleBestInit <POT> & initBest;
00118 eoPopEvalFunc <POT>& procPara;
00119 eoTopology <POT> & topology;
00120 eoPop < POT > & pop;
00121
00122 class eoDummyEval : public eoPopEvalFunc<POT>
00123 {
00124 public:
00125 void operator()(eoPop<POT> &,eoPop<POT> &_pop)
00126 {}
00127 }
00128 dummyEval;
00129 class eoDummy : public eoUF<POT&, void>
00130 {
00131 public:
00132 void operator()(POT &)
00133 {}
00134
00135 }
00136 dummy;
00137 };
00138 #endif
00139
00140
00141