Skip to main content

Conditional constraints with three conditions

Answered

Comments

2 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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.
  • Maliheh Aramon
    • Gurobi Staff

    Hi, 

    One approach to implement the constraint in the form \(b < B_1 \rightarrow a = B_1\) is to define an auxiliary binary variable \(y_1\) and implement the following instead:

    \[b < B_1 \rightarrow y_1 = 1\]

    \[y_1 = 1 \rightarrow a = B_1\]

    The form \(y_1 = 1 \rightarrow a = B_1\) can be directly implemented using the Model.addGenConstrIndicator() API. However, the form \[b < B_1 \rightarrow y_1 = 1\] should be implemented using its logically equivalent contrapositive form, i.e., 

    \[y_1 \neq1 \rightarrow b \nless B_1 ~~~\mbox{or}~~~  y_1 = 0  \rightarrow b \geq B_1\]. 

    The same approach can be used to implement the other two conditional statements. You might want to check the following relevant posts to your question:

    Best regards,

    Maliheh

    0

Post is closed for comments.