Enforce equality constraints in random generator rejection sampling (#5182)#5182
Closed
sdaulton wants to merge 2 commits into
Closed
Enforce equality constraints in random generator rejection sampling (#5182)#5182sdaulton wants to merge 2 commits into
sdaulton wants to merge 2 commits into
Conversation
|
@sdaulton has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100256485. |
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
Apr 17, 2026
…acebook#5182) Summary: Pull Request resolved: facebook#5182 Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Differential Revision: D100256485
44be19a to
1da1880
Compare
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
Apr 17, 2026
…acebook#5182) Summary: Pull Request resolved: facebook#5182 Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Differential Revision: D100256485
1da1880 to
e352e83
Compare
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
Apr 17, 2026
…acebook#5182) Summary: Pull Request resolved: facebook#5182 Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Differential Revision: D100256485
e352e83 to
cb20056
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5182 +/- ##
==========================================
- Coverage 96.38% 96.38% -0.01%
==========================================
Files 617 617
Lines 69494 69579 +85
==========================================
+ Hits 66985 67065 +80
- Misses 2509 2514 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
Apr 20, 2026
…acebook#5182) Summary: Pull Request resolved: facebook#5182 Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Differential Revision: D100256485
8679ff5 to
15f9dd9
Compare
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
Apr 21, 2026
…acebook#5182) Summary: Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Differential Revision: D100256485
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
Apr 21, 2026
…acebook#5182) Summary: Pull Request resolved: facebook#5182 Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Differential Revision: D100256485
15f9dd9 to
a0c9d9c
Compare
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
May 1, 2026
…acebook#5182) Summary: Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Differential Revision: D100256485
619938b to
5363507
Compare
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
May 1, 2026
…acebook#5182) Summary: Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Differential Revision: D100256485
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
May 5, 2026
…acebook#5182) Summary: Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Reviewed By: esantorella Differential Revision: D100256485
5363507 to
5840025
Compare
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
May 5, 2026
…acebook#5182) Summary: Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Reviewed By: esantorella Differential Revision: D100256485
5840025 to
8e3d51d
Compare
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
May 5, 2026
…acebook#5182) Summary: Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Reviewed By: esantorella Differential Revision: D100256485
d0c7002 to
020a277
Compare
sdaulton
added a commit
to sdaulton/Ax-1
that referenced
this pull request
May 7, 2026
…acebook#5182) Summary: Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Reviewed By: esantorella Differential Revision: D100256485
Summary: Extend BONSAI's irrelevance pruning to handle both equality and inequality constraints via a pin-and-project approach. Previously, BONSAI simply discarded pruned candidates that violated constraints. This was overly conservative (inequality) or completely broken (equality, where almost all single-dimension prunes violate the constraint). The new approach: 1. Set x_j = target[j] (unchanged) 2. Project the other dimensions onto the feasible set via SLSQP, keeping x_j pinned (and all previously pruned dims pinned) 3. Filter any candidates that remain infeasible after projection This is strictly better than discarding: it recovers feasibility when possible by adjusting other dimensions, while infeasible pins (where no adjustment can satisfy the constraints) are still caught. Key implementation details: - `_project_and_filter_pruned_candidates`: new function that uses `project_to_feasible_space_via_slsqp` with `fixed_features` to pin the pruned dim and all previously pruned dims. - Optimization: skip projection for dims not in any constraint's index set (pruning them can't violate anything). - Handles 2D inter-point constraint indices correctly. - `_prune_irrelevant_parameters` now accepts `bounds` parameter. Reviewed By: esantorella Differential Revision: D100256483
…acebook#5182) Summary: Random generators (Sobol, etc.) were not respecting equality constraints during candidate generation. Two fixes: 1. When equality constraints are present, skip rejection sampling entirely and go straight to polytope sampling. Unconstrained random samples have probability zero of satisfying continuous equality constraints, so rejection sampling would always exhaust max_draws. 2. Add `equality_constraints` parameter to `rejection_sample` and `check_param_constraints` so that post-rounding feasibility checks also validate equality constraints (important when the polytope sampler fallback uses rejection_sample for deduplication). Reviewed By: esantorella Differential Revision: D100256485
020a277 to
286fd3f
Compare
|
This pull request has been merged in 47defa1. |
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:
Random generators (Sobol, etc.) were not respecting equality constraints
during candidate generation. Two fixes:
When equality constraints are present, skip rejection sampling entirely
and go straight to polytope sampling. Unconstrained random samples have
probability zero of satisfying continuous equality constraints, so
rejection sampling would always exhaust max_draws.
Add
equality_constraintsparameter torejection_sampleandcheck_param_constraintsso that post-rounding feasibility checksalso validate equality constraints (important when the polytope sampler
fallback uses rejection_sample for deduplication).
Reviewed By: esantorella
Differential Revision: D100256485