Skip to main content

How Indicator constraint can be triggered with multiple variables?

Answered

Comments

4 comments

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

    Dear Parijat,

    This is not directly possible through indicator constraints. However, you can add an auxiliary binary variable \(\delta\) to model the relationship if \(a+b+c\geq 1 \Leftrightarrow \delta=1\). To model this, you can use the constraints

    \[\begin{align}
    a+b+c & \geq 1 - 3(1-\delta) \\
    a+b+c & \leq 1+ 3\delta
    \end{align}\]

    You can then use \(\delta\) to model your indicator constraint. Note that the scalar \(3\) was chosen because you add \(3\) binary variables and the maximum sum of these is \(3\). More, information can be found in the stackexchange post How to write if else statement in linear programming?

    Best regards,
    Jaromił

    0
  • Robert Fourer
    • Gurobi-versary
    • Collaborator

    For \(a+b+c=0 \Rightarrow d=1\) with all variables binary, you could write equivalently \(a+b+c+d \geq 1\), or as an indicator constraint, \(d = 0 \Rightarrow a+b+c \geq 1\).

    0
  • Parijat Mitra
    • Gurobi-versary
    • Conversationalist
    • Investigator

    Thanks, Jaromil and Robert for your descriptive explanation

    0

Post is closed for comments.