total_whv_rect#
- moocore.total_whv_rect(points, /, rectangles, *, ref, maximise=False, ideal=None, scalefactor=0.1)[source]#
Compute total weighted hypervolume given a set of rectangles.
Calculates the hypervolume weighted by a set of rectangles (with zero weight outside the rectangles). The function
total_whv_rect()calculates the total weighted hypervolume ashypervolume()+ scalefactor * abs(prod(ref - ideal)) *whv_rect(). The details of the computation are given by Diaz and López-Ibáñez[1].Warning
The current implementation only supports 2 objectives.
- Parameters:
points (ArrayLike) – 2D array of numerical values, where each row gives the coordinates of a point in objective space. If the array is created by the
read_datasets()function, remove the last column.rectangles (ArrayLike) – Weighted rectangles that will bias the computation of the hypervolume. Maybe generated by
eafdiff()withrectangles=Trueor bychoose_eafdiff().ref (ArrayLike) – Reference point as a 1D vector. Must be either a single value, which will be used for all coordinates, or the same length as a single point in
points.maximise (bool | Sequence[bool | int]) – Whether the objectives must be maximised instead of minimised. Either a single boolean value that applies to all objectives or a list of boolean values, with one value per objective. Also accepts a 1D array with values 0 or 1 for each objective. (default:
False)ideal (ArrayLike | None) – Ideal point as a vector of numerical values. If
None, it is calculated as minimum (or maximum if maximising that objective) of each objective in the input points. (default:None)scalefactor (float) – Real value within \((0,1]\) that scales the overall weight of the differences. This is parameter psi (\(\psi\)) in Diaz and López-Ibáñez[1]. (default:
0.1)
- Returns:
float – A single numerical value, the weighted hypervolume.
See also
References
Examples
>>> rectangles = np.array( ... [ ... [1.0, 3.0, 2.0, np.inf, 1], ... [2.0, 3.5, 2.5, np.inf, 2], ... [2.0, 3.0, 3.0, 3.5, 3], ... ] ... ) >>> whv_rect([[2, 2]], rectangles, ref=6) 4.0 >>> whv_rect([[2, 1]], rectangles, ref=6) 4.0 >>> whv_rect([[1, 2]], rectangles, ref=6) 7.0 >>> total_whv_rect([[2, 2]], rectangles, ref=6, ideal=1) 26.0 >>> total_whv_rect([[2, 1]], rectangles, ref=6, ideal=1) 30.0 >>> total_whv_rect([[1, 2]], rectangles, ref=6, ideal=1) 37.5