# How to make this objective function compatible with CVX?

I have two objective functions as follows.

{\min}\underset{f_{c,u}}{\max}\hspace{1mm}({\bf d-s},0)

and

{\min}\underset{f_{c,u}}{\max}\hspace{1mm}({\bf d-s})

Here, f_{c,u} are optimization variables where, c=1,2,\cdots,C and u=1,2,\cdots,U

\bf d is a known vector of size 1\times U

Is there a way to make them compatible with CVX?

What is s?

help cvx/max

Disciplined convex/geometric programming information:
max is convex, log-log-convex, and nondecreasing in its first
two arguments. Thus when used in disciplined convex programs,
both arguments must be convex (or affine). In disciplined
geometric programs, both arguments must be log-convex/affine.


So if s is a concave (or affine) function of a and f, then max(d =s9a,f0,0) complies with the DCP rules, but it is a vector, not a scalar, so can not be used as in as an objective function.So what do you mean by this notation?

I have no idea what your 2nd objective function is supposed to mean. You can’t maximize and then minimize over the same thing.

Did you have a reason for selecting the category MIDCP?

@Mark_L_Stone, \bf s is vector, which is a function of the optimization variable.

   s= sum(F.*R)


\bf R is a known matrix of size C\times U
\bf F is the matrix of same size that contains the optimization variables f_{c,u}

Where does a enter into s(a,f) ?

Please write out your code explicitly, even if it doesn’t obey CVX’s rules. I still don’t know what the mathematical problem you wish to solve is.

@Mark_L_Stone, I have edited my question. Now, I have removed the variables a. I want to generate the matrix \bf F such that the objective is met. The supply vector \bf s should be as close as possible to demand vector \bf d.

Is this what you want?

minimize(max(max(d-s,0)))

minimize(max(d-s))

@Mark_L_Stone, Exactly this is what I want!