Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data structures and utilities for (rolling horizon) dynamic optimization #2477

Merged
merged 145 commits into from
Nov 4, 2022

Conversation

Robbybp
Copy link
Contributor

@Robbybp Robbybp commented Aug 6, 2022

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:

  1. I agree my contributions are submitted under the BSD license.
  2. 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.

@Robbybp
Copy link
Contributor Author

Robbybp commented Oct 30, 2022

After discussing with @kuanhanl, including on PRs Robbybp#5 and kuanhanl#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 on DynamicInterface class. Now there is just a single load_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 blnicho self-requested a review October 31, 2022 16:51
@Robbybp
Copy link
Contributor Author

Robbybp commented Oct 31, 2022

@blnicho Thank you for looking at this thoroughly. I've addressed your comments, and this is ready for re-review.

@Robbybp
Copy link
Contributor Author

Robbybp commented Oct 31, 2022

OSX failure appears unrelated

pyomo/contrib/mpc/interfaces/tests/test_interface.py Outdated Show resolved Hide resolved
pyomo/contrib/mpc/interfaces/tests/test_interface.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants