Function hypervolume_wfg
pub fn hypervolume_wfg(
points: &[Vec<f64>],
reference: &[f64],
directions: &[Direction],
) -> Result<f64>Expand description
The hypervolume indicator for any number of objectives, computed exactly by the WFG algorithm.
The same quantity, reference-point contract and point-skipping rules as
hypervolume: a point that is malformed,
non-finite, or that does not
strictly beat reference in every objective encloses no volume and is
skipped; duplicates and dominated points add nothing. The difference is the
dimension: up to MAX_EXACT_HYPERVOLUME_DIM objectives this delegates
to hypervolume and returns exactly its result, and above that it runs
WFG instead of refusing.
§Algorithm and cost
WFG (While, Bradstreet, Barone 2012; Optuna optuna/_hypervolume/wfg.py)
sorts the non-dominated points by the first objective and sums exclusive
contributions: the hypervolume of p₁ … pₙ is the box of pₙ plus, for
every earlier pᵢ, the box of pᵢ minus the hypervolume of the later points
each limited to pᵢ (componentwise max). Limiting makes most of those
later points dominated, so they are filtered out before the recursion — the
pruning that makes WFG fast in practice.
Exact hypervolume is #P-hard in the number of objectives, and WFG’s worst
case is exponential in it. Its recursive slicing also makes runtime grow
with the number of points; pruning often reduces the rows passed to later
recursive calls, but does not make point count irrelevant. It is practical
for the population sizes a sampler works with (tens to a few hundred points
in 4–6 objectives); it is not a tool for scoring ten thousand points in ten
objectives. That is why this is a separate entry point rather than a change
to hypervolume.
Near the exponent limits, volume arithmetic uses scaled exponents with
f64 precision. A final result that overflows f64 is reported as +∞;
intermediate overflow alone does not force an infinite result.
§Errors
Error::InvalidSpace if directions is empty, if reference does not
have one entry per direction, or if reference carries a non-finite value.
use atune_core::pareto::hypervolume_wfg;
use atune_core::study::Direction::Minimize;
// Four 4-D points, each one unit better than (2, 2, 2, 2) in one objective,
// against the reference (3, 3, 3, 3): the union of their boxes is the shared
// unit cube plus one unit cube per point.
let front = vec![
vec![1.0, 2.0, 2.0, 2.0],
vec![2.0, 1.0, 2.0, 2.0],
vec![2.0, 2.0, 1.0, 2.0],
vec![2.0, 2.0, 2.0, 1.0],
];
let hv = hypervolume_wfg(&front, &[3.0; 4], &[Minimize; 4])?;
assert_eq!(hv, 5.0);