pyomo icon indicating copy to clipboard operation
pyomo copied to clipboard

Fix for Xpress when stopped due to MAXTIME or MAXNODES

Open bknueven opened this issue 2 years ago • 1 comments

Fixes # N/A

Summary/Motivation:

If Xpress stops due to some limit, e.g., a time limit set by the user, it leaves the model in a presolved state. Explicitly calling postsolve enables the user to set a time limit or node limit while using Pyomo and get a result back.

Changes proposed in this PR:

  • Add postsolve to whenever Xpress calls solve

Questions:

  • It would be nice to test this -- are there any existing problems in Pyomo's test suite that might fail on main when a time or node limit is set?

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.

bknueven avatar Sep 29 '22 15:09 bknueven

Codecov Report

Base: 86.59% // Head: 86.56% // Decreases project coverage by -0.02% :warning:

Coverage data is based on head (4b2ea44) compared to base (3c50ee2). Patch coverage: 80.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2553      +/-   ##
==========================================
- Coverage   86.59%   86.56%   -0.03%     
==========================================
  Files         721      720       -1     
  Lines       80434    80316     -118     
==========================================
- Hits        69652    69527     -125     
- Misses      10782    10789       +7     
Flag Coverage Δ
linux 83.39% <80.00%> (+<0.01%) :arrow_up:
osx 73.59% <80.00%> (+<0.01%) :arrow_up:
other 83.57% <80.00%> (+<0.01%) :arrow_up:
win 80.60% <80.00%> (+<0.01%) :arrow_up:

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

Impacted Files Coverage Δ
pyomo/solvers/plugins/solvers/xpress_direct.py 73.17% <80.00%> (+0.14%) :arrow_up:
examples/pyomobook/test_book_examples.py 94.90% <0.00%> (-1.97%) :arrow_down:
pyomo/solvers/plugins/solvers/GUROBI.py 88.19% <0.00%> (-0.33%) :arrow_down:
pyomo/contrib/appsi/solvers/gurobi.py 84.36% <0.00%> (-0.12%) :arrow_down:
examples/pyomobook/performance-ch/wl.py

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Sep 30 '22 01:09 codecov[bot]

@bknueven, I'm sure there are others, but I'm aware of some time limit tests in Appsi (https://github.com/Pyomo/pyomo/blob/064c1203e28f3fc9a6213af9d579fdbc14e03585/pyomo/contrib/appsi/solvers/tests/test_persistent_solvers.py#L821). I think I basically made a random assignment problem large enough to test the time limit.

michaelbynum avatar Oct 03 '22 15:10 michaelbynum