Skip to content

Fix bug in initialization routines to return solve with bounded nlp - #3991

Merged
blnicho merged 15 commits into
Pyomo:mainfrom
stephenscini:initialization-devel
Aug 13, 2026
Merged

Fix bug in initialization routines to return solve with bounded nlp#3991
blnicho merged 15 commits into
Pyomo:mainfrom
stephenscini:initialization-devel

Conversation

@stephenscini

@stephenscini stephenscini commented Jul 8, 2026

Copy link
Copy Markdown
Member

Fixes # .

Fixes issue in initialization routines where the model is run through nlp solver before bounds are removed.

Summary/Motivation:

Currently: Original variables are bounded in methods and then there is cleanup but the initial point from lp, pwl, and global approximations is not verified to work with nlp_solver

Changes proposed in this PR:

  • After each method "Finally: _cleanup()", run the original model again through the nlp solver and return that result.
  • Additional warning added for using the global solver without specifying a time limit.

AI-Use Disclosure

  • AI tools were NOT used during the preparation of this PR

or

  • AI tools contributed to the development of this PR

    • AI tools generated documentation (including the PR description/comments, code comments, and/or Sphinx documentation)
    • AI tools generated tests (baselines, examples, and/or code)
    • AI tools generated code (apart from tests)

    Review process (select ONE):

    • Rewritten: All AI-generated content was rewritten by me before being committed.
    • Reviewed/verified: I retained AI-generated content and verified it before committing. Verification included (as applicable):
      • Ran the code and fixed issues
      • Added and ran tests
      • Checked correctness/logic of code and tests
      • Checked for alignment with the contribution guide
      • Considered security implications
    • As-is: AI-generated content was commited directly to the repository

Notes for reviewers (optional):

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.

@stephenscini

Copy link
Copy Markdown
Member Author

@michaelbynum Please review when available.

Comment thread pyomo/devel/initialization/initialize.py Outdated

@michaelbynum michaelbynum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is almost perfect. One comment below. Also, the code for the final nlp solve is almost identical in all three methods. Could you move this to a helper function?

Comment thread pyomo/devel/initialization/initialize.py Outdated
Comment thread pyomo/devel/initialization/initialize.py Outdated
Comment thread pyomo/devel/initialization/initialize.py Outdated
@stephenscini

Copy link
Copy Markdown
Member Author

@michaelbynum Addressed comments. Please take another look when available. Thanks!

@stephenscini
stephenscini requested a review from michaelbynum July 9, 2026 19:32

@michaelbynum michaelbynum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.95652% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.94%. Comparing base (f8ed23c) to head (f7c9e73).

Files with missing lines Patch % Lines
pyomo/devel/initialization/initialize.py 81.25% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3991      +/-   ##
==========================================
- Coverage   89.94%   89.94%   -0.01%     
==========================================
  Files         917      917              
  Lines      109096   109104       +8     
==========================================
+ Hits        98128    98132       +4     
- Misses      10968    10972       +4     
Flag Coverage Δ
builders 29.08% <4.34%> (-0.01%) ⬇️
default 86.14% <69.56%> (?)
expensive 35.08% <4.34%> (?)
linux 87.67% <86.95%> (-1.98%) ⬇️
linux_other 87.67% <86.95%> (-0.01%) ⬇️
oldsolvers 27.56% <4.34%> (+<0.01%) ⬆️
osx 83.12% <86.95%> (+<0.01%) ⬆️
win 85.42% <86.95%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 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 merged commit 1dd35b4 into Pyomo:main Aug 13, 2026
59 of 65 checks passed
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