contrib.piecewise: Adding nonlinear-to-piecewise-linear transformation#3333
contrib.piecewise: Adding nonlinear-to-piecewise-linear transformation#3333blnicho merged 58 commits intoPyomo:mainfrom
Conversation
…ause the space isn't full-dimensional
…r to GDP transformations
…ts and Objectives, fixing a few bugs
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3333 +/- ##
==========================================
+ Coverage 88.55% 88.60% +0.04%
==========================================
Files 877 878 +1
Lines 99262 99591 +329
==========================================
+ Hits 87906 88238 +332
+ Misses 11356 11353 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
Oops, I think this is failing coverage because we don't have |
|
If this passes tests, it is ready for review! |
Yes - I think so. Because you added I think the resolution is to add |
|
Oooof, now I broke everything? |
|
@emma58 GitHub was having issues yesterday so I just kicked off the GHA tests again to see if that fixes things. |
jsiirola
left a comment
There was a problem hiding this comment.
Overall, this looks pretty good. One thing that should be changed, though (defer the construction of the visitor, or move it to an instance attribute)
| _quadratic_repn_visitor = QuadraticRepnVisitor( | ||
| subexpression_cache={}, var_map={}, var_order={}, sorter=None | ||
| ) |
There was a problem hiding this comment.
This gets instantiated upon module import (which will happen as part of pyomo.environ. It would be better to put this in a getter:
def visitor():
if visitor._instance is None:
visitor._instance = QuadraticRepnVisitor(
subexpression_cache={}, var_map={}, var_order={}, sorter=None
)
return vistor._instanceThere was a problem hiding this comment.
I put it on the transformation instance.
Fixes # .
Summary/Motivation:
This PR adds a transformation that takes a MINLP model and automatically generated a piecewise-linear approximation of the model that can then be transformed to MILP using the other transformations in contrib.piecewise.
Changes proposed in this PR:
contrib.piecewise.nonlinear_to_pwltransformationLegal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: