Short answer: almost never.
Beginners in optimization are always very excited when they read about SOS sets in the documentation. This looks like a very efficient tool to use for constructs like pick (at most) 1 out of \(n\) (SOS1) or for interpolation (SOS2). However, experienced modelers use SOS sets very sparingly. Why? Well, solvers like binary variables much better than SOS sets. Binary variables yield great bounding and cuts (there has been enormous progress in this area), while SOS constructs are really just about branching.
Illustration
Consider the assignment problem:
| Assignment problem A |
|---|
| \[\begin{align}\max& \sum_{i,j} \color{darkblue}c_{i,j} \cdot \color{darkred}x_{i,j} \\ & \sum_j \color{darkred}x_{i,j} \le 1 && \forall i \\ & \sum_i \color{darkred}x_{i,j} \le 1 && \forall j \\ & \color{darkred}x_{i,j} \in \{0,1\} \end{align}\] |
This MIP model can actually be solved as an LP (the variables are integer-valued automatically). A SOS1 version of this model can look like:
| Assignment problem B, SOS1 version |
|---|
| \[\begin{align}\max& \sum_{i,j} \color{darkblue}c_{i,j} \cdot \color{darkred}x_{i,j} \\ & \color{darkred}x_{i,1},\color{darkred}x_{i,2},\dots,\color{darkred}x_{i,n}\in \mathbf{SOS1} && \forall i \\ & \color{darkred}x_{1,j},\color{darkred}x_{2,j},\dots,\color{darkred}x_{n,j}\in \mathbf{SOS1} && \forall j \\ & \color{darkred}x_{i,j} \in [0,1] \end{align}\] |
Solver logs
Let's study some solver logs:
| Model A (binary variables) | Model B (SOS1 variables) |
|---|---|
Found incumbent of value 0.000000 after 0.00 sec. (0.00 ticks) | Found incumbent of value 0.000000 after 0.00 sec. (0.00 ticks) |
| |
In this case, SOS1 is not really helpful. There are cases when they are. For instance, consider the complementarity constraint \[\begin{align}&\color{darkred}x \cdot \color{darkred}y = 0\\ & \color{darkred}x\ge 0,\color{darkred}y \ge 0\end{align}\] We can write this as: \[\begin{align}& \color{darkred}x,\color{darkred}y \in \mathbf{SOS1}\\ &\color{darkred}x\ge 0,\color{darkred}y \ge 0\end{align}\] This can be much better than \[\begin{align} & \color{darkred}x \le \color{darkblue}M \cdot \color{darkred}\delta \\ &\color{darkred}y \le \color{darkblue}M \cdot (1-\color{darkred}\delta) \\ &\color{darkred}x\ge 0,\color{darkred}y \ge 0\\ & \color{darkred}\delta\in\{0,1\}\end{align}\] as it prevents the need for big-M constants. This goal can also be achieved with indicator constraints: \[\begin{align} & \color{darkred} \delta=0 \Rightarrow \color{darkred}x=0 \\ & \color{darkred} \delta=1 \Rightarrow \color{darkred}y=0 \\ &\color{darkred}x\ge 0,\color{darkred}y \ge 0\\ & \color{darkred}\delta\in\{0,1\}\end{align}\]
SOS2 sets simplify the modeling of piecewise linear functions. However, often better approaches can be implemented using binary variables. Some of the newer techniques for this, use a logarithmic number of binary variables.