I have a Mixed-Integer Program that contains (among other things) $n$ variables $v_1, \dots v_n$ (continuous or integer doesn't matter, in $[0, M)$ for some $M$).
I want to formulate the constraint that at most $k < n$ of these variables may become nonzero. The obvious solution would be to introduce a set of binary indicator variables $w_1, \dots w_n$, a big-M constraint per pair and a sum constraint on the indicators:
$$ w_i \cdot M \geq v_i$$ $$ \sum w_i \leq k$$
However, that's a lot of big-M's and probably wreaks havoc on the relaxed solution. I'm wondering if there are standard techniques for coping with a setting like this.
What I've thought of: Introduce a SOS-Type 1 - Constraint per $v_i$ / $w_i$ pair. This would get rid of the big-M and force $w_i$ to become zero if $v_i$ is nonzero. (Obviously, the second constraint above must be changed to $\sum (1 - w_i) \leq k$). Is that the way to go? It feels like I'm using SOS-constraints for something that they weren't meant to (it's not an ordered set…)
Any help is appreciated! Thanks, Lukas