Skip to main content

Gurobi adds to objective although setObjective wasnt called

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • 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

    So, you are interested in why some variables appear with an objective coefficient of 0 in the LP file?

    The reason is one particular aspect of the LP file format. Namely, if you have variables that do not appear in any of the constraints and that have the standard lower bound of zero and the standard upper bound of infinity, then these variables would not appear at all in the LP file. Hence, reading back in such an LP file would lose those variables. Thus, to make sure that they don't get lost, we add them to the objective function.

    Regards,

    Tobias

     

    0
  • Gregor Keßler
    • Gurobi-versary
    • First Question
    • First Comment

    Thanks for your response :)

    0

Post is closed for comments.