Skip to content

Exact hull reformulation for quadratic constraints#3874

Open
sergey-gusev94 wants to merge 50 commits intoPyomo:mainfrom
sergey-gusev94:exact_hull_combined
Open

Exact hull reformulation for quadratic constraints#3874
sergey-gusev94 wants to merge 50 commits intoPyomo:mainfrom
sergey-gusev94:exact_hull_combined

Conversation

@sergey-gusev94
Copy link
Contributor

Fixes # .

Summary/Motivation:

This PR adds support for the exact hull reformulation for quadratic constraints in Generalized Disjunctive Programming (GDP).

The current gdp.hull transformation applies perspective-function based relaxations for nonlinear constraints. While effective for many nonlinear expressions, this approach can produce weaker relaxations for quadratically constrained disjunctions.

This PR implements the exact hull reformulation for quadratic constraints described in:

Gusev, S., & Bernal Neira, D. E. (2025).
Exact Hull Reformulation for Quadratically Constrained Generalized Disjunctive Programs.
https://arxiv.org/abs/2508.16093

The implementation extends the existing hull transformation with an optional configuration flag (which is False by default) that detects quadratic constraints and applies the exact hull formulation when appropriate.

For convex quadratic constraints, the reformulation is expressed as a rotated second-order cone (SOC) representable constraint. For nonconvex quadratics and equality constraints, the general exact hull formulation is used.

Convexity is determined automatically through eigenvalue analysis of the Hessian matrix.

This provides a tighter relaxation for quadratic GDP models and maintains the quadratic structure of constraints in hull reformulation.

Changes proposed in this PR:

  • Extend the gdp.hull transformation with a new configuration option:

    • exact_hull_quadratic (default: False)
  • When enabled, quadratic constraints inside disjuncts are reformulated using the exact hull formulation instead of the standard perspective function.

  • Implement automatic convexity detection via eigenvalue decomposition of the quadratic Hessian matrix.

  • Apply different reformulations depending on structure:

    • Convex quadratic inequalities
      Reformulated using a rotated second-order cone representation.

    • Nonconvex quadratics or equalities
      Reformulated using the general exact hull formulation.

  • Add a configuration parameter:

    • eigenvalue_tolerance
      Controls numerical tolerance when checking positive or negative semidefiniteness of the Hessian.
  • Extend the implementation in pyomo.gdp.plugins.hull to support these reformulations.

  • Add unit tests verifying:

    • correctness of the generated constraints
    • compatibility with existing hull behavior
    • correctness of variable disaggregation and mappings.

The default behavior of gdp.hull is unchanged unless the new option is enabled.

Example usage:

TransformationFactory("gdp.hull").apply_to(
    model,
    exact_hull_quadratic=True
)

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 and others added 30 commits March 6, 2026 15:19
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
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>
doc: add `exact_hull_quadratic` to Hull class docstring
…unctions

Co-authored-by: sergey-gusev94 <101810399+sergey-gusev94@users.noreply.github.com>
…envalue_tolerance in permissive test

Co-authored-by: sergey-gusev94 <101810399+sergey-gusev94@users.noreply.github.com>
Add TestExactHullQuadratic tests and extract models into models.py
Co-authored-by: sergey-gusev94 <101810399+sergey-gusev94@users.noreply.github.com>
Co-authored-by: sergey-gusev94 <101810399+sergey-gusev94@users.noreply.github.com>
Co-authored-by: sergey-gusev94 <101810399+sergey-gusev94@users.noreply.github.com>
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: sergey-gusev94 <101810399+sergey-gusev94@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Clean up stale "treated as linear" language and inline imports in test_hull.py
@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 86.79245% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.67%. Comparing base (7ad143c) to head (5938667).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
pyomo/gdp/plugins/hull.py 86.79% 21 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3874    +/-   ##
========================================
  Coverage   89.67%   89.67%            
========================================
  Files         908      908            
  Lines      106735   106907   +172     
========================================
+ Hits        95717    95872   +155     
- Misses      11018    11035    +17     
Flag Coverage Δ
builders 29.05% <4.40%> (-0.04%) ⬇️
default 85.96% <86.79%> (?)
expensive 35.47% <4.40%> (?)
linux 87.14% <86.79%> (-2.03%) ⬇️
linux_other 87.14% <86.79%> (+<0.01%) ⬆️
oldsolvers 27.97% <4.40%> (-0.04%) ⬇️
osx 82.48% <86.79%> (+0.44%) ⬆️
win 85.56% <86.79%> (+<0.01%) ⬆️
win_other 85.56% <86.79%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@blnicho blnicho requested review from emma58 and jsiirola March 17, 2026 18:56
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