Skip to content

added exact hull reformulations#2

Merged
sergey-gusev94 merged 44 commits intoexact_hull_combinedfrom
ex_hull
Mar 17, 2026
Merged

added exact hull reformulations#2
sergey-gusev94 merged 44 commits intoexact_hull_combinedfrom
ex_hull

Conversation

@sergey-gusev94
Copy link
Copy Markdown
Owner

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:

  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.

@sergey-gusev94 sergey-gusev94 marked this pull request as ready for review March 7, 2026 02:35
@sergey-gusev94 sergey-gusev94 requested a review from Copilot March 7, 2026 02:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_quadratic config option (default False) to Hull_Reformulation and modified _transform_constraint to detect degree-2 constraints and dispatch to new exact hull logic.
  • Added _build_exact_quadratic_hull method 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_expr and _build_conic_exact_hull_expr helper methods implementing the two reformulation strategies, plus new imports for numpy, generate_standard_repn, and NonNegativeReals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyomo/gdp/plugins/hull.py Outdated
Comment thread pyomo/gdp/plugins/hull.py Outdated
Comment thread pyomo/gdp/plugins/hull.py Outdated
Comment thread pyomo/gdp/plugins/hull.py
Comment thread pyomo/gdp/plugins/hull.py Outdated
sergey-gusev94 and others added 4 commits March 6, 2026 23:25
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI commented Mar 7, 2026

@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.

Copilot AI and others added 5 commits March 7, 2026 04:46
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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread pyomo/gdp/plugins/hull.py
Comment thread pyomo/gdp/plugins/hull.py Outdated
Comment thread pyomo/gdp/plugins/hull.py Outdated
Comment thread pyomo/gdp/plugins/hull.py
Copy link
Copy Markdown

Copilot AI commented Mar 8, 2026

@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.

Copy link
Copy Markdown

Copilot AI commented Mar 8, 2026

@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.

Copy link
Copy Markdown

Copilot AI commented Mar 8, 2026

@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.

Copilot AI and others added 2 commits March 8, 2026 05:11
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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

@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.

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

Comment thread pyomo/gdp/plugins/hull.py Outdated
Comment thread pyomo/gdp/plugins/hull.py
Comment thread pyomo/gdp/plugins/hull.py Outdated
Comment thread pyomo/gdp/plugins/hull.py
Comment thread pyomo/gdp/plugins/hull.py
Comment thread pyomo/gdp/plugins/hull.py
Comment thread pyomo/gdp/plugins/hull.py
Comment thread pyomo/gdp/tests/models.py
Comment thread pyomo/gdp/tests/test_hull.py
Comment thread pyomo/gdp/tests/test_hull.py Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread pyomo/gdp/plugins/hull.py
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread pyomo/gdp/plugins/hull.py
@bernalde
Copy link
Copy Markdown
Collaborator

This issue is breaking some tests:

> /home/runner/work/pyomo/pyomo/pyomo/gdp/plugins/hull.py:121: SyntaxWarning: "\l" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\l"? A raw string is also an option.
>   eigenvalue :math:`\lambda` is treated as non-negative if

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread pyomo/gdp/plugins/hull.py
Comment thread pyomo/gdp/plugins/hull.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sergey-gusev94 sergey-gusev94 requested a review from bernalde March 15, 2026 21:50
Comment thread pyomo/gdp/plugins/hull.py
@sergey-gusev94 sergey-gusev94 merged commit 5938667 into exact_hull_combined Mar 17, 2026
10 checks passed
blnicho pushed a commit that referenced this pull request Apr 22, 2026
Black the format of pyomo/pyomo/contrib/mindtpy/algorithm_base_class.py
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