Here’s my program, and the error message is as follows:
Warning: A non-empty cvx problem already exists in this scope.
It is being overwritten.
Position: CVXPROB (line 28)
Location: cvx_begin (line 41)
Location: untitled (row 4)
Successive approximation method to be employed.
SDPT3 will be called several times to refine the solution.
Original size: 1267 variables, 494 equality constraints
1 exponentials add 8 variables, 5 equality constraints
Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
You can’t use a value of type struct as an index.
Error cvxprob/solve (line 253)
[ x, status, tprec, iters2, y, z ] = shim.solve( [ At, Anew2 ], [ b ; bnew ], c, cones, true, prec, solv.settings, eargs{:} );
Error cvx_end (line 88)
solve( prob );
Error untitled (line 58)
cvx_end
Please point out how this should be corrected, and I would be very grateful!
clc;clear;close
H=[0.25 0;0 0.25]; G=[1;0];D=[10 0; 0 10];P=[10 10;10 0;1 11];
cvx_begin sdp
variable N(1,2);
variable W(2,2) symmetric ;
variable r11(1,1) nonnegative;variable r12(1,1) nonnegative;variable r13(1,1) nonnegative;variable r14(1,1) nonnegative;variable r15(1,1) nonnegative;variable r16(1,1) nonnegative;
variable r21(1,1) nonnegative;variable r22(1,1) nonnegative;variable r23(1,1) nonnegative;variable r24(1,1) nonnegative;variable r25(1,1) nonnegative;variable r26(1,1) nonnegative;
variable r31(1,1) nonnegative;variable r32(1,1) nonnegative;variable r33(1,1) nonnegative;variable r34(1,1) nonnegative;variable r35(1,1) nonnegative;variable r36(1,1) nonnegative
variable a11(40,40) semidefinite diagonal;variable a12(40,40) semidefinite diagonal;variable a13(40,40) semidefinite diagonal;variable a14(40,40) semidefinite diagonal;variable a15(40,40) semidefinite diagonal;variable a16(40,40) semidefinite diagonal;
variable a21(40,40) semidefinite diagonal;variable a22(40,40) semidefinite diagonal;variable a23(40,40) semidefinite diagonal;variable a24(40,40) semidefinite diagonal;variable a25(40,40) semidefinite diagonal;variable a26(40,40) semidefinite diagonal;
variable a31(40,40) semidefinite diagonal;variable a32(40,40) semidefinite diagonal;variable a33(40,40) semidefinite diagonal;variable a34(40,40) semidefinite diagonal;variable a35(40,40) semidefinite diagonal;variable a36(40,40) semidefinite diagonal;
variable b11(2,2) semidefinite diagonal;variable b12(2,2) semidefinite diagonal;variable b13(2,2) semidefinite diagonal;variable b14(2,2) semidefinite diagonal;variable b15(2,2) semidefinite diagonal;variable b16(2,2) semidefinite diagonal;
variable b21(2,2) semidefinite diagonal;variable b22(2,2) semidefinite diagonal;variable b23(2,2) semidefinite diagonal;variable b24(2,2) semidefinite diagonal;variable b25(2,2) semidefinite diagonal;variable b26(2,2) semidefinite diagonal;
variable b31(2,2) semidefinite diagonal;variable b32(2,2) semidefinite diagonal;variable b33(2,2) semidefinite diagonal;variable b34(2,2) semidefinite diagonal;variable b35(2,2) semidefinite diagonal;variable b36(2,2) semidefinite diagonal;
%
%maximize (log_det(W))
%maximize log_det(W)
minimize -log_det(W)
subject to
HW[0.0100;0.0900]>=-ones(2,1);HW[0.0100;0.0900]<=ones(2,1);
HW[-0.1000;0.1000]>=-ones(2,1);HW[0.1000;-0.0000]<=ones(2,1);
HW[0.0100;0.0900]<=ones(2,1);HW[-0.1000;0.1000]<=ones(2,1);
GN[-0.1000;0.1000]>=-ones(2,1);GN[0.0100;0.0900]>=-ones(2,1);
GN[-0.1000;0.1000]>=-ones(2,1);GN[-0.1000;0.1000]<=ones(2,1);
GN[0.0100;0.0900]<=ones(2,1);GN[-0.1000;0.1000]<=ones(2,1);
X1=[-1.1149 0.7390 4.4272 7.0072 6.9355 3.8999 2.2305 1.3877 -0.8361 -3.0095 -6.4296 -7.5664 -8.5995 -9.7856 -9.2884 -10.1804 -10.5304 -11.9561 -13.1271 -14.0937;
1.3482 1.7756 2.4331 0.8166 0.3907 -0.9379 -0.1125 0.1498 -2.0075 -2.9587 -1.2236 -0.0307 -1.4458 -1.1847 -0.5079 0.1705 0.5498 -0.6186 -1.2793 0.2288];
X2=[-1.1149 0.7390 4.4272 7.0072 6.9355 3.8999 2.2305 1.3877 -0.8361 -3.0095 -6.4296 -7.5664 -8.5995 -9.7856 -9.2884 -10.1804 -10.5304 -11.9561 -13.1271 -14.0937 -14.1846;
1.3482 1.7756 2.4331 0.8166 0.3907 -0.9379 -0.1125 0.1498 -2.0075 -2.9587 -1.2236 -0.0307 -1.4458 -1.1847 -0.5079 0.1705 0.5498 -0.6186 -1.2793 0.2288 -0.7305];
U=[-0.6334 1.7316 -0.4373 -0.9071 -1.3922 -0.4116 -0.5011 -1.4755 -0.2598 -1.6339 0.4585 -1.9561 0.2930 1.1589 -1.0585 -0.2079 0.2774 -1.7544 -0.0148 0.5693];
e1=[1;0;0];e2=[0;1;0];e3=[0;0;1];
d=[D*[0.7390;1.7756];D*[4.4272;2.4331];D*[7.0072;0.8166];D*[6.9355;0.3907];D*[3.8999;0.9379];D*[2.2305; -0.1125];D*[1.3877;0.1498];D*[-0.8361;-2.0075];D*[-3.0095;-2.9587];D*[-6.4296;-1.2236];D*[-7.5664;
-0.0307];D*[-8.5995;-1.4458];D*[-9.7856;-1.1847];D*[-9.2884;-0.5079];D*[-10.1804;0.1705];D*[-10.5304;0.5498];D*[-11.9561;-0.6186];D*[-13.1271;-1.2793];D*[-14.0937;0.2288];D*[-14.1846;-0.7305]];
z=kron([X1;U]‘,D);
g11=([W;N][-0.1000;0.1000])';
g1=kron(g11,eye(2));
g22=([W;N][0.1000;-0.0000])’;
g2=kron(g22,eye(2));
g33=([W;N][0.0100;0.0900])';
g3=kron(g33,eye(2));
g44=([W;N][0.1000;-0.1000])‘;
g4=kron(g44,eye(2));
g55=([W;N][-0.1000;0.0000])';
g5=kron(g55,eye(2));
g66=([W;N][-0.0100;-0.0900])’;
g6=kron(g66,eye(2));
[r11-ones(40,1)‘a11ones(40,1)-[1;1]‘b11[1;1]+d’a11d,-d’a11z,zeros(1,2),zeros(1,2);-z’a11d,z’a11z,zeros(6,2),g1’;zeros(2,1),zeros(2,6),D’b11D,eye(2);zeros(2,1),g1,eye(2),W+W’-r11*P’e1e1’P] == semidefinite(11);
[r11-ones(40,1)‘a11ones(40,1)-[1;1]‘b11[1;1]+d’a11d,-d’a11z,zeros(1,2),zeros(1,2);-z’a11d,z’a11z,zeros(6,2),g1’;zeros(2,1),zeros(2,6),D’b11D,eye(2);zeros(2,1),g1,eye(2),W+W’-r11P’e1e1’P] == semidefinite(11);
[r12-ones(40,1)‘a12ones(40,1)-[1;1]‘b12[1;1]+d’a12d,-d’a12z,zeros(1,2),zeros(1,2);-z’a12d,z’a12z,zeros(6,2),g1’;zeros(2,1),zeros(2,6),D’b12D,eye(2);zeros(2,1),g1,eye(2),W+W’-r12P’e1e1’P] == semidefinite(11);
[r13-ones(40,1)‘a13ones(40,1)-[1;1]‘b13[1;1]+d’a13d,-d’a13z,zeros(1,2),zeros(1,2);-z’a13d,z’a13z,zeros(6,2),g1’;zeros(2,1),zeros(2,6),D’b13D,eye(2);zeros(2,1),g1,eye(2),W+W’-r13P’e1e1’P] == semidefinite(11);
[r14-ones(40,1)‘a14ones(40,1)-[1;1]‘b14[1;1]+d’a14d,-d’a14z,zeros(1,2),zeros(1,2);-z’a14d,z’a14z,zeros(6,2),g1’;zeros(2,1),zeros(2,6),D’b14D,eye(2);zeros(2,1),g1,eye(2),W+W’-r14P’e1e1’P] == semidefinite(11);
[r15-ones(40,1)‘a15ones(40,1)-[1;1]‘b15[1;1]+d’a15d,-d’a15z,zeros(1,2),zeros(1,2);-z’a15d,z’a15z,zeros(6,2),g1’;zeros(2,1),zeros(2,6),D’b15D,eye(2);zeros(2,1),g1,eye(2),W+W’-r15P’e1e1’P] == semidefinite(11);
[r16-ones(40,1)‘a16ones(40,1)-[1;1]‘b16[1;1]+d’a16d,-d’a16z,zeros(1,2),zeros(1,2);-z’a16d,z’a16z,zeros(6,2),g1’;zeros(2,1),zeros(2,6),D’b16D,eye(2);zeros(2,1),g1,eye(2),W+W’-r16P’e1e1’*P] == semidefinite(11);
cvx_end
cvx_optval