00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef MOEODIVERSITYASSIGNMENT_H_
00014 #define MOEODIVERSITYASSIGNMENT_H_
00015
00016 #include <eoFunctor.h>
00017 #include <eoPop.h>
00018
00022 template < class MOEOT >
00023 class moeoDiversityAssignment : public eoUF < eoPop < MOEOT > &, void >
00024 {
00025 public:
00026
00028 typedef typename MOEOT::ObjectiveVector ObjectiveVector;
00029
00030
00036 virtual void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) = 0;
00037
00038
00044 void updateByDeleting(eoPop < MOEOT > & _pop, MOEOT & _moeo)
00045 {
00046 updateByDeleting(_pop, _moeo.objectiveVector());
00047 }
00048
00049 };
00050
00051
00055 template < class MOEOT >
00056 class moeoDummyDiversityAssignment : public moeoDiversityAssignment < MOEOT >
00057 {
00058 public:
00059
00061 typedef typename MOEOT::ObjectiveVector ObjectiveVector;
00062
00063
00068 void operator () (eoPop < MOEOT > & _pop)
00069 {
00070 for (unsigned idx = 0; idx<_pop.size (); idx++)
00071 {
00072 if (_pop[idx].invalidDiversity())
00073 {
00074
00075 _pop[idx].diversity(0.0);
00076 }
00077 }
00078 }
00079
00080
00086 void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
00087 {
00088
00089 }
00090
00091 };
00092
00093 #endif