How to express this objective function with max in CVX?

Let D\in\mathbb{R}^{1\times P} is a known vector.
S is also a vector os same size.

The objective is:

minimize \sum\max(D-S,0)

That is I want to perform: minimize \sum_{i=1}^P\max(D_i-S_i,0)

How can I write this in CVX?

I think
should work.

1 Like


Yes, it works! Thank you.