clc;clear;close
H1=[1/6 0;0 1/3;-5/6 0;0 -1/6 ];
H2=[1/3;-1/3];H3=[10 0;0 10];
C=[1 0 ; 0 1];
w1 =[1.2000 -0.0000;-0.0000 3.0000];
x111=[1.3066 0.0004;0.0004 3.9565];
x112=[1.7819 0.0022;0.0022 2.7275];
x121=[1.8890 0.1069;0.1069 4.8945];
x122=[2.1546 0.1028;0.1028 4.0238];
x211=[1.3066 0.0004;0.0004 3.9565];
x212=[1.7766 0.0064;0.0064 2.6821];
x221=[1.8890 0.1069;0.1069 4.8945];
x222=[2.1546 0.1028;0.1028 4.0238];
x311=[1.3368 0.0020;0.0020 3.9032];
x312=[1.7917 0.0033;0.0033 2.6554];
x321=[1.9669 0.0669;0.0669 4.4936];
x322=[2.2040 0.0725;0.0725 3.4930];
x411=[1.3368 0.0020;0.0020 3.9032];
x412=[1.7893 0.0027;0.0027 2.6693];
x421=[1.9669 0.0669;0.0669 4.4936];
x422=[2.2040 0.0725;0.0725 3.4930];
cvx_begin sdp
cvx_solver mosek
variable W(2,2) symmetric;
variable T(2,2) symmetric;
variable N(1,4);
variable g11(2,10);variable g12(2,10);variable g21(2,10);variable g22(2,10);
variable g31(2,10);variable g32(2,10);variable g41(2,10);variable g42(2,10);
variable r111(1,1) nonnegative;variable r112(1,1) nonnegative;variable r121(1,1) nonnegative;variable r122(1,1) nonnegative;
variable r211(1,1) nonnegative;variable r212(1,1) nonnegative;variable r221(1,1) nonnegative;variable r222(1,1) nonnegative;
variable r311(1,1) nonnegative;variable r312(1,1) nonnegative;variable r321(1,1) nonnegative;variable r322(1,1) nonnegative;
variable r411(1,1) nonnegative;variable r412(1,1) nonnegative;variable r421(1,1) nonnegative;variable r422(1,1) nonnegative;
variable a111(40,40) semidefinite diagonal;variable a112(40,40) semidefinite diagonal;variable a121(40,40) semidefinite diagonal;variable a122(40,40) semidefinite diagonal;
variable a211(40,40) semidefinite diagonal;variable a212(40,40) semidefinite diagonal;variable a221(40,40) semidefinite diagonal;variable a222(40,40) semidefinite diagonal;
variable a311(40,40) semidefinite diagonal;variable a312(40,40) semidefinite diagonal;variable a321(40,40) semidefinite diagonal;variable a322(40,40) semidefinite diagonal;
variable a411(40,40) semidefinite diagonal;variable a412(40,40) semidefinite diagonal;variable a421(40,40) semidefinite diagonal;variable a422(40,40) semidefinite diagonal;
variable b111(2,2) semidefinite diagonal;variable b112(2,2) semidefinite diagonal;variable b121(2,2) semidefinite diagonal;variable b122(2,2) semidefinite diagonal;
variable b211(2,2) semidefinite diagonal;variable b212(2,2) semidefinite diagonal;variable b221(2,2) semidefinite diagonal;variable b222(2,2) semidefinite diagonal;
variable b311(2,2) semidefinite diagonal;variable b312(2,2) semidefinite diagonal;variable b321(2,2) semidefinite diagonal;variable b322(2,2) semidefinite diagonal;
variable b411(2,2) semidefinite diagonal;variable b412(2,2) semidefinite diagonal;variable b421(2,2) semidefinite diagonal;variable b422(2,2) semidefinite diagonal;
variable v111(2,2) ;variable v112(2,2) ;variable v121(2,2) ;variable v122(2,2) ;
variable v211(2,2) ;variable v212(2,2) ;variable v221(2,2) ;variable v222(2,2) ;
variable v311(2,2) ;variable v312(2,2) ;variable v321(2,2) ;variable v322(2,2) ;
variable v411(2,2) ;variable v412(2,2) ;variable v421(2,2) ;variable v422(2,2) ;
variable X111(2,2) symmetric;variable X112(2,2) symmetric;variable X121(2,2) symmetric;variable X122(2,2) symmetric;
variable X211(2,2) symmetric;variable X212(2,2) symmetric;variable X221(2,2) symmetric;variable X222(2,2) symmetric;
variable X311(2,2) symmetric;variable X312(2,2) symmetric;variable X321(2,2) symmetric;variable X322(2,2) symmetric;
variable X411(2,2) symmetric;variable X412(2,2) symmetric;variable X421(2,2) symmetric;variable X422(2,2) symmetric;
maximize log_det(W)
subject to
H1W[-1;1]<=ones(4,1);H1W[1;-1]<=ones(4,1);
H1W[-1;-1]<=ones(4,1);H1W[1;1]<=ones(4,1);
H2Nkron([1;0],[-1;1])<=ones(2,1);H2Nkron([1;0],[1;-1])<=ones(2,1);
H2Nkron([1;0],[-1;-1])<=ones(2,1);H2Nkron([1;0],[1;1])<=ones(2,1);
H2Nkron([0;1],[-1;1])<=ones(2,1);H2Nkron([0;1],[1;-1])<=ones(2,1);
H2Nkron([0;1],[-1;-1])<=ones(2,1);H2Nkron([0;1],[1;1])<=ones(2,1);
e1=[1;0];e2=[0;1];
x1=[0.7814;0.2880];x2=[0.9839;0.2897];x3=[2.6751;1.7373];x4=[5.9519;2.7657];x5=[4.7842;-0.1208];x6=[1.5891;-2.6976];x7=[0.7628;-0.5556];x8=[2.7112;1.9480];x9=[4.0016;1.6816];x10=[4.1556;-0.4786];
x11=[5.2454;1.6229];x12=[4.8165;0.3140 ];x13=[3.5436;-1.0243];x14=[3.8763;0.4997];x15=[0.7066;-2.4871];x16=[-4.7929;-5.6726];x17=[-8.7071;-4.3372];x18=[-11.3191;-3.2707];x19=[-11.8039;-2.6239];x20=[-9.3375;0.3954];
x21=[4.4278;-0.7637];
p1=[0.1341;0.8659];p2=[0.2126;0.7874];p3=[0.8949;0.1051];p4=[0.0715; 0.9285 ];p5=[0.2425;0.7575];p6=[0.0538;0.9462];p7=[0.4417;0.5583];p8=[0.0133;0.9867];p9=[0.8972;0.1028];p10=[0.1967;0.8033];
p11=[0.0934;0.9066];p12=[0.3074;0.6926];p13=[0.4561;0.5439];p14=[0.1017;0.8983];p15=[0.9954;0.0046];p16=[0.3321;0.6679];p17=[0.2973;0.7027];p18=[0.0620;0.9380];p19=[0.2982;0.7018];p20=[0.0464;0.9536];
X2=[kron(p1,x1) kron(p2,x2) kron(p3,x3) kron(p4,x4) kron(p5,x5) kron(p6,x6) kron(p7,x7) kron(p8,x8) kron(p9,x9) kron(p10,x10) kron(p11,x11) kron(p12,x12) kron(p13,x13) kron(p14,x14) kron(p15,x15) kron(p16,x16) kron(p17,x17) kron(p18,x18) kron(p19,x19) kron(p20,x20);
0.0326 1.5686 0.7864 -2.4607 -2.5148 1.6634 2.4308 0.2026 -2.3451 1.9549 -0.9714 -1.2362 1.4779 -2.9380 -2.7093 1.0075 0.6208 0.1566 1.3783 1.2435];
d=[H3*x2;H3*x3;H3*x4;H3*x5;H3*x6;H3*x7;H3*x8;H3*x9;H3*x10;H3*x11;H3*x12;H3*x13;H3*x14;H3*x15;H3*x16;H3*x17;H3*x18;H3*x19;H3*x20;H3*x21];
Z=kron(X2',H3);
g11==kron(([kron(eye(2),W);N]*kron([0;1],[1;-1]))',eye(2));
g21==kron(([kron(eye(2),W);N]*kron([0;1],[-1;1]))',eye(2));
g31==kron(([kron(eye(2),W);N]*kron([0;1],[1;1]))',eye(2));
g41==kron(([kron(eye(2),W);N]*kron([0;1],[-1;-1]))',eye(2));
g12==kron(([kron(eye(2),W);N]*kron([1;0],[1;-1]))',eye(2));
g22==kron(([kron(eye(2),W);N]*kron([1;0],[-1;1]))',eye(2));
g32==kron(([kron(eye(2),W);N]*kron([1;0],[1;1]))',eye(2));
g42==kron(([kron(eye(2),W);N]*kron([1;0],[-1;-1]))',eye(2));
[W'*inv(x111)*w1+w1*inv(x111)*W-w1*inv(x111)*(X111)*inv(x111)*w1 (r111)*C'*e1;(r111)*e1'*C r111]==semidefinite(3);
[W'*inv(x112)*w1+w1*inv(x112)*W-w1*inv(x112)*(X112)*inv(x121)*w1 (r112)*C'*e2;(r112)*e2'*C r112]==semidefinite(3);
[W'*inv(x121)*w1+w1*inv(x121)*W-w1*inv(x121)*(X121)*inv(x121)*w1 (r121)*C'*e1;(r121)*e1'*C r121]==semidefinite(3);
[W'*inv(x122)*w1+w1*inv(x122)*W-w1*inv(x122)*(X122)*inv(x122)*w1 (r122)*C'*e2;(r122)*e2'*C r122]==semidefinite(3);
[W'*inv(x211)*w1+w1*inv(x211)*W-w1*inv(x211)*(X211)*inv(x211)*w1 (r211)*C'*e1;(r211)*e1'*C r211]==semidefinite(3);
[W'*inv(x212)*w1+w1*inv(x212)*W-w1*inv(x212)*(X212)*inv(x212)*w1 (r212)*C'*e2;(r212)*e2'*C r212]==semidefinite(3);
[W'*inv(x221)*w1+w1*inv(x221)*W-w1*inv(x221)*(X221)*inv(x221)*w1 (r221)*C'*e1;(r221)*e1'*C r221]==semidefinite(3);
[W'*inv(x222)*w1+w1*inv(x222)*W-w1*inv(x222)*(X222)*inv(x222)*w1 (r222)*C'*e2;(r222)*e2'*C r222]==semidefinite(3);
[W'*inv(x311)*w1+w1*inv(x311)*W-w1*inv(x311)*(X311)*inv(x311)*w1 (r311)*C'*e1;(r311)*e1'*C r311]==semidefinite(3);
[W'*inv(x312)*w1+w1*inv(x312)*W-w1*inv(x312)*(X312)*inv(x312)*w1 (r312)*C'*e2;(r312)*e2'*C r312]==semidefinite(3);
[W'*inv(x321)*w1+w1*inv(x321)*W-w1*inv(x321)*(X321)*inv(x321)*w1 (r321)*C'*e1;(r321)*e1'*C r321]==semidefinite(3);
[W'*inv(x322)*w1+w1*inv(x322)*W-w1*inv(x322)*(X322)*inv(x322)*w1 (r322)*C'*e2;(r322)*e2'*C r322]==semidefinite(3);
[W'*inv(x411)*w1+w1*inv(x411)*W-w1*inv(x411)*(X411)*inv(x411)*w1 (r411)*C'*e1;(r411)*e1'*C r411]==semidefinite(3);
[W'*inv(x412)*w1+w1*inv(x412)*W-w1*inv(x412)*(X412)*inv(x412)*w1 (r412)*C'*e2;(r412)*e2'*C r412]==semidefinite(3);
[W'*inv(x421)*w1+w1*inv(x421)*W-w1*inv(x421)*(X421)*inv(x421)*w1 (r421)*C'*e1;(r421)*e1'*C r421]==semidefinite(3);
[W'*inv(x422)*w1+w1*inv(x422)*W-w1*inv(x422)*(X422)*inv(x422)*w1 (r422)*C'*e2;(r422)*e2'*C r422]==semidefinite(3);
W'*w1+w1'*W-w1'*w1-T==semidefinite(2);
[r111-ones(40,1)'*(a111)*ones(40,1)-[1;1]'*(b111)*[1;1]+d'*(a111)*d -d'*(a111)*Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z'*(a111)*d Z'*(a111)*Z zeros(10,2) (g11)' zeros(10,2);
zeros(2,1) zeros(2,10) H3'*(b111)*H3 eye(2) zeros(2,2);
zeros(2,1) g11 eye(2) (v111)+(v111)' (v111)';
zeros(2,1) zeros(2,10) zeros(2,2) v111 X111]==semidefinite(17);
[r112-ones(40,1)'*(a112)*ones(40,1)-[1;1]'*(b112)*[1;1]+d'*(a112)*d -d'*(a112)*Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z'*(a112)*d Z'*(a112)*Z zeros(10,2) (g11)' zeros(10,2);
zeros(2,1) zeros(2,10) H3'*(b112)*H3 eye(2) zeros(2,2);
zeros(2,1) g11 eye(2) (v112)+(v112)' (v112)';
zeros(2,1) zeros(2,10) zeros(2,2) v112 X112]==semidefinite(17);
[r121-ones(40,1)'*(a121)*ones(40,1)-[1;1]'*(b121)*[1;1]+d'*(a121)*d -d'*(a121)*Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z'*(a121)*d Z'*(a121)*Z zeros(10,2) (g12)' zeros(10,2);
zeros(2,1) zeros(2,10) H3'*(b121)*H3 eye(2) zeros(2,2);
zeros(2,1) g12 eye(2) (v121)+(v121)' (v121)';
zeros(2,1) zeros(2,10) zeros(2,2) v121 X121]==semidefinite(17);
[r122-ones(40,1)'*(a122)*ones(40,1)-[1;1]'*(b122)*[1;1]+d'*(a111)*d -d'*(a122)*Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z'*(a122)*d Z'*(a122)*Z zeros(10,2) (g12)' zeros(10,2);
zeros(2,1) zeros(2,10) H3'*(b122)*H3 eye(2) zeros(2,2);
zeros(2,1) g12 eye(2) (v122)+(v122)' (v122)';
zeros(2,1) zeros(2,10) zeros(2,2) v122 X122]==semidefinite(17);
%
[r211-ones(40,1)‘(a211)ones(40,1)-[1;1]'(b211)[1;1]+d’(a211)d -d’(a211)Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z’(a211)d Z’(a211)Z zeros(10,2) (g21)’ zeros(10,2);
zeros(2,1) zeros(2,10) H3’(b211)H3 eye(2) zeros(2,2);
zeros(2,1) g21 eye(2) (v211)+(v211)’ (v211)‘;
zeros(2,1) zeros(2,10) zeros(2,2) v211 X211]==semidefinite(17);
[r212-ones(40,1)’(a212)ones(40,1)-[1;1]'(b212)[1;1]+d’(a212)d -d’(a212)Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z’(a212)d Z’(a212)Z zeros(10,2) (g21)’ zeros(10,2);
zeros(2,1) zeros(2,10) H3’(b112)H3 eye(2) zeros(2,2);
zeros(2,1) g21 eye(2) (v212)+(v212)’ (v212)‘;
zeros(2,1) zeros(2,10) zeros(2,2) v212 X212]==semidefinite(17);
[r221-ones(40,1)’(a221)ones(40,1)-[1;1]'(b221)[1;1]+d’(a221)d -d’(a221)Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z’(a221)d Z’(a221)Z zeros(10,2) (g22)’ zeros(10,2);
zeros(2,1) zeros(2,10) H3’(b221)H3 eye(2) zeros(2,2);
zeros(2,1) g22 eye(2) (v221)+(v221)’ (v221)‘;
zeros(2,1) zeros(2,10) zeros(2,2) v221 X221]==semidefinite(17);
[r222-ones(40,1)’(a222)ones(40,1)-[1;1]'(b222)[1;1]+d’(a222)d -d’(a222)Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z’(a222)d Z’(a222)Z zeros(10,2) (g22)’ zeros(10,2);
zeros(2,1) zeros(2,10) H3’(b222)H3 eye(2) zeros(2,2);
zeros(2,1) g22 eye(2) (v222)+(v222)’ (v222)‘;
zeros(2,1) zeros(2,10) zeros(2,2) v222 X222]==semidefinite(17);
%
[r311-ones(40,1)’(a311)ones(40,1)-[1;1]'(b311)[1;1]+d’(a311)d -d’(a311)Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z’(a311)d Z’(a311)Z zeros(10,2) (g31)’ zeros(10,2);
zeros(2,1) zeros(2,10) H3’(b311)H3 eye(2) zeros(2,2);
zeros(2,1) g31 eye(2) (v311)+(v311)’ (v311)‘;
zeros(2,1) zeros(2,10) zeros(2,2) v311 X311]==semidefinite(17);
[r312-ones(40,1)’(a312)ones(40,1)-[1;1]'(b312)[1;1]+d’(a312)d -d’(a312)Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z’(a312)d Z’(a312)Z zeros(10,2) (g31)’ zeros(10,2);
zeros(2,1) zeros(2,10) H3’(b312)H3 eye(2) zeros(2,2);
zeros(2,1) g31 eye(2) (v312)+(v312)’ (v312)‘;
zeros(2,1) zeros(2,10) zeros(2,2) v312 X312]==semidefinite(17);
[r321-ones(40,1)’(a321)ones(40,1)-[1;1]'(b321)[1;1]+d’(a321)d -d’(a321)Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z’(a321)d Z’(a321)Z zeros(10,2) (g32)’ zeros(10,2);
zeros(2,1) zeros(2,10) H3’(b321)H3 eye(2) zeros(2,2);
zeros(2,1) g32 eye(2) (v321)+(v321)’ (v321)‘;
zeros(2,1) zeros(2,10) zeros(2,2) v321 X321]==semidefinite(17);
[r322-ones(40,1)’(a322)ones(40,1)-[1;1]'(b322)[1;1]+d’*(a322)d -d’(a322)Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z’(a322)d Z’(a322)Z zeros(10,2) (g32)’ zeros(10,2);
zeros(2,1) zeros(2,10) H3’(b322)*H3 eye(2) zeros(2,2);
zeros(2,1) g32 eye(2) (v322)+(v322)’ (v322)';
zeros(2,1) zeros(2,10) zeros(2,2) v322 X322]==semidefinite(17);
[r411-ones(40,1)'*(a411)*ones(40,1)-[1;1]'*(b411)*[1;1]+d'*(a411)*d -d'*(a411)*Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z'*(a411)*d Z'*(a411)*Z zeros(10,2) (g41)' zeros(10,2);
zeros(2,1) zeros(2,10) H3'*(b411)*H3 eye(2) zeros(2,2);
zeros(2,1) g41 eye(2) (v411)+(v411)' (v411)';
zeros(2,1) zeros(2,10) zeros(2,2) v411 X411]==semidefinite(17);
[r412-ones(40,1)'*(a412)*ones(40,1)-[1;1]'*(b412)*[1;1]+d'*(a412)*d -d'*(a412)*Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z'*(a412)*d Z'*(a412)*Z zeros(10,2) (g41)' zeros(10,2);
zeros(2,1) zeros(2,10) H3'*(b412)*H3 eye(2) zeros(2,2);
zeros(2,1) g41 eye(2) (v112)+(v112)' (v112)';
zeros(2,1) zeros(2,10) zeros(2,2) v412 X412]==semidefinite(17);
[r421-ones(40,1)'*(a421)*ones(40,1)-[1;1]'*(b421)*[1;1]+d'*(a421)*d -d'*(a421)*Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z'*(a421)*d Z'*(a421)*Z zeros(10,2) (g42)' zeros(10,2);
zeros(2,1) zeros(2,10) H3'*(b421)*H3 eye(2) zeros(2,2);
zeros(2,1) g42 eye(2) (v421)+(v421)' (v421)';
zeros(2,1) zeros(2,10) zeros(2,2) v421 X421]==semidefinite(17);
[r422-ones(40,1)'*(a422)*ones(40,1)-[1;1]'*(b422)*[1;1]+d'*(a422)*d -d'*(a422)*Z zeros(1,2) zeros(1,2) zeros(1,2);
-Z'*(a422)*d Z'*(a422)*Z zeros(10,2) (g42)' zeros(10,2);
zeros(2,1) zeros(2,10) H3'*(b422)*H3 eye(2) zeros(2,2);
zeros(2,1) g42 eye(2) (v422)+(v422)' (v422)';
zeros(2,1) zeros(2,10) zeros(2,2) v422 X422]==semidefinite(17);
cvx_end
cvx_optval
The above iterative algorithm takes different w1, x111, x112, x121, x122 each time, but the value of the optimization variable W is the same. I hope you can come up with some suggestions and some ways to achieve a different initial value, i.e., each iteration, we get a different optimization variable W