From 8d887505f93d316c043e8b0e549cd3edf086a7a1 Mon Sep 17 00:00:00 2001 From: liefooga Date: Mon, 18 Jun 2007 15:34:45 +0000 Subject: [PATCH] uses comparators (and not dominates) git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@306 331e1502-861f-0410-8da2-ba01fb791d7f --- .../src/metric/moeoContributionMetric.h | 11 +++++++++-- .../paradiseo-moeo-1.0/src/metric/moeoEntropyMetric.h | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/branches/paradiseo-moeo-1.0/src/metric/moeoContributionMetric.h b/branches/paradiseo-moeo-1.0/src/metric/moeoContributionMetric.h index 325a11229..7e495ed4f 100644 --- a/branches/paradiseo-moeo-1.0/src/metric/moeoContributionMetric.h +++ b/branches/paradiseo-moeo-1.0/src/metric/moeoContributionMetric.h @@ -13,6 +13,7 @@ #ifndef MOEOCONTRIBUTIONMETRIC_H_ #define MOEOCONTRIBUTIONMETRIC_H_ +#include #include /** @@ -41,6 +42,10 @@ public: private: + /** Functor to compare two objective vectors according to Pareto dominance relation */ + moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator; + + /** * Returns the number of solutions both in '_set1' and '_set2' * @param _set1 the first Pareto set @@ -66,7 +71,8 @@ private: unsigned w=0; for (unsigned i=0; i<_set1.size(); i++) for (unsigned j=0; j<_set2.size(); j++) - if (_set1[i].dominates(_set2[j])) { + if (paretoComparator(_set2[j], _set1[i])) + { w++; break; } @@ -83,7 +89,8 @@ private: for (unsigned i=0; i<_set1.size(); i++) { bool domin_rel = false; for (unsigned j=0; j<_set2.size(); j++) - if (_set1[i].dominates(_set2[j]) || _set2[j].dominates(_set1 [i])) { + if ( (paretoComparator(_set2[j], _set1[i])) || (paretoComparator(_set1[i], _set2[j])) ) + { domin_rel = true; break; } diff --git a/branches/paradiseo-moeo-1.0/src/metric/moeoEntropyMetric.h b/branches/paradiseo-moeo-1.0/src/metric/moeoEntropyMetric.h index 8c3f5c936..6c55a0518 100644 --- a/branches/paradiseo-moeo-1.0/src/metric/moeoEntropyMetric.h +++ b/branches/paradiseo-moeo-1.0/src/metric/moeoEntropyMetric.h @@ -72,6 +72,8 @@ private: std::vector vect_min_val; /** vector of max values */ std::vector vect_max_val; + /** Functor to compare two objective vectors according to Pareto dominance relation */ + moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator; /** @@ -82,7 +84,8 @@ private: for (unsigned i=0 ; i<_f.size(); i++) { bool dom = false; for (unsigned j=0; j<_f.size(); j++) - if (i != j && _f[j].dominates(_f[i])) { + if (i != j && paretoComparator(_f[i],_f[j])) + { dom = true; break; }