Nonlinear constraints to BoFire (integration with acqf + tests + tutorials)#740
Open
MrzvskK wants to merge 26 commits intoexperimental-design:mainfrom
Open
Nonlinear constraints to BoFire (integration with acqf + tests + tutorials)#740MrzvskK wants to merge 26 commits intoexperimental-design:mainfrom
MrzvskK wants to merge 26 commits intoexperimental-design:mainfrom
Conversation
Add files via upload
…_Reaction_Optimization.qmd Co-authored-by: Johannes P. Dürholt <johannespeter.duerholt@evonik.com>
- Added filter_candidates_by_constraints() to filter feasible points - Added get_constraint_violations() to calculate violation amounts - Exported new functions in api.py - Added comprehensive tests
…torial runs smoothly
Contributor
|
Hi @MrzvskK, Does this help? |
Contributor
Author
|
@LukasHebing, this PR adds functionality to the BotorchOptimizer to handle nonlinear constraints. |
Contributor
Ok, great :) |
Contributor
Author
|
I fixed most of the issues, except of the last failing test, it has something to do with the conda. |
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.
Motivation
This is an early attempt, I am sure there will be a few changes needed along the way. But to start with something, so Nonlinear constraints (
NonlinearInequalityConstraintandNonlinearEqualityConstraint) were defined in BoFire's domain model but were not integrated into the optimization pipeline. The constraints were extracted from the domain but never passed to BoTorch'soptimize_acqf, causing the optimizer to ignore them and propose infeasible candidates.This PR:
acqf_optimization.pyto properly pass constraints to BoTorchis_equalityflag was inverted (all constraints were treated as equality constraints)torch_tools.pyto properly format constraints for BoTorch compatibilitybotorch.pyto ensure proposed candidates satisfy all constraintsHave you read the Contributing Guidelines on pull requests?
Yes
Have you updated
CHANGELOG.md?I will do that later
New Test Suite
Created
tests/bofire/strategies/test_nonlinear_constraints.pywith 16 comprehensive test cases:Constraint Types Tested:
Optimization Scenarios:
Results:
Tutorial
Created
docs/tutorials/basic_examples/nonlinear_constraints_basic_usage.pydemonstrating:Verification Steps
To verify the changes work: