def test_pareto_hypervolume_indicator_raises_for_reference_below_anti_ideal_point( reference: list[float], ) -> None: pareto = Pareto(tf.constant([[-1.0, -0.6], [-0.8, -0.7], [-0.6, -1.1]])) with pytest.raises(tf.errors.InvalidArgumentError): pareto.hypervolume_indicator(tf.constant(reference))
def test_pareto_hypervolume_indicator_raises_for_reference_with_invalid_shape( reference: SequenceN[float], ) -> None: pareto = Pareto(tf.constant([[-1.0, -0.6], [-0.8, -0.7], [-0.6, -1.1]])) with pytest.raises(TF_DEBUGGING_ERROR_TYPES): pareto.hypervolume_indicator(tf.constant(reference))
def test_pareto_hypervolume_indicator( objectives: list[list[float]], reference: list[float], expected: float ) -> None: pareto = Pareto(tf.constant(objectives)) npt.assert_allclose(pareto.hypervolume_indicator(tf.constant(reference)), expected)