include added

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1427 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2009-02-12 12:35:25 +00:00
commit 2629e21d15

View file

@ -40,6 +40,7 @@
#define MOEOHYPERVOLUMEDIFFERENCEMETRIC_H_ #define MOEOHYPERVOLUMEDIFFERENCEMETRIC_H_
#include <metric/moeoMetric.h> #include <metric/moeoMetric.h>
#include <metric/moeoHyperVolumeMetric.h>
/** /**
* The contribution metric evaluates the proportion of non-dominated solutions given by a Pareto set relatively to another Pareto set * The contribution metric evaluates the proportion of non-dominated solutions given by a Pareto set relatively to another Pareto set
@ -49,7 +50,7 @@ template < class ObjectiveVector >
class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric < ObjectiveVector, double > class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric < ObjectiveVector, double >
{ {
public: public:
/** /**
* Constructor with a coefficient (rho) * Constructor with a coefficient (rho)
* @param _normalize allow to normalize data (default true) * @param _normalize allow to normalize data (default true)
@ -63,7 +64,7 @@ class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric <
bounds[i] = eoRealInterval(0,1); bounds[i] = eoRealInterval(0,1);
} }
} }
/** /**
* Constructor with a reference point * Constructor with a reference point
* @param _normalize allow to normalize data (default true) * @param _normalize allow to normalize data (default true)
@ -76,17 +77,17 @@ class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric <
{ {
bounds[i] = eoRealInterval(0,1); bounds[i] = eoRealInterval(0,1);
} }
} }
/** /**
* calculates and returns the HyperVolume value of a pareto front * calculates and returns the HyperVolume value of a pareto front
* @param _set the vector contains all objective Vector of pareto front * @param _set the vector contains all objective Vector of pareto front
*/ */
double operator()(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2) double operator()(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2)
{ {
double hypervolume_set1; double hypervolume_set1;
double hypervolume_set2; double hypervolume_set2;
if(rho >= 1.0){ if(rho >= 1.0){
//determine bounds //determine bounds
setup(_set1, _set2); setup(_set1, _set2);
@ -105,7 +106,7 @@ class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric <
ref_point[i]= bounds[i].maximum() * (1-rho); ref_point[i]= bounds[i].maximum() * (1-rho);
} }
} }
//if no normalization, reinit bounds to O..1 for //if no normalization, reinit bounds to O..1 for
if(!normalize) if(!normalize)
for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++) for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++)
bounds[i] = eoRealInterval(0,1); bounds[i] = eoRealInterval(0,1);
@ -113,14 +114,14 @@ class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric <
} }
else if(normalize) else if(normalize)
setup(_set1, _set2); setup(_set1, _set2);
moeoHyperVolumeMetric <ObjectiveVector> unaryMetric(ref_point, bounds); moeoHyperVolumeMetric <ObjectiveVector> unaryMetric(ref_point, bounds);
hypervolume_set1 = unaryMetric(_set1); hypervolume_set1 = unaryMetric(_set1);
hypervolume_set2 = unaryMetric(_set2); hypervolume_set2 = unaryMetric(_set2);
return hypervolume_set1 - hypervolume_set2; return hypervolume_set1 - hypervolume_set2;
} }
/** /**
* getter on bounds * getter on bounds
* @return bounds * @return bounds
@ -128,7 +129,7 @@ class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric <
std::vector < eoRealInterval > getBounds(){ std::vector < eoRealInterval > getBounds(){
return bounds; return bounds;
} }
/** /**
* method caclulate bounds for the normalization * method caclulate bounds for the normalization
* @param _set the vector of objective vectors * @param _set the vector of objective vectors
@ -160,12 +161,12 @@ class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric <
/*boolean indicates if data must be normalized or not*/ /*boolean indicates if data must be normalized or not*/
bool normalize; bool normalize;
double rho; double rho;
/*vectors contains bounds for normalization*/ /*vectors contains bounds for normalization*/
std::vector < eoRealInterval > bounds; std::vector < eoRealInterval > bounds;
ObjectiveVector ref_point; ObjectiveVector ref_point;
}; };