bugfix: do not allow null interval in hypervolume diff metric
This commit is contained in:
parent
defb8382bf
commit
b619a85718
2 changed files with 17 additions and 3 deletions
|
|
@ -234,7 +234,7 @@ public :
|
||||||
assert( repRange >= 0 );
|
assert( repRange >= 0 );
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if( repRange == 0 ) {
|
if( repRange == 0 ) {
|
||||||
eo::log << eo::warnings << "Null range in eoRealBounds (min=" << _min << ", max=" << _max << ")" << std::endl;
|
eo::log << eo::warnings << "Warning: null range in eoRealBounds (min=" << _min << ", max=" << _max << ")" << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,12 +163,26 @@ class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric <
|
||||||
min = std::min(min, _set2[j][i]);
|
min = std::min(min, _set2[j][i]);
|
||||||
max = std::max(max, _set2[j][i]);
|
max = std::max(max, _set2[j][i]);
|
||||||
}
|
}
|
||||||
bounds[i] = eoRealInterval(min, max);
|
if( min == max ) {
|
||||||
|
bounds[i] = eoRealInterval(min-tiny(), max+tiny());
|
||||||
|
} else {
|
||||||
|
bounds[i] = eoRealInterval(min, max);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a very small value that can be used to avoid extreme cases (where the min bound == the max bound)
|
||||||
|
*/
|
||||||
|
static double tiny()
|
||||||
|
{
|
||||||
|
return 1e-6;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
/*boolean indicates if data must be normalized or not*/
|
/*boolean indicates if data must be normalized or not*/
|
||||||
bool normalize;
|
bool normalize;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue