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.
1 Answer
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$.
-
$\begingroup$ Out of curiosity, is it possible to do it with Big M? Thanks. $\endgroup$– MikeCommented Aug 8 at 16:00
-
$\begingroup$ Sorry, I made a typo, I meant to do without Big M. Thanks $\endgroup$– MikeCommented Aug 8 at 16:04
-
1$\begingroup$ SOS1 uses specialized branching instead of big-M. $\endgroup$– RobPrattCommented Aug 8 at 17:46
-
$\begingroup$ Understood, thank you for highlighting it. $\endgroup$– MikeCommented Aug 8 at 22:35