Skip to content

Conversation

@shermanjasonaf
Copy link
Contributor

@shermanjasonaf shermanjasonaf commented Mar 7, 2022

Summary/Motivation:

PyROS does not gracefully handle models with:

  • uninitialized variables on which the objective function is contingent
  • uninitialized second stage variables

as auxiliary variables are initialized to values using the value() method. In either case, an exception is raised by the value() method.

Changes proposed in this PR:

  • add exception=False option to the value() method calls used for initializing epigraph and decision rule variables. Consequently, by default, auxiliary variables are not initialized if any of the variables used to
    initialize the auxiliary variables are not initialized.
  • add a corresponding unit test

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.

Copy link
Member

@jsiirola jsiirola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good.

@codecov
Copy link

codecov bot commented Mar 9, 2022

Codecov Report

Merging #2331 (1ef049d) into main (94d1184) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2331      +/-   ##
==========================================
+ Coverage   85.25%   85.33%   +0.07%     
==========================================
  Files         619      619              
  Lines       76425    77923    +1498     
==========================================
+ Hits        65157    66493    +1336     
- Misses      11268    11430     +162     
Flag Coverage Δ
linux 82.42% <75.00%> (+0.33%) ⬆️
osx 72.66% <75.00%> (+0.18%) ⬆️
other 82.37% <75.00%> (+0.35%) ⬆️
win 79.47% <75.00%> (+0.21%) ⬆️

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

Impacted Files Coverage Δ
pyomo/contrib/pyros/pyros_algorithm_methods.py 88.34% <100.00%> (ø)
pyomo/contrib/pyros/util.py 82.36% <100.00%> (-0.07%) ⬇️
...rmest/examples/reactor_design/leaveNout_example.py 75.00% <0.00%> (-22.50%) ⬇️
pyomo/contrib/pynumero/sparse/mpi_block_matrix.py 57.24% <0.00%> (-9.53%) ⬇️
pyomo/core/kernel/dict_container.py 98.86% <0.00%> (-1.14%) ⬇️
pyomo/solvers/plugins/solvers/gurobi_direct.py 71.91% <0.00%> (-0.51%) ⬇️
examples/pyomobook/test_book_examples.py 96.80% <0.00%> (-0.41%) ⬇️
pyomo/core/kernel/block.py 99.70% <0.00%> (-0.30%) ⬇️
...ocessing/plugins/deactivate_trivial_constraints.py 93.05% <0.00%> (-0.28%) ⬇️
pyomo/core/base/external.py 98.49% <0.00%> (-0.08%) ⬇️
... and 12 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 94d1184...1ef049d. Read the comment docs.

@michaelbynum michaelbynum merged commit ac92609 into Pyomo:main Mar 11, 2022
@shermanjasonaf shermanjasonaf deleted the fix-pyros-var-initialization branch June 26, 2022 11:05
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