Skip to content

Example of incluing constraints in acquisition function acquisition. #773

Answered by Balandat
marcosfelt asked this question in Q&A
Discussion options

You must be logged in to vote

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 use optimize_acqf with bounds [(0, 1), (0, 1)] and inequality_constraints = [(torch.tensor([0, 1]) , torch.tensor([-1, -1]), -1)]. This translates to x[0]*(-1) + x[1]*(-1) >= -1, which if you multiply by -1 is the linear constraint x1+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!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@marcosfelt
Comment options

Answer selected by marcosfelt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants