Solver Refactor Pt. 2: Restructure for Future Redesign#3476
Solver Refactor Pt. 2: Restructure for Future Redesign#3476mrmundt merged 73 commits intoPyomo:mainfrom
Conversation
| from pyomo.contrib.solver.common.util import collect_vars_and_named_exprs, get_objective | ||
|
|
||
|
|
||
| class PersistentSolverUtils(abc.ABC): |
There was a problem hiding this comment.
NOT TODO for this PR:
- What is the intent of this class?
- To manage automatic checking of state / checking differences in the model and updating them; implements the "Auto" part of APPSI
- What is a better name?
PersistentSolverStateTracker? This is the classic "is-a" vs. "has-a". Other ideas:PersistentSolverChangeDetector,PersistentModelStateManager,PersistentSolverUpdater
Summary: We don't want the persistent solver interfaces to inherit from this; we want the classes to be able to contain one of these classes and use it. ModelChangeObserver
There was a problem hiding this comment.
Also probably won't need the _func_name and func_name standard here when re-worked.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3476 +/- ##
==========================================
- Coverage 88.64% 88.62% -0.02%
==========================================
Files 881 882 +1
Lines 100873 101370 +497
==========================================
+ Hits 89421 89843 +422
- Misses 11452 11527 +75
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
michaelbynum
left a comment
There was a problem hiding this comment.
After this PR is merged, we need to port some of the recent changes in appsi to here.
|
I have now gone through all of the changed files. |
| """ | ||
| Method to manually set options; can be called outside of the solve method | ||
| """ | ||
| opts = {k: v for k, v in options.value().items() if v is not None} |
There was a problem hiding this comment.
This implementation implicitly assumes options is a ConfigDict. We should update the documentation to include argument type specification, and then update the implementation to accept dict or ConfigDict (by dropping the call to value():
opts = {k: v for k, v in options.items() if v is not None}| return objective | ||
|
|
||
|
|
||
| class _VarAndNamedExprCollector(ExpressionValueVisitor): |
There was a problem hiding this comment.
TODO (later): this should be ported to the StreamBasedExpressionVisitor
There was a problem hiding this comment.
I have lots of these conversions to do...
Fixes #1030 (doesn't actually fix it; just the next step)
Summary/Motivation:
This is meant to be a "mid-point" for the ongoing solver refactor. It is currently working in this form, so this PR is intended to merge changes up to now so we can start making more fine-tuned changes that are easier to track.
Changes proposed in this PR:
pylint)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: