You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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")
The text was updated successfully, but these errors were encountered: