Skip to content

GDP: Fix performance degredation in hull transformation#3366

Merged
emma58 merged 10 commits intoPyomo:mainfrom
emma58:hull-performance-reference-issue
Oct 15, 2024
Merged

GDP: Fix performance degredation in hull transformation#3366
emma58 merged 10 commits intoPyomo:mainfrom
emma58:hull-performance-reference-issue

Conversation

@emma58
Copy link
Copy Markdown
Contributor

@emma58 emma58 commented Sep 9, 2024

Fixes # .

Summary/Motivation:

In #3143, I accidentally introduced a performance degradation into gdp.hull because of using a Reference over a slice in order to map from disaggregated variables to the bound constraints for them. This PR eliminates the use of Reference, taking the hull transformation time on one model down from 150 seconds to 50 seconds.

NOTE: this includes #3365 in an attempt to get tests passing

Changes proposed in this PR:

  • Move the logic for mapping from disaggregated variables to their bound constraints to the _declare_disaggregated_var_bounds helper method that actually knows whether we have both lower and upper bounds for the variables.
  • No longer using the same keys in the _boundConstraints component on the transformation Block as we do in the mappings--the mappings can be pretty and simple ('lb' and 'ub') since they end up public-facing via the get_var_bounds_constraint method whereas the actual keys in _boundsConstraints can be ugly and unique.

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
Copy Markdown

codecov bot commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.63%. Comparing base (b983b91) to head (149691a).
Report is 905 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3366      +/-   ##
==========================================
- Coverage   88.63%   88.63%   -0.01%     
==========================================
  Files         879      879              
  Lines      100221   100227       +6     
==========================================
- Hits        88834    88833       -1     
- Misses      11387    11394       +7     
Flag Coverage Δ
linux 86.27% <100.00%> (+<0.01%) ⬆️
osx 75.64% <100.00%> (+<0.01%) ⬆️
other 86.76% <100.00%> (+<0.01%) ⬆️
win 84.02% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mrmundt mrmundt requested a review from bernalde October 8, 2024 18:54
@emma58 emma58 merged commit 459f8e8 into Pyomo:main Oct 15, 2024
@emma58 emma58 deleted the hull-performance-reference-issue branch October 15, 2024 19:14
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