00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef MOEOADDITIVEEPSILONBINARYMETRIC_H_
00014 #define MOEOADDITIVEEPSILONBINARYMETRIC_H_
00015
00016 #include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
00017
00023 template < class ObjectiveVector >
00024 class moeoAdditiveEpsilonBinaryMetric : public moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double >
00025 {
00026 public:
00027
00035 double operator()(const ObjectiveVector & _o1, const ObjectiveVector & _o2)
00036 {
00037
00038 double result = epsilon(_o1, _o2, 0);
00039
00040 double tmp;
00041 for (unsigned int i=1; i<ObjectiveVector::Traits::nObjectives(); i++)
00042 {
00043 tmp = epsilon(_o1, _o2, i);
00044 result = std::max(result, tmp);
00045 }
00046
00047 return result;
00048 }
00049
00050
00051 private:
00052
00054 using moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > :: bounds;
00055
00056
00064 double epsilon(const ObjectiveVector & _o1, const ObjectiveVector & _o2, const unsigned int _obj)
00065 {
00066 double result;
00067
00068 if (ObjectiveVector::Traits::minimizing(_obj))
00069 {
00070
00071 result = ( (_o1[_obj] - bounds[_obj].minimum()) / bounds[_obj].range() ) - ( (_o2[_obj] - bounds[_obj].minimum()) / bounds[_obj].range() );
00072 }
00073
00074 else
00075 {
00076
00077 result = ( (_o2[_obj] - bounds[_obj].minimum()) / bounds[_obj].range() ) - ( (_o1[_obj] - bounds[_obj].minimum()) / bounds[_obj].range() );
00078 }
00079 return result;
00080 }
00081
00082 };
00083
00084 #endif