Continuous relaxation with fallback for inequality-constrained ordinal dims (#3261)#3261
Open
ItsMrLin wants to merge 1 commit intometa-pytorch:mainfrom
Open
Continuous relaxation with fallback for inequality-constrained ordinal dims (#3261)#3261ItsMrLin wants to merge 1 commit intometa-pytorch:mainfrom
ItsMrLin wants to merge 1 commit intometa-pytorch:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3261 +/- ##
=======================================
Coverage 99.98% 99.98%
=======================================
Files 221 221
Lines 21902 21926 +24
=======================================
+ Hits 21898 21922 +24
Misses 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ItsMrLin
added a commit
to ItsMrLin/botorch
that referenced
this pull request
Apr 2, 2026
…l dims (meta-pytorch#3261) Summary: `_setup_continuous_relaxation` in `optimize_mixed.py` blanket-excludes all constrained discrete dimensions from continuous relaxation, forcing them into discrete local search even when they have high cardinality. This is overly conservative for inequality constraints and causes severe performance degradation. **Problem:** When ordinal parameters (e.g., integers 0-50) participate in linear inequality constraints (e.g., `x1 + x2 + x3 <= 100`), they are kept as discrete dims regardless of cardinality. In mixed search spaces, this inflates the discrete combination count (e.g., 51^4 x 20 = 135M), forces `optimize_acqf_mixed_alternating`, and with default optimizer budgets (`raw_samples=1024`, `maxiter_init=100`, `maxiter_alternating=64`) across many sequential candidates, produces ~900K+ acquisition function evaluations -- taking hours instead of minutes. **Fix:** Try continuous relaxation first for inequality-constrained dims, with automatic fallback to keeping them discrete if infeasible candidates result. Specifically, `optimize_acqf_mixed_alternating` now: 1. **Fast path**: Calls `_setup_continuous_relaxation` with `inequality_constraints=None`, allowing inequality-constrained dims to be relaxed and optimized continuously. 2. **Feasibility check**: After optimization, checks if the candidates satisfy all constraints via `evaluate_feasibility`. 3. **Fallback**: If any candidates are infeasible (e.g., due to rounding violations with non-contiguous discrete choices or tight constraints), re-runs with inequality-constrained dims kept discrete. `_setup_continuous_relaxation` itself retains the D94963154 behavior of excluding all constrained dims passed to it — the caller controls which constraints are relevant by choosing what to pass. The optimization body is extracted into `_run_alternating_optimization` to enable the fallback without code duplication. Differential Revision: D99304800
8569f4f to
7f44cfc
Compare
ItsMrLin
added a commit
to ItsMrLin/botorch
that referenced
this pull request
Apr 2, 2026
…l dims (meta-pytorch#3261) Summary: `_setup_continuous_relaxation` in `optimize_mixed.py` blanket-excludes all constrained discrete dimensions from continuous relaxation, forcing them into discrete local search even when they have high cardinality. This is overly conservative for inequality constraints and causes severe performance degradation. **Problem:** When ordinal parameters (e.g., integers 0-50) participate in linear inequality constraints (e.g., `x1 + x2 + x3 <= 100`), they are kept as discrete dims regardless of cardinality. In mixed search spaces, this inflates the discrete combination count (e.g., 51^4 x 20 = 135M), forces `optimize_acqf_mixed_alternating`, and with default optimizer budgets (`raw_samples=1024`, `maxiter_init=100`, `maxiter_alternating=64`) across many sequential candidates, produces ~900K+ acquisition function evaluations -- taking hours instead of minutes. **Fix:** Try continuous relaxation first for inequality-constrained dims, with automatic fallback to keeping them discrete if infeasible candidates result. Specifically, `optimize_acqf_mixed_alternating` now: 1. **Fast path**: Calls `_setup_continuous_relaxation` with `inequality_constraints=None`, allowing inequality-constrained dims to be relaxed and optimized continuously. 2. **Feasibility check**: After optimization, checks if the candidates satisfy all constraints via `evaluate_feasibility`. 3. **Fallback**: If any candidates are infeasible (e.g., due to rounding violations with non-contiguous discrete choices or tight constraints), re-runs with inequality-constrained dims kept discrete. `_setup_continuous_relaxation` itself retains the D94963154 behavior of excluding all constrained dims passed to it — the caller controls which constraints are relevant by choosing what to pass. The optimization body is extracted into `_run_alternating_optimization` to enable the fallback without code duplication. Differential Revision: D99304800
7f44cfc to
4ca9007
Compare
…l dims (meta-pytorch#3261) Summary: Pull Request resolved: meta-pytorch#3261 `_setup_continuous_relaxation` in `optimize_mixed.py` blanket-excludes all constrained discrete dimensions from continuous relaxation, forcing them into discrete local search even when they have high cardinality. This is overly conservative for inequality constraints and causes severe performance degradation. **Problem:** When ordinal parameters (e.g., integers 0-50) participate in linear inequality constraints (e.g., `x1 + x2 + x3 <= 100`), they are kept as discrete dims regardless of cardinality. In mixed search spaces, this inflates the discrete combination count (e.g., 51^4 x 20 = 135M), forces `optimize_acqf_mixed_alternating`, and with default optimizer budgets (`raw_samples=1024`, `maxiter_init=100`, `maxiter_alternating=64`) across many sequential candidates, produces ~900K+ acquisition function evaluations -- taking hours instead of minutes. **Fix:** Try continuous relaxation first for inequality-constrained dims, with automatic fallback to keeping them discrete if infeasible candidates result. Specifically, `optimize_acqf_mixed_alternating` now: 1. **Fast path**: Calls `_setup_continuous_relaxation` with `inequality_constraints=None`, allowing inequality-constrained dims to be relaxed and optimized continuously. 2. **Feasibility check**: After optimization, checks if the candidates satisfy all constraints via `evaluate_feasibility`. 3. **Fallback**: If any candidates are infeasible (e.g., due to rounding violations with non-contiguous discrete choices or tight constraints), re-runs with inequality-constrained dims kept discrete. `_setup_continuous_relaxation` itself retains the D94963154 behavior of excluding all constrained dims passed to it — the caller controls which constraints are relevant by choosing what to pass. The optimization body is extracted into `_run_alternating_optimization` to enable the fallback without code duplication. Differential Revision: D99304800
4ca9007 to
8ced576
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
_setup_continuous_relaxationinoptimize_mixed.pyblanket-excludes allconstrained discrete dimensions from continuous relaxation, forcing them into
discrete local search even when they have high cardinality. This is overly
conservative for inequality constraints and causes severe performance
degradation.
Problem: When ordinal parameters (e.g., integers 0-50) participate in
linear inequality constraints (e.g.,
x1 + x2 + x3 <= 100), they are keptas discrete dims regardless of cardinality. In mixed search spaces, this
inflates the discrete combination count (e.g., 51^4 x 20 = 135M), forces
optimize_acqf_mixed_alternating, and with default optimizer budgets(
raw_samples=1024,maxiter_init=100,maxiter_alternating=64) acrossmany sequential candidates, produces ~900K+ acquisition function evaluations
-- taking hours instead of minutes.
Fix: Try continuous relaxation first for inequality-constrained dims, with
automatic fallback to keeping them discrete if infeasible candidates result.
Specifically,
optimize_acqf_mixed_alternatingnow:_setup_continuous_relaxationwithinequality_constraints=None, allowing inequality-constrained dims to berelaxed and optimized continuously.
all constraints via
evaluate_feasibility.violations with non-contiguous discrete choices or tight constraints),
re-runs with inequality-constrained dims kept discrete.
_setup_continuous_relaxationitself retains the D94963154 behavior ofexcluding all constrained dims passed to it — the caller controls which
constraints are relevant by choosing what to pass.
The optimization body is extracted into
_run_alternating_optimizationtoenable the fallback without code duplication.
Differential Revision: D99304800