23/02/07 modifications
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@185 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
086b51c370
commit
9a85a7673e
2 changed files with 105 additions and 11 deletions
|
|
@ -16,24 +16,69 @@
|
||||||
#include <metric/moeoMetric.h>
|
#include <metric/moeoMetric.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Additive epsilon binary metric allowing to compare two objective vectors as proposed in
|
||||||
|
* Zitzler E., Thiele L., Laumanns M., Fonseca C. M., Grunert da Fonseca V.:
|
||||||
|
* Performance Assessment of Multiobjective Optimizers: An Analysis and Review. IEEE Transactions on Evolutionary Computation 7(2), pp.117–132 (2003).
|
||||||
*/
|
*/
|
||||||
template < class MOEOT >
|
template < class ObjectiveVector >
|
||||||
class moeoAdditiveEpsilonBinaryMetric : public moeoSolutionVsSolutionBinaryMetric < MOEOT, double >
|
class moeoAdditiveEpsilonBinaryMetric : public moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** the objective vector type of a solution */
|
/**
|
||||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
* Returns the maximum epsilon value by which the objective vector _o1 must be translated in all objectives
|
||||||
|
* so that it weakly dominates the objective vector _o2
|
||||||
moeoAdditiveEpsilonBinaryMetric();
|
* @warning don't forget to set the bounds for every objective before the call of this function
|
||||||
|
* @param _o1 the first objective vector
|
||||||
|
* @param _o2 the second objective vector
|
||||||
double operator()(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2)
|
*/
|
||||||
|
double operator()(const ObjectiveVector & _o1, const ObjectiveVector & _o2)
|
||||||
{
|
{
|
||||||
|
// computation of the epsilon value for the first objective
|
||||||
|
double result = epsilon(_o1, _o2, 0);
|
||||||
|
// computation of the epsilon value for the other objectives
|
||||||
|
double tmp;
|
||||||
|
for (unsigned i=1; i<ObjectiveVector::Traits::nObjectives(); i++)
|
||||||
|
{
|
||||||
|
tmp = epsilon(_o1, _o2, i);
|
||||||
|
result = std::max(result, tmp);
|
||||||
|
}
|
||||||
|
// returns the maximum epsilon value
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/** the bounds for every objective */
|
||||||
|
using moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > :: bounds;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the epsilon value by which the objective vector _o1 must be translated in the objective _obj
|
||||||
|
* so that it dominates the objective vector _o2
|
||||||
|
* @param _o1 the first objective vector
|
||||||
|
* @param _o2 the second objective vector
|
||||||
|
* @param _obj the index of the objective
|
||||||
|
*/
|
||||||
|
double epsilon(const ObjectiveVector & _o1, const ObjectiveVector & _o2, const unsigned _obj)
|
||||||
|
{
|
||||||
|
double result;
|
||||||
|
// if the objective _obj have to be minimized
|
||||||
|
if (ObjectiveVector::Traits::minimizing(_obj))
|
||||||
|
{
|
||||||
|
// _o1[_obj] - _o2[_obj]
|
||||||
|
result = ( (_o1[_obj] - bounds[_obj].minimum()) / bounds[_obj].range() ) - ( (_o2[_obj] - bounds[_obj].minimum()) / bounds[_obj].range() );
|
||||||
|
}
|
||||||
|
// if the objective _obj have to be maximized
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// _o2[_obj] - _o1[_obj]
|
||||||
|
result = ( (_o2[_obj] - bounds[_obj].minimum()) / bounds[_obj].range() ) - ( (_o1[_obj] - bounds[_obj].minimum()) / bounds[_obj].range() );
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*MOEOADDITIVEEPSILONBINARYMETRIC_H_*/
|
#endif /*MOEOADDITIVEEPSILONBINARYMETRIC_H_*/
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,55 @@ class moeoSolutionVsSolutionBinaryMetric : public moeoBinaryMetric < const Objec
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for binary metrics dedicated to the performance comparison between two solutions's objective vectors using normalized values.
|
||||||
|
* Then, indicator values lie in the interval [-1,1].
|
||||||
|
* Note that you have to set the bounds for every objective before using the operator().
|
||||||
|
*/
|
||||||
|
template < class ObjectiveVector, class R >
|
||||||
|
class moeoNormalizedSolutionVsSolutionBinaryMetric : public moeoSolutionVsSolutionBinaryMetric < ObjectiveVector, R >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default ctr for any moeoNormalizedSolutionVsSolutionBinaryMetric object
|
||||||
|
*/
|
||||||
|
moeoNormalizedSolutionVsSolutionBinaryMetric()
|
||||||
|
{
|
||||||
|
bounds.resize(ObjectiveVector::Traits::nObjectives());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the lower bound (_min) and the upper bound (_max) for the objective _obj
|
||||||
|
* _min lower bound
|
||||||
|
* _max upper bound
|
||||||
|
* _obj the objective index
|
||||||
|
*/
|
||||||
|
virtual void setup(double _min, double _max, unsigned _obj)
|
||||||
|
{
|
||||||
|
bounds[_obj] = eoRealInterval(_min, _max);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the lower bound and the upper bound for the objective _obj using a eoRealInterval object
|
||||||
|
* _realInterval the eoRealInterval object
|
||||||
|
* _obj the objective index
|
||||||
|
*/
|
||||||
|
virtual void setup(eoRealInterval _realInterval, unsigned _obj)
|
||||||
|
{
|
||||||
|
bounds[_obj] = _realInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/** the bounds for every objective (bounds[i] = bounds for the objective i) */
|
||||||
|
std::vector < eoRealInterval > bounds;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for binary metrics dedicated to the performance comparison between a Pareto set (a vector of objective vectors) and a single solution's objective vector.
|
* Base class for binary metrics dedicated to the performance comparison between a Pareto set (a vector of objective vectors) and a single solution's objective vector.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue