added exact hull reformulations#2
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an exact_hull_quadratic configuration option to the Hull GDP reformulation in Pyomo. When enabled, quadratic constraints (polynomial degree 2) are reformulated using mathematically exact hull formulations instead of the standard perspective function approach, exploiting the structure of quadratic constraints to produce tighter relaxations.
Changes:
- Added
exact_hull_quadraticconfig option (defaultFalse) toHull_Reformulationand modified_transform_constraintto detect degree-2 constraints and dispatch to new exact hull logic. - Added
_build_exact_quadratic_hullmethod that constructs the Q matrix, determines convexity via eigenvalue decomposition, and dispatches to conic (for convex) or general (for non-convex) formulations. - Added
_build_general_exact_hull_exprand_build_conic_exact_hull_exprhelper methods implementing the two reformulation strategies, plus new imports fornumpy,generate_standard_repn, andNonNegativeReals.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@sergey-gusev94 I've opened a new pull request, #3, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: sergey-gusev94 <101810399+sergey-gusev94@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Make eigenvalue PSD/NSD tolerance configurable in hull exact quadratic reformulation
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@sergey-gusev94 I've opened a new pull request, #4, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@sergey-gusev94 I've opened a new pull request, #5, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@sergey-gusev94 I've opened a new pull request, #6, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: sergey-gusev94 <101810399+sergey-gusev94@users.noreply.github.com>
…ic feature Co-authored-by: sergey-gusev94 <101810399+sergey-gusev94@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bernalde
left a comment
There was a problem hiding this comment.
I left a few small comments that should be easy to address.
As a general comment, allow for tests to be executed in your fork through Github actions, as currently I'm unsure whether this would pass tests from pyomo (including linting, and coverage).
There also seems to be some missing changes from copilot so address them locally rather than waiting for copilot to finish those
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This issue is breaking some tests: |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Black the format of pyomo/pyomo/contrib/mindtpy/algorithm_base_class.py
Fixes # .
Summary/Motivation:
The standard hull reformulation uses perspective functions for all nonlinear constraints, which does not exploit the structure of quadratic constraints. For quadratics, an exact hull reformulation exists that produces tighter relaxations — using conic (rotated SOC) constraints for convex quadratics and a direct disaggregated quadratic form for non-convex ones.
Changes proposed in this PR:
Added exact_hull_quadratic configuration option (default False) to Hull_Reformulation that enables exact hull treatment of quadratic constraints.
Modified _transform_constraint to detect degree-2 constraints when the flag is active and delegate to new exact hull logic instead of the standard perspective function.
Added _build_exact_quadratic_hull method that builds the symmetric Q matrix, determines convexity via eigenvalue decomposition, and dispatches to the appropriate reformulation strategy.
Added _build_general_exact_hull_expr method for non-convex/equality quadratics: constructs v'Qv + c'vy + dy**2.
Added _build_conic_exact_hull_expr method for convex quadratics: introduces auxiliary variable t >= 0, adds rotated SOC constraint v'Qv <= ty, and returns linear expression t + c'v + dy.
Added numpy, generate_standard_repn, and NonNegativeReals imports.
Existing behavior is unchanged when the flag is not set.
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: