pyomo
pyomo copied to clipboard
Data structures and utilities for (rolling horizon) dynamic optimization
Summary/Motivation:
I've had some data structures and utilities for dynamic optimization and rolling horizon case studies sitting on my hard drive for a while, and thought it was finally time to clean them up a little, write tests, and commit them somewhere. See the Overview doc page for my motivation for putting together this contrib package. I've found this code useful for MPC case studies, open-loop simulation case studies, and for formulating different kinds of optimal control problems.
Changes proposed in this PR:
- Add
mpc
contrib package with data structures, utilities, and an interface class for dynamic optimization - Add tests and some documentation
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:
- I agree my contributions are submitted under the BSD license.
- I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.
Codecov Report
Base: 86.75% // Head: 86.71% // Decreases project coverage by -0.04%
:warning:
Coverage data is based on head (
806ea49
) compared to base (affeee5
). Patch coverage: 88.44% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## main #2477 +/- ##
==========================================
- Coverage 86.75% 86.71% -0.05%
==========================================
Files 726 747 +21
Lines 81196 82284 +1088
==========================================
+ Hits 70445 71349 +904
- Misses 10751 10935 +184
Flag | Coverage Δ | |
---|---|---|
linux | 84.19% <88.44%> (+0.06%) |
:arrow_up: |
osx | 74.48% <74.83%> (+0.02%) |
:arrow_up: |
other | 84.37% <88.44%> (+0.06%) |
:arrow_up: |
win | 81.01% <88.44%> (+0.10%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
pyomo/contrib/mpc/examples/cstr/model.py | 59.43% <59.43%> (ø) |
|
pyomo/contrib/mpc/examples/cstr/run_openloop.py | 79.41% <79.41%> (ø) |
|
pyomo/contrib/mpc/interfaces/load_data.py | 84.48% <84.48%> (ø) |
|
pyomo/contrib/mpc/modeling/terminal.py | 85.29% <85.29%> (ø) |
|
pyomo/contrib/mpc/examples/cstr/run_mpc.py | 88.05% <88.05%> (ø) |
|
pyomo/contrib/mpc/interfaces/var_linker.py | 89.47% <89.47%> (ø) |
|
pyomo/contrib/mpc/data/dynamic_data_base.py | 89.58% <89.58%> (ø) |
|
pyomo/contrib/mpc/data/interval_data.py | 90.78% <90.78%> (ø) |
|
pyomo/contrib/mpc/interfaces/model_interface.py | 93.65% <93.65%> (ø) |
|
pyomo/contrib/mpc/modeling/cost_expressions.py | 94.25% <94.25%> (ø) |
|
... and 14 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
After discussing with @kuanhanl, including on PRs https://github.com/Robbybp/pyomo/pull/5 and https://github.com/kuanhanl/pyomo/pull/1, I've made some changes that I think will make this framework more amenable to MHE. These include:
- Updating the functions in cost_expressions.py and terminal.py to return a set indexing the list of provided variables in addition to the expression, which is now indexed by this set as well as time
- Updating names of "tracking cost" functions to refer to a generic "penalty" rather than tracking cost
In addition, I've made some API changes that make things somewhat simpler:
- Remove
load_data_from_...
methods onDynamicInterface
class. Now there is just a singleload_data
function that automatically decides how to load the data based on its type - Add a
get_penalty_from_target
function and method, which constructs an appropriate quadratic penalty expression depending on the type of data provided for the target
@blnicho Thank you for looking at this thoroughly. I've addressed your comments, and this is ready for re-review.
OSX failure appears unrelated