问题
I'm looking for a way to save a presolved model in gurobi, so that I can save the time necessary for presolving the next time I'm running the model.
I have tried to write the model to a .mps/.lp file using a callback function after presolve, but when I load the file it starts to presolve again.
I'd also be thankful for negative answers, if what I'm looking for isn't possible.
PS.: I'm using Gurobi 7.5.2 with python 3.6
回答1:
It is very uncommon to save the presolved model. The key exceptions are:
- When you want to understand the presolve transformations
- For benchmarking when you don't want to repeat presolve
Gurobi lets you access the presolved model, but only from the Python API. Here is some sample code:
from gurobipy import *
m = read("mymodel.mps")
mp = m.presolve()
mp.write("mypresolved.lp")
来源:https://stackoverflow.com/questions/49496002/gurobi-save-model-after-presolve-for-reuse