Repository navigation
[unopy] Apply the preset when it is set with set_option("preset", ...) - #1039
Merged
Merged
Conversation
The string set_option overload only stored "preset" in the user options and
never refreshed the preset options, so optimize() overlaid an empty preset and
failed on a missing ingredient option (e.g. inequality_handling_method).
set_preset and set_option("preset", ...) now go through a single
UnoSolverWrapper::set_preset, matching the C API's uno_set_solver_string_option.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A-CGray
marked this pull request as ready for review
November 2, 2026 23:27
cvanaret
reviewed
Nov 3, 2026
cvanaret
reviewed
Nov 3, 2026
Co-authored-by: Charlie Vanaret <vanaret@zib.de>
Owner
|
@A-CGray great catch, thanks a lot! |
cvanaret
approved these changes
Nov 3, 2026
Owner
|
Patched in unopy 0.4.17. |
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
Fixes #1040
This change adds one function,
UnoSolverWrapper::set_preset.Both
set_presetandset_option("preset", ...)now use itTests
This change adds three tests to
interfaces/Python/tests/test_solvers.py:test_preset_as_optiondoes a check of each preset:filtersqp,filterslp,funnelsqp,ipoptandauto.It solves hs015 two times: one time with
set_option("preset", ...), and one time withset_preset.The test makes sure that the two solves use the same method and give the same result.
test_preset_option_overrides_previous_presetsets the preset two times: first withset_preset, then withset_option.The test makes sure that the solver uses the second preset.
test_unknown_preset_raisessets a preset name that does not exist.The test makes sure that both
set_optionandset_presetraise an error immediately.🤖 Generated with Claude Code