From 2e446b4b919c2b8b828275bd2db3ac47e830726f Mon Sep 17 00:00:00 2001 From: Max Balandat Date: Mon, 11 Jul 2022 23:49:44 -0700 Subject: [PATCH] Skip bound validation in optimize_acqf if inequality constraints are specified (#1297) Summary: 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. Pull Request resolved: https://github.com/pytorch/botorch/pull/1297 Reviewed By: saitcakmak Differential Revision: D37773082 Pulled By: Balandat fbshipit-source-id: cc64868a6c0af61aa3c846d2ed51da02cc5f6a20 --- 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: