pyomo icon indicating copy to clipboard operation
pyomo copied to clipboard

Parse `noSolution` status from CPLEXShell and CPLEXDirect solvers correctly

Open ruaridhw opened this issue 5 years ago • 5 comments

Fixes

Summary/Motivation:

Currently when CPLEX returns "No Solution", this isn't captured in any of the Pyomo solution or solver data objects. We can identify "No Solution" because when both of (1) max time limit is reached and (2) the model is infeasible occur.

Changes proposed in this PR:

CPLEXDirect

  • Clean up the status codes in _postsolve() to use the actual CPLEX library constants
  • Add new logic to handle MIP_time_limit_infeasible and MIP_dettime_limit_infeasible as indicating a solver termination_condition of noSolution
  • Get the solver return code if possible from any CplexSolverErrors (but don't add this to the returned Bunch due to downstream code raising ApplicationErrors)
  • Set results.solver.return_code and results.solver.termination_message using the available information

CPLEXSHELL

  • Fix process_logfile() for CPLEX 12.10 as it looks like IBM have updated the log file schema and is no longer being parsed correctly
  • Add new logic to handle 'no integer solution.' in the log file as indicating a solver termination_condition of noSolution
  • Get the solver return code if possible from any CPLEX Error lines in the log file

Legal Acknowledgement

By contributing to this software project, I 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.

ruaridhw avatar Feb 24 '20 13:02 ruaridhw

Codecov Report

Merging #1313 into master will increase coverage by 1.17%. The diff coverage is 84.84%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1313      +/-   ##
==========================================
+ Coverage   71.57%   72.75%   +1.17%     
==========================================
  Files         547      491      -56     
  Lines       83583    79087    -4496     
==========================================
- Hits        59821    57536    -2285     
+ Misses      23762    21551    -2211     
Impacted Files Coverage Δ
pyomo/solvers/plugins/solvers/CPLEX.py 46.78% <80.00%> (-41.93%) :arrow_down:
pyomo/solvers/plugins/solvers/cplex_direct.py 74.72% <88.88%> (+1.62%) :arrow_up:
pyomo/pysp/lagrangeMorePR.py 5.54% <0.00%> (-68.98%) :arrow_down:
pyomo/solvers/plugins/solvers/gurobi_direct.py 12.67% <0.00%> (-58.28%) :arrow_down:
pyomo/solvers/plugins/solvers/GUROBI.py 31.61% <0.00%> (-57.42%) :arrow_down:
pyomo/pysp/drive_lagrangian_cc.py 9.38% <0.00%> (-48.36%) :arrow_down:
pyomo/solvers/plugins/solvers/gurobi_persistent.py 20.20% <0.00%> (-48.19%) :arrow_down:
pyomo/opt/parallel/async_solver.py 56.00% <0.00%> (-44.00%) :arrow_down:
pyomo/solvers/plugins/solvers/SCIPAMPL.py 24.39% <0.00%> (-39.64%) :arrow_down:
... and 99 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c3f888c...33b0b2d. Read the comment docs.

codecov[bot] avatar Feb 25 '20 15:02 codecov[bot]

@ruaridhw It looks like the changes in #1300 are also included in this PR. However, the changes to the direct interface do not depend on the changes in #1300. If you do not want this PR to be held up by #1300, then I would recommend creating a PR with just the changes to the direct interface.

michaelbynum avatar Mar 04 '20 15:03 michaelbynum

@michaelbynum, sorry about that. Branch is fixed now.

ruaridhw avatar Mar 04 '20 18:03 ruaridhw

@michaelbynum, this should be ready to review whenever you get a chance

ruaridhw avatar May 07 '20 07:05 ruaridhw

@ruaridhw Thanks. I will review these PRs early next week.

michaelbynum avatar May 07 '20 12:05 michaelbynum

This PR is going to be superseded by work to complete #1030 - which builds in base support for "no solution" to all solver interfaces. As such, I am going to close this PR.

mrmundt avatar Jan 09 '24 20:01 mrmundt