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

contrib.piecewise: Adding transformation to outer representation GDP #2766

Merged
merged 15 commits into from
Mar 17, 2023

Conversation

emma58
Copy link
Contributor

@emma58 emma58 commented Mar 11, 2023

Fixes # .

Summary/Motivation:

This adds a transformation from a model containing PiecewiseLinearFunctions to a GDP where the domains underlying each piece of the piecewise linear function are represented using an "outer" (Ax <= b) representation. This allows for a wrapper transformation to create the multiple choice formulation from Vielma et al. 2010.

NOTE: this includes the changes in #2708, so it will be easier to review once that is merged.

Changes proposed in this PR:

  • Creates a piecewise-linear-to-gdp-transformation base class since the only method that is unique to the different transformations is how we transform PiecewiseLinearExpressions themselves. This currently relies on scipy for multivariate functions.
  • Adds the 'contrib.piecewise.outer_repn_gdp' transformation
  • Centralizes common models and tests so there there isn't duplicated code there either. (Let it not be said that Emma never learns from her mistakes!)

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 Mar 11, 2023

Codecov Report

Patch coverage: 95.56% and no project coverage change.

Comparison is base (cf3fb9b) 87.00% compared to head (8164d7a) 87.01%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2766   +/-   ##
=======================================
  Coverage   87.00%   87.01%           
=======================================
  Files         758      761    +3     
  Lines       86991    87057   +66     
=======================================
+ Hits        75690    75751   +61     
- Misses      11301    11306    +5     
Flag Coverage Δ
linux 84.01% <95.56%> (+0.01%) ⬆️
osx 73.49% <95.56%> (+0.01%) ⬆️
other 84.19% <95.56%> (+0.01%) ⬆️
win 81.52% <95.56%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...ewise/transform/piecewise_to_gdp_transformation.py 92.63% <92.63%> (ø)
pyomo/contrib/piecewise/__init__.py 100.00% <100.00%> (ø)
...ib/piecewise/transform/inner_representation_gdp.py 100.00% <100.00%> (+4.68%) ⬆️
...omo/contrib/piecewise/transform/multiple_choice.py 100.00% <100.00%> (ø)
...ib/piecewise/transform/outer_representation_gdp.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@bernalde bernalde left a comment

Choose a reason for hiding this comment

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

Great PR. WIth the right framework of GDP, "advanced" formulations such as the PWL one from VIelma become easily implementable. I found a couple places where I had questions, but overall this is really great :)

@emma58
Copy link
Contributor Author

emma58 commented Mar 13, 2023

@jsiirola, this is ready to look at again.

@jsiirola jsiirola merged commit 0a087e9 into Pyomo:main Mar 17, 2023
@emma58 emma58 deleted the pw-linear-or branch February 15, 2024 17:17
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