Skip to main content

How to write if condition in python gurobi 9.5?

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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Jaromił Najman
    • Gurobi Staff

    \(\texttt{if}\)-statements cannot be directly implemented into Gurobi when using optimization variables. Thus, one has to model an \(\texttt{if}\)-condition with the help of binary variables and additional constraints. I think that the KB article How do I model conditional statements in Gurobi? is what you are looking for.

    Best regards, 
    Jaromił

    0

Post is closed for comments.