Is there a way to formulate this in cvx?

I have the following constraint in my optimization problem:

(10/s1+20/s2+10/s3+10/s4+10/s5 - max{10/s1+20/s2+10/s3,10/s4+10/s5} )/100-max{10/s1+20/s2+10/s3,10/s4+10/s5} <= M

where s1, s2, s3, s4 and s5 are my decision variables and M is a constant.

But it gives me error {convex}- {convex} is not allowed in cvx. Is there a way to get around this error and model this constraint in cvx?

Any help will be very much appreciated.

1 Like

I think the non-convexity of-max can be handled by use of binary variables, presuming the arguments of max can be bounded (you will have to bound how close to zero the s_i can be). Look at section 2.3 of https://www.artelys.com/uploads/pdfs/Xpress/mipformref-1.pdf .

1 Like