Skip to main content

Question for NP

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?.
  • Jaromił Najman
    • Gurobi Staff

    Hi,

    Variable objects don't have a value. This means that it is not possible to perform comparisons such as

    if X[0] <= 0:

    where \(\texttt{X}\) is an optimization variable. You have to model \(\texttt{if-else}\)-statements via introduction of auxiliary binary variables and constraints. A good example of how to model such relationships is discussed in the stackexchange post How to write if else statements in linear programming.

    Best regards,
    Jaromił

    0

Post is closed for comments.