# Either-or Implication Constraints for a Group of Non-negative Continuous or Integer Variables

I would like to ask about the constraints representing the following implications, where all $$x_i$$ are either non-negative continuous or integer variables, belonging to a set of $$\textit{n}$$ $$x_i$$'s where at most one is greater than zero and when it is so all the other remaining $$\textit{n-1}$$ $$x_i$$'s must be equal to 0.

• Oh crap, I have totally forgotten about it which is part of modelling 101. Thank you for pointing it out!
– Mike
Commented Aug 8 at 15:59

These are called SOS1 constraints: $$\text{SOS1}(x_1,\dots,x_n)$$ means that at most one $$x_i$$ can be positive.

Assuming that $$0 \le x_i \le M_i$$ for some constant $$M_i$$, you can linearize such constraints by introducing binary decision variables $$y_i$$ and imposing \begin{align} x_i &\le M_i y_i &&\text{for all i} \tag1\label1 \\ \sum_i y_i &\le 1 \tag2\label2 \end{align}

Constraint \eqref{1} enforces the logical implication $$x_i>0 \implies y_i = 1$$. Constraint \eqref{2} allows at most one $$y_i$$ to be $$1$$.

• Out of curiosity, is it possible to do it with Big M? Thanks.
– Mike
Commented Aug 8 at 16:00
• Sorry, I made a typo, I meant to do without Big M. Thanks
– Mike
Commented Aug 8 at 16:04
• SOS1 uses specialized branching instead of big-M. Commented Aug 8 at 17:46
• Understood, thank you for highlighting it.
– Mike
Commented Aug 8 at 22:35