Add a warning in moeoHyperVolumeUnaryMetric if set size == 1

This commit is contained in:
Johann Dreo 2013-04-30 11:49:24 +02:00 committed by LPTK
commit 02892ac437

View file

@ -136,10 +136,19 @@ class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric <
* @param _set1 the vector contains all objective Vector of the first pareto front * @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 * @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){ void setup(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2)
if(_set1.size() < 1 || _set2.size() < 1) {
if(_set1.size() < 1 || _set2.size() < 1) {
throw("Error in moeoHyperVolumeUnaryMetric::setup -> argument1: vector<ObjectiveVector> size must be greater than 0"); throw("Error in moeoHyperVolumeUnaryMetric::setup -> argument1: vector<ObjectiveVector> size must be greater than 0");
else{ } 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; double min, max;
unsigned int nbObj=ObjectiveVector::Traits::nObjectives(); unsigned int nbObj=ObjectiveVector::Traits::nObjectives();
bounds.resize(nbObj); bounds.resize(nbObj);