Skip to main content

set the value of unused variables

Answered

Comments

2 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?.
  • Silke Horn
    • Gurobi Staff

    Hi,

    In Gurobi, variables don't have a default value. If there are multiple optimal solutions (for example by choosing different values for variables that do not participate in any constraint or the objective), Gurobi will return the first one it finds -- which one this is may depend on the solver path.

    If you want "unused variables" to be zero, you could simply add a constraint that fixes them to zero or you could add them to your objective function with the appropriate sign (depending on whether you're maximizing or minimizing).

    Silke

    0

Post is closed for comments.