I have recently started implementing optimization problems using CVX and still learning. I have implemented the following quadratic constraint quadratic optimization problem. However, CVX is producing the error. I have learned from online help available that multiplication of two variables is not allowed in CVX. Could anyone help me with how I can Implement this simple program in CVX?
cvx_begin
variable x(3,1)
minimize((x(1).^2)+(0.1x(2).^2)+(x(3).^2)-(x(1).x(3))-x(2))
subject to
x(1)+x(2)+x(3)-(x(1)^2)-(x(2)^2)-(0.1(x(3).^2))+(0.2x(1).*x(3)) >= 1;
x >= 0;
It is an example from the MOSEK manual and in CVX you have to input it in the same way, that is write each quadratic expression in the standard form x^TQx and then input it as quad_form(x,Q).
Thanks for your response. Michal. Yes, you are right I have taken this example from the manual.
As you suggested, I have tried the following code with CVX but still it’s not working.
close all; clear; clc
n = 3;
H = [2 0 -1; 0 0.2 0; -1 0 2]; % make spsd
f = [0 -1 0]‘;
Q = [-2 0 0.2;0 -2 0;0.2 0 -0.2]; % make spsd
g = [1 1 1]’;
cvx_begin
variable x(n)
minimize(0.5*quad_form(x,H) + f’x)
0.5quad_form(x,Q)+g’*x <=1
x >= 0
cvx_end