Skip to content

Fix no results returned when no discrete variables are present in MindtPy#3861

Open
bernalde wants to merge 22 commits intoPyomo:mainfrom
tarikLG:main
Open

Fix no results returned when no discrete variables are present in MindtPy#3861
bernalde wants to merge 22 commits intoPyomo:mainfrom
tarikLG:main

Conversation

@bernalde
Copy link
Contributor

@bernalde bernalde commented Feb 24, 2026

Fixes #3855 .

Fixes #3855

Summary/Motivation:

This PR fixes an issue where MindtPy can short-circuit on “no discrete decisions” (LP/NLP) and then fails to reliably return a proper SolverResults and/or load primal values onto the input model, even when the direct LP/NLP solve succeeds. This behavior breaks downstream meta-solvers (e.g., GDPopt subproblem solves) that depend on Var.value to capture an incumbent.

Reference: #3855

MindtPy contains a validation/short-circuit path intended to directly solve models that do not require decomposition (e.g., LP/NLP, or models where all discrete variables are fixed). In this path, MindtPy may:

return None from solve() (bare return)

Changes proposed in this PR:

  • Ensure MindtPy always returns a SolverResults object (never None) even when the model is handled by the LP/NLP short-circuit.
  • Initialize and populate self.results before early exits, and propagate termination/status/message from the direct LP/NLP solve into MindtPy’s results.
  • Add a standalone test/test_mindtpy_no_discrete.py script

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.

Toflamus and others added 21 commits February 19, 2026 15:34
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>
Co-authored-by: Tarik Levent Guler <64302098+tarikLG@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>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Fix no results returned when no discrete variables are present in Min…
@bernalde bernalde marked this pull request as draft February 24, 2026 19:35
Black the format of pyomo/pyomo/contrib/mindtpy/algorithm_base_class.py
@bernalde bernalde marked this pull request as ready for review February 24, 2026 22:44
@Toflamus
Copy link
Contributor

Hi team,

I’ve investigated the current CI failures across Linux, macOS, and Windows. The failures in pyomo/contrib/solver/tests/solvers are not caused by the code changes in this PR.

The root cause is an expired GAMS license in the test environment. It appears the license might have expired a few days ago, which is why we are seeing identical failures across all platforms.

Interestingly, the tests for MindtPy are still passing (likely because they use different solver paths or have different fallback mechanisms), but the core solver tests are blocked.

Once the GAMS license is renewed in the CI environment, these tests should return to green.

@blnicho
Copy link
Member

blnicho commented Feb 25, 2026

@Toflamus we are aware of the issue and discussed it during the developer call today. This is indeed an infrastructure issue and we're working on getting it fixed.

@bernalde bernalde marked this pull request as draft March 3, 2026 18:51
@bernalde bernalde marked this pull request as ready for review March 3, 2026 18:51
@blnicho blnicho requested a review from emma58 March 3, 2026 19:48
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 fails to return solutions for NLP or LP problem because of the short-circuit mechanism.

3 participants