Skip to content
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

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

Open
DLWoodruff opened this issue May 18, 2019 · 0 comments
Open

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

DLWoodruff opened this issue May 18, 2019 · 0 comments

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")

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

2 participants