Skip to content

Internal/mindtpy short circuit base#3907

Open
bernalde wants to merge 8 commits intoPyomo:mainfrom
bernalde:internal/mindtpy-short-circuit-base
Open

Internal/mindtpy short circuit base#3907
bernalde wants to merge 8 commits intoPyomo:mainfrom
bernalde:internal/mindtpy-short-circuit-base

Conversation

@bernalde
Copy link
Copy Markdown
Contributor

@bernalde bernalde commented Apr 7, 2026

Fixes #3906 .

Summary/Motivation:

Based on a comment from @jsiirola in #3861 I went ahead and revisited how we are dealing with a problem that has no discrete variables. Now we check whether the MIP solver (eventually we need to change that nomenclature, but I will leave that to a future PR) can address the problem directly. This would be the case with quadratic programs (QPs) or quadratically constrained programs (QCPs). Although Gurobi can deal with NLPs now, usually it would try to solve them to global optimality, defeating the whole purpose of MindtPy, so we are still passing that down to the NLP (again, I need to change the naming here) solver.

This PR depends on #3861, so it is worth looking into it only after merging that

Changes proposed in this PR:

  • Modification in the 'shortcircuit' part of MindtPy and added tests

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.

bernalde and others added 6 commits April 6, 2026 18:35
- Fix stale Returns docstring in model_is_valid: LP, QP, QCP, or NLP
- Defer working_obj fetch into the obj_degree is None fallback branch
- Add Parameters section to _classify_short_circuit_problem docstring
- Add comment in _mip_solver_supports_capability explaining that unknown
  APPSI solvers fall through conservatively to return False
- Add test_short_circuit_mixed_degree_model_routes_to_nlp to cover the
  case where both has_quadratic_constraints and has_nonquadratic_constraints
  are True (model with quadratic and cubic constraints must route to NLP)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lowup

[codex] Refine MindtPy no-discrete short-circuit routing
@jsiirola
Copy link
Copy Markdown
Member

@bernalde, @Toflamus: Note that this PR is currently blocked by merge conflicts introduced by #3861.

@bernalde
Copy link
Copy Markdown
Contributor Author

@jsiirola Addressed in bernalde@888bf23.

I merged current main into internal/mindtpy-short-circuit-base, which clears the branch-blocking state noted in your comment. GitHub is now reporting this PR as mergeable again.

I also reran python -m pytest pyomo/contrib/mindtpy/tests/test_mindtpy_no_discrete.py on the updated branch.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 94.54545% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.93%. Comparing base (e55e4a2) to head (72f7c43).

Files with missing lines Patch % Lines
pyomo/contrib/mindtpy/algorithm_base_class.py 94.54% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3907      +/-   ##
==========================================
+ Coverage   89.89%   89.93%   +0.03%     
==========================================
  Files         902      902              
  Lines      106415   106463      +48     
==========================================
+ Hits        95663    95747      +84     
+ Misses      10752    10716      -36     
Flag Coverage Δ
builders 29.17% <3.63%> (?)
default 86.24% <94.54%> (?)
expensive 35.62% <3.63%> (?)
linux 87.39% <94.54%> (-2.04%) ⬇️
linux_other 87.39% <94.54%> (+<0.01%) ⬆️
oldsolvers 28.09% <3.63%> (-0.01%) ⬇️
osx 82.72% <94.54%> (+<0.01%) ⬆️
win 85.81% <94.54%> (-0.01%) ⬇️
win_other 85.81% <94.54%> (-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.

@bernalde
Copy link
Copy Markdown
Contributor Author

As far as I could see, none of the failed tests had to do with code introduced in this PR. We can restart the tests later to make sure everything is working

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.

MindtPy short-circuit follow-up: avoid duplicate structure checks and refine continuous QP/QCP routing

3 participants