From b2d9047b4338f3659325c16feb7ffeb1cd43499a Mon Sep 17 00:00:00 2001 From: Max Balandat Date: Mon, 11 Jul 2022 17:27:00 -0700 Subject: [PATCH] Skip bound validation in optimize_acqf if inequality constraints are specified In some cases we may allow not using box constraints (e.g. when optimizing Alebo). This removes a check that currently breaks Alebo optimization. A proper solution should actually validate the constraint set, this was started in https://github.com/pytorch/botorch/pull/1231 but there are some nontrivial issues with this, so this provides a quick fix in the meantime. --- botorch/optim/optimize.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/botorch/optim/optimize.py b/botorch/optim/optimize.py index f071239dbe..6caf37904d 100644 --- a/botorch/optim/optimize.py +++ b/botorch/optim/optimize.py @@ -125,10 +125,14 @@ def optimize_acqf( >>> qEI, bounds, 3, 15, 256, sequential=True >>> ) """ - if not (bounds.ndim == 2 and bounds.shape[0] == 2): - raise ValueError( - f"bounds should be a `2 x d` tensor, current shape: {list(bounds.shape)}." - ) + if inequality_constraints is None: + if not (bounds.ndim == 2 and bounds.shape[0] == 2): + raise ValueError( + "bounds should be a `2 x d` tensor, current shape: " + f"{list(bounds.shape)}." + ) + # TODO: Validate constraints if provided: + # https://github.com/pytorch/botorch/pull/1231 if sequential and q > 1: if not return_best_only: