Using the equality_constraints argument in the optimize_acqf function #1899
-
I'm doing a BO code and I want to apply a constraint like x2+x4+x6=1, so I use the optimize_acqf function with this signature: new_x, value = optimize_acqf(
acq_function=acq_func,
bounds=to.tensor([[0.0] * 20, [1.0] * 20]),
q=BATCH_SIZE,
num_restarts=10,
raw_samples=100, # used for intialization heuristic
options={"batch_limit": 5, "maxiter": 200, "nonnegative": True},
equality_constraints=[(to.tensor([2,4,6]),to.tensor([1,1,1]),1)],
sequential=True,
) But when I try to run the code, I get a I've searched the docs, and here it says that the signature of the argument I want is
In another page referring to the same function (afaik) It says that the list of tuples should contain tensors and floats
But I haven't been able to figure out how I should define those tensors to run correctly. Can someone give me a simple example of how to use this argument? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
After a lot of searching, and a bunch of hours lost tracking code, I've found out that the optimize_acqf makes a call, under the hood, to gen_candidates_scipy which, in turn, when In the docstring of that function (or the docs, it doesn't really matter) we can see a good example of how to use the equality_constraints argument:
|
Beta Was this translation helpful? Give feedback.
After a lot of searching, and a bunch of hours lost tracking code, I've found out that the optimize_acqf makes a call, under the hood, to gen_candidates_scipy which, in turn, when
equality_constraints
is given, calls the function make_scipy_linear_constraints.In the docstring of that function (or the docs, it doesn't really matter) we can see a good example of how to use the equality_constraints argument: