Gurobi: Save model after presolve for reuse

随声附和 提交于 2019-12-24 06:10:32

问题


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:

  1. When you want to understand the presolve transformations
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!