Skip to content

The cplex solver interface returns a mipgap, but Gurobi's does not #1023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DLWoodruff opened this issue May 18, 2019 · 1 comment
Closed

Comments

@DLWoodruff
Copy link
Contributor

The cplex interface reports a mipgap, but gurobi's does not

""" To RUN do something like:
cd pyomo/examples/pysp/sizes/models
cp ~/gapbug.py .
python gapbug.py
"""
import pyomo.environ as pyo
from ReferenceModel import model

def solve_and_report_migap(instance, solvername):
solve_keyword_args = {"tee": True, "load_solutions": False}
solver = pyo.SolverFactory(solvername)
solver.options["mipgap"] = 0.5
results = solver.solve(instance, **solve_keyword_args)
if len(results.solution) > 0:
absgap = results.solution[0].gap
else:
absgap = None
print ("Solver={}; absolute mipgap={}".format(solvername, absgap))

instance = model.create_instance("../SIZES3/Scenario1.dat")
solve_and_report_migap(instance, "cplex")
solve_and_report_migap(instance, "gurobi")

@mrmundt
Copy link
Contributor

mrmundt commented Mar 18, 2025

Hello, @DLWoodruff . We have recently started working on an overhaul of the solver interfaces. The request in this Issue has been implemented in the future solver interfaces but will NOT be implemented in the legacy interfaces. More details on the new solver interfaces and how to access them can be found in our online documentation https://pyomo.readthedocs.io/en/stable/explanation/experimental/solvers.html or in Issue #1030.

NOTE: The new interfaces are actively under development and are NOT the default. We encourage you to try them and provide any feedback you may have on Issue #1030.

@mrmundt mrmundt closed this as completed Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants