Christoph Neumann
Christoph Neumann

Reputation: 115

Use Gurobi's presolve function for a pyomo model

Using gurobipy, I can presolve a mixed integer linear optimization model by calling the presolve function, i.e.

model = read('milp.mps')
model.presolve().

I would like to apply Gurobi's presolving step to some model, which is only restricted by the linear constraints of a mixed integer nonlinear pyomo model (and to subsequently modify the presolved linear model, either using gurobipy or pyomo, before solving it using Gurobi).

Schematically, what I want to do is:

linear_model = deactivate_nonlinear_constrs(pyomo_model) #This step is clear
presolved_model = presolve_with_gurobi(linear_model),

where presolved_model can be either a gurobipy, or a pyomo model.

The easiest way would be some function that converts a pyomo model into a gurobipy model, i.e. gurobi_model = convert_to_gurobi(pyomo_model).

I know that pyomo and Gurobi are tightly coupled, i.e. I can solve a pyomo model with Gurobi by using

opt = SolverFactory('gurobi')
opt.solve(model),

so I suppose there is some direct link between the gurobipy model and the pyomo model as well.

Upvotes: 2

Views: 578

Answers (1)

Cord Kaldemeyer
Cord Kaldemeyer

Reputation: 6917

I had the same question and transferred your question into the pyomo forum.

Answer: Up to now, this feature is not included within pyomo.

Upvotes: 1

Related Questions