Skip to main content

Be sparse in constructing Vars and Constrs or let Gurobi deal with it

Answered

Comments

1 comment

  • Marika Karbstein
    Gurobi Staff Gurobi Staff

    Hi Zlatan,

    This is not so easy to answer.
    It is indeed the case that Gurobi will remove unneeded variables and constraints in presolve.
    I do not know with which number of removable variables/constraints this would be remarkable in performance. However, adding many more variables and/or constraints than actually needed can also lead to a longer model-building time. So, you could save time twice by not adding redundant variables and/or constraints.

    I think the following questions could help to decide on the approach:

    • How important is a little performance improvement?
    • How often is the model adapted?
      (Who will make the adaptions?)
    • What is the ratio of the number of redundant variables/constraints to the total number of variables and constraints?

    I assume you chose the community on purpose for this question. I just want to remind you that since you are a commercial user of Gurobi, you can also open a support request.

    Best regards,
    Marika

    0

Please sign in to leave a comment.