moocore.hypervolume#

moocore.hypervolume(data, /, ref, maximise=False)[source]#

Hypervolume indicator.

Compute the hypervolume metric with respect to a given reference point assuming minimization of all objectives. For 2D and 3D, the algorithm used [1][2] has \(O(n \log n)\) complexity. For 4D or higher, the algorithm [1] has \(O(n^{d-2} \log n)\) time and linear space complexity in the worst-case, but experimental results show that the pruning techniques used may reduce the time complexity even further.

Parameters:
  • data (ArrayLike) – Numpy array of numerical values, where each row gives the coordinates of a point. If the array is created from the read_datasets() function, remove the last column.

  • ref (ArrayLike) – Reference point as a 1D vector. Must be same length as a single point in the data.

  • maximise (bool | list[bool], default: False) – Whether the objectives must be maximised instead of minimised. Either a single boolean value that applies to all objectives or a list of booleans, with one value per objective. Also accepts a 1d numpy array with value 0/1 for each objective

Returns:

float – A single numerical value, the hypervolume indicator

References

Examples

>>> dat = np.array([[5, 5], [4, 6], [2, 7], [7, 4]])
>>> moocore.hypervolume(dat, ref=[10, 10])
38.0

Merge all the sets of a dataset by removing the set number column:

>>> dat = moocore.get_dataset("input1.dat")[:, :-1]
>>> len(dat)
100

Dominated points are ignored, so this:

>>> moocore.hypervolume(dat, ref=[10, 10])
93.55331425585321

gives the same hypervolume as this:

>>> dat = moocore.filter_dominated(dat)
>>> len(dat)
6
>>> moocore.hypervolume(dat, ref=[10, 10])
93.55331425585321