Skip to content

Commit 92140e9

Browse files
committed
Add minimal test
1 parent 9404fe1 commit 92140e9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/optim/test_optimize.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,6 +1934,29 @@ def test_optimize_acqf_mixed_empty_ff(self):
19341934
raw_samples=10,
19351935
)
19361936

1937+
def test_optimize_acqf_mixed_inter_point_constraints(self):
1938+
mock_acq_function = MockAcquisitionFunction()
1939+
with self.assertRaisesRegex(
1940+
UnsupportedError,
1941+
expected_regex="Inter-point constraints are not supported for sequential optimization. "
1942+
"But the 0th linear inequality constraint is defined as inter-point.",
1943+
):
1944+
optimize_acqf_mixed(
1945+
acq_function=mock_acq_function,
1946+
q=1,
1947+
fixed_features_list=[{0: 0.0}],
1948+
bounds=torch.stack([torch.zeros(3), 4 * torch.ones(3)]),
1949+
num_restarts=2,
1950+
raw_samples=10,
1951+
inequality_constraints=[
1952+
( # Inter-point constraint: X[0, 0] - X[1, 0] >= 0
1953+
torch.tensor([[0, 0], [1, 0]], dtype=torch.long),
1954+
torch.tensor([1.0, -1.0]),
1955+
0.0,
1956+
)
1957+
],
1958+
)
1959+
19371960
def test_optimize_acqf_mixed_return_best_only_q2(self):
19381961
mock_acq_function = MockAcquisitionFunction()
19391962
with self.assertRaisesRegex(

0 commit comments

Comments
 (0)