Maximizing a convex quadratic function in CVX and Matlab

1.6k Views Asked by At

I understand that a convex function can not be maximized as there is no such value. However, consider the following function:

$$\begin{array}{ll} \text{maximize} & 3x^2 + 5y^2\\ \text{subject to} & x+y=12\\ & x,y\geq0\end{array}$$

But executing it in CVX and Matlab I get the following error:

Disciplined convex programming error:   Cannot maximize a(n) convex expression.

But as I have specified the boundaries, should I not get some maximized value in this range?

2

There are 2 best solutions below

0
On

CVX can't solve your problem because it's not a convex optimization problem (because you are maximizing, rather than minimizing, a convex function).

0
On

Write $y = 12 - x$. From $x,y \geq 0$, we get $0 \leq x \leq 12$. The objective function becomes

$$3 x^2 + 5 (12 - x)^2 = 720 - 2 x^2$$

Hence, the maximum is $720$, which is attained at $(x,y) = (0,12)$.