Skip to main content

How Indicator constraint can be triggered with multiple variables?

Answered

Comments

3 comments

  • 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
    Collaborator
    Gurobi-versary

    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

Please sign in to leave a comment.