Skip to content

Commit

Permalink
fea: naive fix to the init with inequalities
Browse files Browse the repository at this point in the history
  • Loading branch information
CompRhys committed Oct 24, 2024
1 parent f66f154 commit c3793bf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
25 changes: 17 additions & 8 deletions ax/models/torch/botorch_modular/sebo.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,23 @@ def _optimize_with_homotopy(
)
],
)
batch_initial_conditions = get_batch_initial_conditions(
acq_function=self.acqf,
raw_samples=optimizer_options_with_defaults["raw_samples"],
X_pareto=self.acqf.X_baseline,
target_point=self.target_point,
bounds=bounds,
num_restarts=optimizer_options_with_defaults["num_restarts"],
)
if inequality_constraints is None:
batch_initial_conditions = get_batch_initial_conditions(
acq_function=self.acqf,
raw_samples=optimizer_options_with_defaults["raw_samples"],
X_pareto=self.acqf.X_baseline,
target_point=self.target_point,
bounds=bounds,
num_restarts=optimizer_options_with_defaults["num_restarts"],
)
else:
warnings.warn(
"Adopting Botorch's default for sampling initial conditions as "
"inequality constraints are not supported for custom SEBO "
"initialization based on pareto front perturbation."
)
batch_initial_conditions = None

candidates, expected_acquisition_value = optimize_acqf_homotopy(
q=n,
acq_function=self.acqf,
Expand Down
1 change: 1 addition & 0 deletions ax/models/torch/tests/test_sebo.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ def test_optimize_l0(self, mock_optimize_acqf_homotopy: Mock) -> None:
self.assertEqual(kwargs["q"], 2)
self.assertEqual(kwargs["inequality_constraints"], self.inequality_constraints)
self.assertEqual(kwargs["post_processing_func"], self.rounding_func)
self.assertEqual(kwargs["batch_initial_conditions"], None)
self.assertEqual(kwargs["num_restarts"], self.optimizer_options["num_restarts"])
self.assertEqual(kwargs["raw_samples"], self.optimizer_options["raw_samples"])

Expand Down

0 comments on commit c3793bf

Please sign in to comment.