Disciplined convex programming:

(Ondrej Kosut) #1

Hallo
i have problem running my cvx code
m=6;
V=8;
n=4;
f=[100;0;0;50];
cvx_begin
variables t(m) x(n)
minimize( f’x )
subject to
(K1
t(1)+K2t(2)+K3t(3)+K4t(4)+K5t(5)+K6t(6)) * x == f
L
t <= V
t>=0
cvx_end

where K1,K2,K3,K4,K5,K6 are (4x4) positive matrices and L is vector (length 6)
i get this error
Disciplined convex programming error:
Only scalar quadratic forms can be specified in CVX
.

(Mark L. Stone) #2

`(K1t(1)+K2t(2)+K3t(3)+K4t(4)+K5t(5)+K6t(6)) * x == f`
is non-convex, as it involves multiplication of 2 CVX variables, t and x.

(Ondrej Kosut) #3

oh sorry i can see that now
so now i have this problem which is semidefinite and also i get the error
I=ones(4);
V=30;
m=13;
n=8;
cvx_begin sdp
variables tau(1) t(m)
minimize( tau )
subject to
[tau * I ,Q’ ;Q, K1t(1)+K2t(2)+K3t(3)+K4t(4)+K5t(5)+K6t(6)+K7t(7)+K8t(8)+K9t(9)+K10t(10)+K11t(11)+K12t(12)+K13*t(13) ] >=0
t>=0
sum(t)==V
cvx_end

where matrixes K1:K13 are positive definite (12x4) and Q is orthonormal (8x8)
and i get error

Error using cvx/cat (line 40)
All dimensions but the one being concatenated (2) must be equal.

Error in cvx/horzcat (line 2)
y = cat( 2, varargin{:} );

[tauI,Q’;Q,
error in : K1
t(1)+K2t(2)+K3t(3)+K4t(4)+K5t(5)+K6t(6)+K7t(7)+K8t(8)+K9t(9)+K10t(10)+K11t(11)+K12t(12)+K13t(13)
] >=0

(Mark L. Stone) #4

The dimensions of the matrix you formed are incompatible. If instead of being declared CVX variables, tau and t were MATLAB variables (having numerical values) of the same dimensions you declared in CVX, any operations you perform have to be acceptable to MATLAB, such as compatible dimensions. This error essentially doesn’t have to do with CVX, but with basic rules of MATLAB.

Also, a matrix needs to be square to be positive definite, which 12 by 4 is not. And any matrix to which you want to apply a semidefinite constraint must be not only square, but also symmetric.