[Do Not Merge] Refactor cyipopt solve-time options to match classic Pyomo solver behavior#3871
Draft
adowling2 wants to merge 1 commit intoPyomo:mainfrom
Draft
[Do Not Merge] Refactor cyipopt solve-time options to match classic Pyomo solver behavior#3871adowling2 wants to merge 1 commit intoPyomo:mainfrom
cyipopt solve-time options to match classic Pyomo solver behavior#3871adowling2 wants to merge 1 commit intoPyomo:mainfrom
Conversation
Member
Author
|
This PR was created with Codex as part of an educational experiment. |
cyipopt solve-time options to match classic Pyomo solver behaviorcyipopt solve-time options to match classic Pyomo solver behavior
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.
Fixes # .
Summary/Motivation:
This PR makes the PyNumero
cyipoptsolver interface behave more like the classic Pyomo solver interfaces for solver options.Before this change,
SolverFactory("cyipopt")only consumed options stored on the solver object viasolver.config.options, which meant callers needing one-shot overrides had to mutate solver state around a solve. That was inconsistent with the rest of Pyomo, where callers can generally pass ephemeral options directly tosolve(...).With this change:
SolverFactory("cyipopt").solve(model, solver_options={...})is supportedSolverFactory("cyipopt").solve(model, options={...})is also supported for legacy-style compatibilitysolver.config.optionsare not permanently mutated by solve-time overridesoptions=andsolver_options=raises an error, matching existing Pyomo conventionsChanges proposed in this PR:
pyomo.contrib.pynumero.algorithms.solvers.cyipopt_solver.PyomoCyIpoptSolverSolverFactory("cyipopt")config.optionspyomo.contrib.doe.doe.DesignOfExperimentscyipoptsolve path to pass options through the solve call instead of relying solely on mutable solver state during the solvepyomo.contrib.mindtpycyipoptpaths so ephemeral settings likemax_cpu_timeandconstr_viol_tolare added to solve-time kwargs instead of mutatingopt.config.optionscyipoptsolvers unchangedcyipoptinterface covering:solver_optionsoverride defaults for a single solveoptions=supportoptions=andsolver_options=is rejectedPublic API Behavior
Before:
One-shot overrides generally required mutating solver.config.options before solve and then restoring them afterward.
After:
In both cases, the solve uses max_iter=1 for that call only, and the stored default remains 10
Compatibility / Risk Notes
options= remains supported for compatibility, but solver_options= is also accepted and is the preferred solve-time override path where applicable.
Outstanding Tasks Before Review
Suggested test commands once the environment is updated:
I am running a few minutes late; my previous meeting is running over.
Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: