Skip to content

Add the relative mipgap reached after optimization in SolverResults object #2167

@alejandro-yousef

Description

@alejandro-yousef

Summary

Currently this value is printed on terminal when passing tee=True but it cannot be easily recovered. It would be very convenient to recover it from a SolverResults object

Additional information

Output example from GLPK 4.65 on Windows when tee=True

Cuts on level 44: gmi = 14; mir = 23;

  • 2653: >>>>> 9.061082466e+03 >= 9.052899252e+03 < 0.1% (71; 27)
  • 25515: mip = 9.061082466e+03 >= 9.054536613e+03 < 0.1% (1004; 205)
  • 51034: mip = 9.061082466e+03 >= 9.055073562e+03 < 0.1% (1872; 413)
  • 71887: mip = 9.061082466e+03 >= 9.055701696e+03 < 0.1% (2356; 764)
    TIME LIMIT EXCEEDED; SEARCH TERMINATED
    Time used: 15.1 secs

In this case, the value to be added in SolverResults is equal to 0.1%

Update: the relative mipgap can be computed from SolverResults.problem.upper_bound and SolverResults.problem.lower_bound although it would be better if it is reported directly. However, GLPK returns inf and -inf whenever the termination condition is "feasible" whereas CPLEX or CBC provide the correct values...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions