CVX constraint by disjoint sets

(Isidro Gonzalez) #1

It’s possible to define a constraint based on disjoint sets? For example “X in [0,1] OR X in [4, 5]”

Thank you in advance,

(Mark L. Stone) #2

These disjunctive constraints are non-convex. However, they can be handled in the standard manner by introducing a binary variable, which requires an MIDCP capable version of CVX.

variable X
variable b binary
0 <= X <= b + 5*(1-b)
4*(1-b) <= X <= 5*(1-b) + b

Or if you just have a single scalar variable X, you can solve one CVX problem with the constraint [0,1] and a separate CVX problem with constraint [4.5]. Then choose the better of these 2 solutions as the solution to your original problem. This does not require MIDCP capability.