2
$\begingroup$

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.

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

1 Answer 1

3
$\begingroup$

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$.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.