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

Parmest utils submodule, added support for Params and Vars #2352

Merged
merged 20 commits into from
Jun 30, 2022

Conversation

kaklise
Copy link
Member

@kaklise kaklise commented Mar 30, 2022

Fixes #2281

Summary/Motivation:

This PR starts a utils submodule in parmest which contains functions that could be used within other Pyomo contrib packages. Currently, the submodule includes functionality from mpi-sppy (in create_ef.py and scenario_tree.py), an mpi task manager (in mpi_utils.py), and ipopt solver diagnostics (in ipopy_solver_wrapper.py). These files were all moved directly from the main parmest folder into parmest/utils.

An an additional utility function was added to convert model Params to Vars. The function that converts Params to Vars builds on methods in PyROS. Some modifications were made to retain the names from theta list (indexed parameters create indexed variables, non indexed parameters create non indexed variables). The reactor design model was updated to define unknown parameters as Params. Tests include cases that use Param, IndexedParam, Var, and IndexedVar.

Changes proposed in this PR:

  • Added parmest utils submodule
  • Added ability to convert model Params into Vars

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.

@codecov
Copy link

codecov bot commented Apr 12, 2022

Codecov Report

Merging #2352 (4ca54da) into main (b45a8ec) will increase coverage by 2.73%.
The diff coverage is 91.12%.

❗ Current head 4ca54da differs from pull request most recent head 7cb3f35. Consider uploading reports for the commit 7cb3f35 to get more accurate results

@@            Coverage Diff             @@
##             main    #2352      +/-   ##
==========================================
+ Coverage   82.93%   85.66%   +2.73%     
==========================================
  Files         612      621       +9     
  Lines       76023    76347     +324     
==========================================
+ Hits        63049    65403    +2354     
+ Misses      12974    10944    -2030     
Flag Coverage Δ
linux 80.79% <89.51%> (-1.92%) ⬇️
osx 72.88% <16.93%> (-0.07%) ⬇️
other 79.12% <89.51%> (-3.78%) ⬇️
win 79.73% <89.51%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyomo/contrib/parmest/utils/create_ef.py 84.16% <ø> (ø)
...yomo/contrib/parmest/utils/ipopt_solver_wrapper.py 96.77% <ø> (ø)
pyomo/contrib/parmest/utils/mpi_utils.py 47.42% <ø> (ø)
pyomo/contrib/parmest/utils/scenario_tree.py 81.25% <ø> (ø)
pyomo/contrib/parmest/utils/model_utils.py 89.87% <89.87%> (ø)
pyomo/contrib/parmest/parmest.py 81.63% <90.00%> (+1.31%) ⬆️
pyomo/contrib/parmest/__init__.py 100.00% <100.00%> (ø)
.../parmest/examples/reactor_design/reactor_design.py 96.96% <100.00%> (+25.91%) ⬆️
pyomo/contrib/parmest/utils/__init__.py 100.00% <100.00%> (ø)
pyomo/contrib/pynumero/examples/mumps_example.py 15.00% <0.00%> (-82.50%) ⬇️
... and 124 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c4f6ac9...7cb3f35. Read the comment docs.

@kaklise kaklise changed the title [WIP] Parmest utils submodule, added support for Params and Vars Parmest utils submodule, added support for Params and Vars May 17, 2022
@blnicho
Copy link
Member

blnicho commented May 19, 2022

@kaklise try merging main into your branch to see if that resolves the pypy failure

pyomo/contrib/parmest/parmest.py Outdated Show resolved Hide resolved
pyomo/contrib/parmest/parmest.py Outdated Show resolved Hide resolved
pyomo/contrib/parmest/utils/__init__.py Outdated Show resolved Hide resolved
pyomo/contrib/parmest/tests/test_utils.py Outdated Show resolved Hide resolved
pyomo/contrib/parmest/utils/__init__.py Outdated Show resolved Hide resolved
pyomo/contrib/parmest/utils/model_utils.py Outdated Show resolved Hide resolved
@blnicho
Copy link
Member

blnicho commented Jun 23, 2022

@kaklise just FYI, we're seeing these same test failures everywhere and working on a fix.

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.

parmest enhancement: support params or variables
5 participants