Skip to main content

Gurobi Coding Use for other solvers

Answered

Comments

4 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • 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

Post is closed for comments.