-
Notifications
You must be signed in to change notification settings - Fork 505
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
Incremental PW linear to MIP transformation #3287
Conversation
…ify variables mode does not work, gives infeasible models
…hoice, but not J1 implementation yet.
… transformation. However, gurobi is not magical enough to see the structure here so this basically amounts to asking for a Hamiltonian path in a big graph, and then some. I think I will have to do the 70s stuff after all. Some optimizations would reduce this to "only" asking for a Hamiltonian path on a sparser graph but that is still terrible.
… mild assumptions
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3287 +/- ##
==========================================
+ Coverage 88.59% 88.64% +0.04%
==========================================
Files 874 877 +3
Lines 99124 99579 +455
==========================================
+ Hits 87822 88267 +445
- Misses 11302 11312 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…n its file, and wrapping it in a function so that it doesn't get built when pyomo.environ is imported
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.
@sadavis1, I put in a test of the 3D Hamiltonian paths, but I'm not quite sure how to check that they are the right paths given the keys, so would appreciate input if you get a chance. Otherwise this looks good to go. (We've agreed to refactor the simplices
and triangulation
arguments for PiecewiseLinearFunctions in a follow-on PR (not targeting the upcoming release)).
@jsiirola this is ready for you to take a look! :) |
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.
Some minor questions (that can be dealt with in the future), but overall looks good.
# starting permutation, such that a fixed target symbol is either the image | ||
# rho(1), or it is rho(n), depending on whether first or last is requested, | ||
# where rho is the final permutation. | ||
def _get_Gn_hamiltonian(n, start_permutation, target_symbol, last, _cache={}): |
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.
This is dangerous (although maybe you intend it?): all calls to _get_Gn_hamiltonian
that do not provide _cache
share the same dict object.
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.
I'm pretty sure this is intended. But maybe @sadavis1 can confirm at some point... (And perhaps we should add a comment).
Summary/Motivation:
Add another transformation, the incremental MIP formulation, to our slowly growing library of things to do with piecewise-linear functions. This one requires a specially ordered triangulation, so some infrastructure around triangulations is also needed.
Changes proposed in this PR:
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: