Add a warning in moeoHyperVolumeUnaryMetric if set size == 1
This commit is contained in:
parent
390eed79ef
commit
02892ac437
1 changed files with 30 additions and 21 deletions
|
|
@ -136,27 +136,36 @@ 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)
|
{
|
||||||
throw("Error in moeoHyperVolumeUnaryMetric::setup -> argument1: vector<ObjectiveVector> size must be greater than 0");
|
if(_set1.size() < 1 || _set2.size() < 1) {
|
||||||
else{
|
throw("Error in moeoHyperVolumeUnaryMetric::setup -> argument1: vector<ObjectiveVector> size must be greater than 0");
|
||||||
double min, max;
|
} else {
|
||||||
unsigned int nbObj=ObjectiveVector::Traits::nObjectives();
|
#ifndef NDEBUG
|
||||||
bounds.resize(nbObj);
|
if( _set1.size() == 1 || _set2.size() == 1 ) {
|
||||||
for (unsigned int i=0; i<nbObj; i++){
|
eo::log << eo::warnings << "Warning in moeoHyperVolumeUnaryMetric::setup one of the pareto set contains only one point (set1.size="
|
||||||
min = _set1[0][i];
|
<< _set1.size() << ", set2.size=" << _set2.size() << ")"
|
||||||
max = _set1[0][i];
|
<< std::endl;
|
||||||
for (unsigned int j=1; j<_set1.size(); j++){
|
}
|
||||||
min = std::min(min, _set1[j][i]);
|
#endif
|
||||||
max = std::max(max, _set1[j][i]);
|
|
||||||
}
|
double min, max;
|
||||||
for (unsigned int j=0; j<_set2.size(); j++){
|
unsigned int nbObj=ObjectiveVector::Traits::nObjectives();
|
||||||
min = std::min(min, _set2[j][i]);
|
bounds.resize(nbObj);
|
||||||
max = std::max(max, _set2[j][i]);
|
for (unsigned int i=0; i<nbObj; i++){
|
||||||
}
|
min = _set1[0][i];
|
||||||
bounds[i] = eoRealInterval(min, max);
|
max = _set1[0][i];
|
||||||
}
|
for (unsigned int j=1; j<_set1.size(); j++){
|
||||||
}
|
min = std::min(min, _set1[j][i]);
|
||||||
|
max = std::max(max, _set1[j][i]);
|
||||||
|
}
|
||||||
|
for (unsigned int j=0; j<_set2.size(); j++){
|
||||||
|
min = std::min(min, _set2[j][i]);
|
||||||
|
max = std::max(max, _set2[j][i]);
|
||||||
|
}
|
||||||
|
bounds[i] = eoRealInterval(min, max);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue