Skip to content

Commit

Permalink
Remove reference_point from multi-objective benchmark problems (#2619)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2619

It is not used.

Reviewed By: sdaulton

Differential Revision: D60474602

fbshipit-source-id: 68367847d2639373cfa9657eaa5e21b21be1f60d
  • Loading branch information
esantorella authored and facebook-github-bot committed Aug 7, 2024
1 parent 0b6b160 commit e459a08
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
8 changes: 3 additions & 5 deletions ax/benchmark/benchmark_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,12 @@ class MultiObjectiveBenchmarkProblem(BenchmarkProblem):
A `BenchmarkProblem` that supports multiple objectives.
For multi-objective problems, `optimal_value` indicates the maximum
hypervolume attainable with the given `reference_point`.
hypervolume attainable with the objective thresholds provided on the
`optimization_config`.
For argument descriptions, see `BenchmarkProblem`; it additionally takes a `runner`
and a `reference_point`.
For argument descriptions, see `BenchmarkProblem`.
"""

reference_point: List[float]
optimization_config: MultiObjectiveOptimizationConfig


Expand Down Expand Up @@ -289,5 +288,4 @@ def create_multi_objective_problem_from_botorch(
observe_noise_stds=observe_noise_sd,
has_ground_truth=problem.has_ground_truth,
optimal_value=test_problem.max_hv,
reference_point=test_problem._ref_point,
)
20 changes: 15 additions & 5 deletions ax/benchmark/problems/surrogate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
# LICENSE file in the root directory of this source tree.

# pyre-strict
"""
Benchmark problems based on surrogates.
These problems might appear to function identically to their non-surrogate
counterparts, `BenchmarkProblem` and `MultiObjectiveBenchmarkProblem`, aside
from the restriction that their runners are of type `SurrogateRunner`. However,
they are treated specially within JSON storage because surrogates cannot be
easily serialized.
"""

from dataclasses import dataclass, field
from typing import List

from ax.benchmark.benchmark_problem import BenchmarkProblem

from ax.benchmark.runners.surrogate import SurrogateRunner
from ax.core.optimization_config import MultiObjectiveOptimizationConfig

Expand All @@ -21,6 +28,8 @@ class SurrogateBenchmarkProblemBase(BenchmarkProblem):
Its `runner` is a `SurrogateRunner`, which allows for the surrogate to be
constructed lazily and datasets to be downloaded lazily.
For argument descriptions, see `BenchmarkProblem`.
"""

runner: SurrogateRunner = field(repr=False)
Expand All @@ -34,9 +43,10 @@ class SOOSurrogateBenchmarkProblem(SurrogateBenchmarkProblemBase):
class MOOSurrogateBenchmarkProblem(SurrogateBenchmarkProblemBase):
"""
Has the same attributes/properties as a `MultiObjectiveBenchmarkProblem`,
but its runner is not constructed until needed, to allow for deferring
constructing the surrogate and downloading data.
but its `runner` is a `SurrogateRunner`, which allows for the surrogate to be
constructed lazily and datasets to be downloaded lazily.
For argument descriptions, see `BenchmarkProblem`.
"""

optimization_config: MultiObjectiveOptimizationConfig
reference_point: List[float]
6 changes: 5 additions & 1 deletion ax/benchmark/tests/test_benchmark_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ def test_moo_from_botorch(self) -> None:

# Test hypervolume
self.assertEqual(branin_currin_problem.optimal_value, test_problem._max_hv)
self.assertEqual(branin_currin_problem.reference_point, test_problem._ref_point)
opt_config = branin_currin_problem.optimization_config
reference_point = [
threshold.bound for threshold in opt_config.objective_thresholds
]
self.assertEqual(reference_point, test_problem._ref_point)

def test_moo_from_botorch_constrained(self) -> None:
with self.assertRaisesRegex(
Expand Down
1 change: 0 additions & 1 deletion ax/utils/testing/benchmark_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def get_moo_surrogate() -> MOOSurrogateBenchmarkProblem:
num_trials=10,
observe_noise_stds=True,
optimal_value=1.0,
reference_point=[],
runner=runner,
is_noiseless=runner.is_noiseless,
)
Expand Down

0 comments on commit e459a08

Please sign in to comment.