Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate constraints in optimize_acqf #1231

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Balandat
Copy link
Contributor

In some cases we may allow not using box constraints (e.g. when optimizing Alebo). Also, in general it would be good to the optimziation raise an error if the constraint set is empty.

Will require some unit tests.

In some cases we may allow not using box constraints (e.g. when optimizing Alebo). Also, in general it would be good to the optimziation raise an error if the constraint set is empty.
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label May 22, 2022
@codecov
Copy link

codecov bot commented May 22, 2022

Codecov Report

Merging #1231 (b499da9) into main (0afcf35) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##              main    #1231      +/-   ##
===========================================
- Coverage   100.00%   99.99%   -0.01%     
===========================================
  Files          122      122              
  Lines        10553    10607      +54     
===========================================
+ Hits         10553    10606      +53     
- Misses           0        1       +1     
Impacted Files Coverage Δ
botorch/optim/optimize.py 100.00% <100.00%> (ø)
botorch/acquisition/fixed_feature.py 98.18% <0.00%> (-1.82%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0afcf35...b499da9. Read the comment docs.

@Balandat
Copy link
Contributor Author

Not sure why the MacOS tests are failing, but that's unrelated to this PR.

@facebook-github-bot
Copy link
Contributor

@Balandat has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@Balandat
Copy link
Contributor Author

One question here is whether we're ok with solving an LP on each call of optimize_acqf as this isn't super lightweight. But I guess it's rather minimal compare to full fledged acquisition function optimization. We could also add a validate_constraints option that defaults to True but that we set to False in situations like running sequential greedy optimization where we know constraints don't change between calls.

This allows not running the validation. This is useful e.g in inner loops in order to avoid re-running the validation with the same parameters repeatedly.
@facebook-github-bot
Copy link
Contributor

@Balandat has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@Balandat has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@Balandat
Copy link
Contributor Author

Coverage gap is unrelated and fixed in #1234

@Balandat Balandat changed the title [RFC] Validate constraints in optimize_acqf Validate constraints in optimize_acqf May 28, 2022
Comment on lines +778 to +779
# min_(x, s) - sum_i(s_i)
# s.t. -x <= s <= x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct - we're trying to solve

max \sum_i |x_i|

and the correct transformation would be

max \sum_i s_i
s_i <= |x_i|

The constraint |x_i| >= s_i is equal to (x_i >= s_i) OR (x_i <= -s_i) and is not convex and so won't be representable as an LP.

The constraint given here, -x _i<= s_i <= x_i is equivalent to |s_i| <= x, which is convex but is not correct for the problem we're trying to solve. In particular it will only provide the correct answer for positive values of x_i; if the inequality and equality constraints are unbounded towards -Inf but has volume in the positive orthant, this LP will not detect the unboundedness.

Balandat added a commit to Balandat/botorch that referenced this pull request Jul 12, 2022
…specified

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 pytorch#1231 but there are some nontrivial issues with this, so this provides a quick fix in the meantime.
facebook-github-bot pushed a commit that referenced this pull request Jul 12, 2022
…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 #1231 but there are some nontrivial issues with this, so this provides a quick fix in the meantime.

Pull Request resolved: #1297

Reviewed By: saitcakmak

Differential Revision: D37773082

Pulled By: Balandat

fbshipit-source-id: cc64868a6c0af61aa3c846d2ed51da02cc5f6a20
@esantorella
Copy link
Member

Is there still a need for this? Conceptually the _validate_constraints function still makes sense.

@Balandat
Copy link
Contributor Author

Yeah I think we still want to do this, just correctly :) I think we should be able to use a slightly different reformulation of the problem to avoid the non-convexity issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants