2
$\begingroup$

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?

$\endgroup$
7
  • 2
    $\begingroup$ CVX only solves convex optimization problems, and maximizing a convex function is not a convex optimization problem. In a convex optimization problem you minimize a convex function over a convex set. $\endgroup$
    – littleO
    Jul 19, 2016 at 12:41
  • 1
    $\begingroup$ ask.cvxr.com/t/why-isnt-cvx-accepting-my-model-read-this-first/… $\endgroup$ Jul 19, 2016 at 14:44
  • 1
    $\begingroup$ @Rodrigo: Do we really need a [cvx] tag? Is it really so hard to search for "cvx" in the search line and find more or less everything related to this topic on the site? $\endgroup$
    – Asaf Karagila
    Jul 19, 2016 at 22:04
  • $\begingroup$ @AsafKaragila Searching for "cvx" returns posts that link to Boyd's book ( web.stanford.edu/~boyd/cvxbook/bv_cvxbook.pdf ), too, which is annoying. $\endgroup$ Jul 19, 2016 at 22:08
  • 1
    $\begingroup$ I for one don't think there should be a CVX tag, in part because I don't think this forum should really attempt to accumulate CVX software usage questions. Obviously if a particular mathematical problem someone is working on is readily solved with CVX, it makes sense to say so. But if you look at the CVX forum it's riddled with questions that I don't think would be appropriate on Math.SE, many of which are answered by the FAQ itself (posted above). $\endgroup$ Jul 19, 2016 at 23:58

2 Answers 2

3
$\begingroup$

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

$\endgroup$
1
$\begingroup$

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)$.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .