Gurobi Coding Use for other solvers
AnsweredHello,
I wonder if we can run models constructed by Gurobi's coding convention (in Python) using other open source solvers, e.g., GLPK? More clearly, assume I have a MIP model programmed and ready to be solved with the command 'm.optimize()' but I also would like to see the performance of GLPK and do not want to use Pyomo programming ways to redesign the coding. Is there a way to easily push the model 'm' to GLPK?
Thanks,
Taner

You can use m.write("mymodel.mps") to save the model to disk in MPS file format. Then, you can load it into basically any solver you want, as the MPS file format is industry standard. Note that this is not true in general for the LP file format. For example, I think that either GLPK or LPSolve use some different conventions for LP file formats, which sometimes results in a different interpretation of what the LP file models.
Regards,
Tobias
0 
Hi Tobias,
I really appreciate for the response. I have a follow up question though. I was looking at the 'indicator constraints' of Gurobi. Does Gurobi convert indicator constraints (if ..., then...) to linear big M involving constraints? If yes, do they really improve computational quality? If no, how will other solvers (e.g., GLPK) which do not have such feature solve the problem from the .mps file generated by Gurobi coding way?
Can you please write a sprinkle of code (for Python) that implements the idea, i.e., loads 'mymodel.mps' and pushes to GLPK? It seems to me an example code is not difficult for you to generate but life consuming for me.
Best,
Taner
0 
I don't know the GLPK API, so I cannot tell you how you would load a 'mymodel.mps' into GLPK. But there should be some read function that can do this.
Gurobi converts indicator constraints during presolve either into bigM linear constraints or into SOS1 constraints, potentially by introducing some additional auxiliary variables. Which of the two approaches is used depends on the bounds of the variables and the resulting size of the bigM. You can control this via the "PreSOS1BigM" parameter, see https://www.gurobi.com/documentation/8.1/refman/presos1bigm.html
Best regards,
Tobias
0
Please sign in to leave a comment.
Comments
3 comments