Function hypervolume
pub fn hypervolume(
points: &[Vec<f64>],
reference: &[f64],
directions: &[Direction],
) -> Result<f64>Expand description
The hypervolume indicator: the volume of objective space that points
dominate, bounded by reference.
The standard scalar quality measure for a Pareto front — it rewards a front for being both close to the true front (convergence) and spread along it (diversity), which no single-objective summary of a multi-objective study can do. Larger is always better, whatever the directions are.
Arithmetic near the exponent limits uses scaled volumes with f64
precision, so intermediate overflow or underflow need not destroy a
representable result. The final result is +∞ if it exceeds f64’s range,
or zero if it is too small to represent.
§The reference point
The hypervolume is only defined relative to a point that every solution is better than in every objective; it is the far corner of the box being measured. A solution that ties or loses to the reference in any objective contributes zero and is silently skipped — it is outside the measured box, not an error.
nadir_point computes the usual choice (the componentwise worst observed
value). Note what that implies: the worst solution in each objective sits
on the reference and therefore contributes nothing, and a reference
recomputed as the study grows makes the numbers from different moments
incomparable. A hypervolume history must be computed against one fixed
reference, chosen once — for instance the nadir of the final population,
or a domain-knowledge bound such as “0 return, 1 second”. That choice is the
caller’s, which is why this function does not make it.
§Complexity, and the dimension limit
| Objectives | Algorithm | Cost |
|---|---|---|
| 1 | the single best value | O(N) |
| 2 | staircase sweep after a sort | O(N log N) |
| 3 | dimension sweep: slice along objective 3, 2-D sweep per slab | O(N² log N) |
| ≥ 4 | refused (MAX_EXACT_HYPERVOLUME_DIM) | — |
§Errors
Error::InvalidSpace if directions is empty, if it holds more than
MAX_EXACT_HYPERVOLUME_DIM objectives, if reference does not have one
entry per direction, or if reference carries a non-finite value (there is
no finite volume to report against an infinite corner). A point that is
malformed or non-finite is skipped rather than fatal, so one diverged trial
cannot make a whole report unanswerable.
use atune_core::pareto::hypervolume;
use atune_core::study::Direction::Minimize;
// Three points of a minimisation front against the reference (4, 4).
let front = vec![vec![1.0, 3.0], vec![2.0, 2.0], vec![3.0, 1.0]];
let hv = hypervolume(&front, &[4.0, 4.0], &[Minimize, Minimize])?;
assert_eq!(hv, 6.0);