From e04a3568099468b066e31df7cf053581d4a4b8f1 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 30 Apr 2013 11:49:24 +0200 Subject: [PATCH] Add a warning in moeoHyperVolumeUnaryMetric if set size == 1 --- .../metric/moeoHyperVolumeDifferenceMetric.h | 51 +++++++++++-------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/moeo/src/metric/moeoHyperVolumeDifferenceMetric.h b/moeo/src/metric/moeoHyperVolumeDifferenceMetric.h index 3e222e21b..906923b98 100644 --- a/moeo/src/metric/moeoHyperVolumeDifferenceMetric.h +++ b/moeo/src/metric/moeoHyperVolumeDifferenceMetric.h @@ -136,27 +136,36 @@ class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric < * @param _set1 the vector contains all objective Vector of the first pareto front * @param _set2 the vector contains all objective Vector of the second pareto front */ - void setup(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2){ - if(_set1.size() < 1 || _set2.size() < 1) - throw("Error in moeoHyperVolumeUnaryMetric::setup -> argument1: vector size must be greater than 0"); - else{ - double min, max; - unsigned int nbObj=ObjectiveVector::Traits::nObjectives(); - bounds.resize(nbObj); - for (unsigned int i=0; i & _set1, const std::vector < ObjectiveVector > & _set2) + { + if(_set1.size() < 1 || _set2.size() < 1) { + throw("Error in moeoHyperVolumeUnaryMetric::setup -> argument1: vector size must be greater than 0"); + } else { +#ifndef NDEBUG + if( _set1.size() == 1 || _set2.size() == 1 ) { + eo::log << eo::warnings << "Warning in moeoHyperVolumeUnaryMetric::setup one of the pareto set contains only one point (set1.size=" + << _set1.size() << ", set2.size=" << _set2.size() << ")" + << std::endl; + } +#endif + + double min, max; + unsigned int nbObj=ObjectiveVector::Traits::nObjectives(); + bounds.resize(nbObj); + for (unsigned int i=0; i