# Solving maximize( quad_form(x,P)) ) subject to norm(x,2)<=N

#1

Hi, I’m new with cvx. I want to solve the optimization problem maximize( quad_form(x,P)) ) subject to norm(x,2)<=N. But There is something wrong and I have no idea to solve it.
I wrote this code:

clear;
close all;
clc;
P=diag([0.8969 0.9451 0.9258 0.9591 0.8553 0.9974 0.8669 0.9567 0.9044 1.0000]);
n=10;
N=sqrt(10);
cvx_begin
variable x(n)
norm(x,2)<=N; %#ok
cvx_end

Thanks

(Mark L. Stone) #2

CVX produces this error message:

Error using cvxprob/newobj (line 57)
Disciplined convex programming error:
Cannot maximize a(n) convex expression.

Error in maximize (line 21)
newobj( prob, ‘maximize’, x );

That tells you exactly what CVX objects to. If you minimize instead of maximize, CVX will accept the problem, and the solver it calls will solve it. If you really wish to maximize a convex quadratic objective function, that is a non-convex problem which CVX will not accept, and you will need to use some other tool to solve it.