Example of incluing constraints in acquisition function acquisition. #773
-
First, thanks for open-sourcing this project. It's amazing! I see there's an option to pass constraints to optimize_acqf, but it's not clear to me how to get this to work in practice. Could anyone help with some examples? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Sure - say you want to optimize a function over the unit simplex You can pass equality constraints analogously. Hope this helps! |
Beta Was this translation helpful? Give feedback.
Sure - say you want to optimize a function over the unit simplex
{x \in R^2: x_1>=0, x2>=0, x1+x2<=1}
. Then you'd useoptimize_acqf
with bounds[(0, 1), (0, 1)]
andinequality_constraints = [(torch.tensor([0, 1]) , torch.tensor([-1, -1]), -1)]
. This translates tox[0]*(-1) + x[1]*(-1) >= -1
, which if you multiply by -1 is the linear constraintx1+x2<=1
you want. You can add other linear inequality constraints by adding to the list.You can pass equality constraints analogously.
Hope this helps!