-
Notifications
You must be signed in to change notification settings - Fork 517
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
Adding contrib.piecewise package #2708
Conversation
…is a (Python) function
…r 2D things, still bugs in 3D
…ultidimensional things over simplices
…ions (returning linear expressions) and list of simplices
…specifying simplices and linear functions
…w-linear functions in constraints.
…ting piecewise functions. This is terrifying.
…o be a weakref in order to avoid circular references
…ooks at the PiecewiseLinearFunctions to decide what to transform
…lock, but I don't think it should have to be.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2708 +/- ##
==========================================
+ Coverage 86.97% 87.00% +0.03%
==========================================
Files 752 758 +6
Lines 86602 86991 +389
==========================================
+ Hits 75319 75689 +370
- Misses 11283 11302 +19
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files 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. |
|
||
def nargs(self): | ||
return len(self._args_) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing create_node_with_local_data
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does this get called? I can't figure out how to test it.
pyomo/contrib/piecewise/transform/disaggregated_convex_combination.py
Outdated
Show resolved
Hide resolved
…ction instead of them having to store them, but this doesn't fix the tests yet
…le because of the lambda function in _construct_from_univariate_function_and_segments
…ld the PiecewiseLinearExpression objects to the Vars created by transformation. This way the truth is on the model and they know whether something has been transformed or not.
…nearExpressions store
@jsiirola I think I fixed everything except that |
Fixes # .
Summary/Motivation:
This adds a
contrib
package to support modeling with and reformulating multivariate piecewise linear functions. It has no dependencies for univariate functions, and for multivariate functions it relies onnumpy
and possiblyscipy
(depending on how the function is specified.) This PR adds the modeling components and one transformation as a proof-of-concept. Further transformations are forthcoming...Changes proposed in this PR:
PiecewiseLinearFunction
component that can be constructed from a list of points and a nonlinear function, a list of simplices (in the appropriate dimension) and a nonlinear function, or a list of simplices and a list of linear functions.PiecewiseLinearExpression
component that represents a specific use of aPiecewiseLinearFunction
.hull
to that GDP in order to make a known MIP formulation from the literature.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: