00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include<eoParetoFitness.h>
00014
00015 template < class EOT, class DistType > class moeoParetoPhenDist
00016 {
00017 public:
00018 virtual DistType operator ()(const EOT & eopf1, const EOT & eopf2) = 0;
00019
00020 };
00021
00022
00023
00024
00025
00026 template < class EOT, class DistType =
00027 double >class moeoParetoEuclidDist:public moeoParetoPhenDist < EOT,
00028 DistType >
00029 {
00030
00031 public:
00032 DistType operator () (const EOT & eopf1, const EOT & eopf2)
00033 {
00034 double res = 0.0;
00035 double max = 0.0;
00036 double temp;
00037 for (unsigned i = 0; i < eopf1.fitness ().size (); ++i)
00038 {
00039 temp =
00040 (eopf1.fitness ().operator[](i) -
00041 eopf2.fitness ().operator[](i)) * (eopf1.fitness ().operator[](i) -
00042 eopf2.fitness ().operator[](i));
00043 if (temp > max)
00044 max = temp;
00045 res = res + temp;
00046 }
00047 return sqrt (res / max);
00048 }
00049
00050 };