uses comparators (and not dominates)

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@306 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
liefooga 2007-06-18 15:34:45 +00:00
commit 8d887505f9
2 changed files with 13 additions and 3 deletions

View file

@ -13,6 +13,7 @@
#ifndef MOEOCONTRIBUTIONMETRIC_H_
#define MOEOCONTRIBUTIONMETRIC_H_
#include <moeoObjectiveVectorComparator.h>
#include <metric/moeoMetric.h>
/**
@ -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;
}

View file

@ -72,6 +72,8 @@ private:
std::vector<double> vect_min_val;
/** vector of max values */
std::vector<double> 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;
}