Skip to main content

Gurobi Coding Use for other solvers

Answered

Comments

3 comments

  • Tobias Achterberg
    Gurobi Staff Gurobi Staff

    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
  • Taner Cokyasar
    Gurobi-versary
    First Comment
    Curious

    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
  • Tobias Achterberg
    Gurobi Staff Gurobi Staff

    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 big-M 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 big-M. 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.