How to write the constraint involving indicator functions in CVX?

How to write the following constraints involving indicator functions in CVX?

0 \leq \sum_{i=1}^{m} \omega_{i} \cdot \mathbb{1}_{\{x > D_{i}\}} \leq 1, \forall x \in R,


0 \leq \sum_{i=1}^{m} \omega_{i} \cdot \mathbb{1}_{\{ D_{i} < x \leq M_{i}\}} \leq 1, \forall x \in R

where, D and M are given, while \omega is the decision variable.

Thank you for your time.

The concept of indicator constraints is not available in Cvx. You must convert the problem to an ordinary MIP. This often involves using a so-called Big-M formulation

1 Like

It is not clear to me what the constraints are, in particular, what x is.

If x is a CVX (decision) variable or expression, you will have to use Big M, as @Erling suggested. if x is input data (a regular MATLAB variable), then Big M is not necessary, but then the way the constraint is written doesn’t seem to make sense.

Sp please clarify.

Thank you very much for your reply.

Thank you so much for your reply. It was a mistake.