Fix GDPopt LBB time-limit results - #4010
Open
bernalde wants to merge 2 commits into
Open
Conversation
This was referenced Aug 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3941.
Summary/Motivation:
The GDPopt LBB time-limit path calls
self._get_final_results_object(), which no longer exists. The method was renamed to_get_final_pyomo_results_object()during an earlier GDPopt rewrite, and this one call site was left stale. Any LBB solve that terminates by hitting its time limit raisesAttributeErrorinstead of returning a results object.The same file already uses the current name at the other termination site (
branch_and_bound.py:288), so this is an isolated leftover rather than an intentional difference.This is a replacement for #3942, which GitHub would not allow me to reopen after it was closed. That PR was approved by @emma58 and was closed for a PR-template/CI-state reason rather than a code concern; the prior review discussion and history remain available there.
Changes proposed in this PR:
_get_final_pyomo_results_object()on the GDPopt LBB time-limit termination path inpyomo/contrib/gdpopt/branch_and_bound.py, matching the other termination site in the same file.TestGDPopt_LBB_TimeLimit.test_time_limit_returns_pyomo_results_object, a solver-independent regression that forces the time-limit branch and asserts a Pyomo results object is returned withmaxTimeLimitand unbounded problem bounds.TestMindtPyGOATimeLimit.test_goa_time_limit_sets_solver_results_condition, documenting that the corresponding MindtPy GOA time-limit path already sets its termination condition correctly.main:python -m pytest -q pyomo/contrib/gdpopt/tests/test_LBB.py pyomo/contrib/mindtpy/tests/test_mindtpy_no_discrete.py32 passed, 9 skipped, 2 deselected in 2.55spython -m pytest -q pyomo/contrib/gdpopt/tests/76 passed, 35 skipped, 5 deselected in 81.25spython -m black --check --diff pyomo/contrib/gdpopt/branch_and_bound.py pyomo/contrib/gdpopt/tests/test_LBB.py pyomo/contrib/mindtpy/tests/test_mindtpy_no_discrete.py3 files would be left unchangedtypos --config ./.github/workflows/typos.tomlon the three changed filesAI-Use Disclosure
or
AI tools contributed to the development of this PR
Review process (select ONE):
Notes for reviewers (optional): This replacement PR carries over the implementation and tests from #3942 unchanged, then refreshes the branch against current
main. The replacement PR description and branch-refresh workflow were prepared with AI assistance and reviewed before posting. The runtime change is a single call-site rename; reviewers may want to focus on whether the forced-time-limit regression test intest_LBB.pyis the right way to exercise that path without requiring a MINLP subsolver, since it temporarily patchesGDP_LBB_Solver.reached_time_limitand restores it in afinallyblock.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: