Cvx-optimization-solving

Hi,
this is my coding of a convex optimization problem which is solved without any error …
But i don’t know why the matrices of Ac ,Bc ,Cc,Dc are factor of 1e-13…

Is there that anyone know to help me ?

clear all
close all
clc
%% First: sensor-to-controller 
A = [1 2 1;1 0.25 5;2 3 4];
B = [1 0.2;4 1;0.7 3];
C = [0.1 5 0.7;0.6 0.9 0.6];
Ad = [0.4 0.2 0;0.2 0.16 0.4;0.2 0.6 2];

k = 0:100
TauSC = 0.2*sin(k);
TauCA = 0.4*sin(k);
d = 0.1*cos(k);
n = size(A,1);
[n,m] = size(B);
[q,n] = size(C);

mu1 = 0.8; delta1 =0.4 ;
mu2 = 0.9;  delta2 = 0.5;
tau1 = -0.2;
tau2 = 0.2;
tau3 = -0.4;
tau4 = 0.4;
d1 =-0.1;
d2 =0.1;
[U,S,V] = svd(B)
%% H-infinite 
cvx_begin sdp
variable P1(n,n) symmetric;
variable P2(n,n) symmetric;
variable R1(n,n) symmetric;
variable R2(n,n) symmetric;
variable R4(n,n) symmetric;
variable Q1(n,n) symmetric;
variable Q2(n,n) symmetric;
variable Q4(n,n) symmetric;
variable O1(n,n) symmetric;
variable O2(n,n) symmetric;
variable O4(n,n) symmetric;
variable T1(n,n) symmetric;
variable T2(n,n) symmetric;
variable T4(n,n) symmetric;

variable E(8,8) symmetric;

variable omega11(q,q);
variable omega12(n-q,n-q); 
variable omega21(q,q);
variable omega22(n-q,n-q); 

variable Y(n,n)
variable X(q,n)
variable W(q,m)
variable Z(n,m)
variable gama1sq nonnegative;
variable gama2sq nonnegative;

R =[R1 R2;R2' R4];
Q =[Q1 Q2;Q2' Q4];
O =[O1 O2;O2' O4];
T =[T1 T2;T2' T4];
U1 = U(:,1:2);
U2 = U(:,3);
P = [P1 zeros(n,n);zeros(n,n) P2];
omega1 = U1*omega11*U1'+U2*omega12*U2';
omega2 = U1*omega21*U1'+U2*omega22*U2';

Acl  = [A'*omega1' zeros(n,n);zeros(n,n) Y];
Adcl = [Ad'*omega1' zeros(n,n);zeros(n,n) zeros(n,n)];
A1cl = [zeros(n,n) mu1*C'*X;zeros(n,n) zeros(n,n)];
A2cl = [zeros(n,n) zeros(n,n);mu2*Z*B' zeros(n,n)];
A3cl = [mu1*mu2*C'*W*B' zeros(n,n);zeros(n,n) zeros(n,n)];
B1cl = [zeros(m,n) mu1*X;zeros(m,n) zeros(m,n)];
B2cl = [zeros(m,n) zeros(m,n);mu2*B'*omega1' zeros(m,n)];
B3cl = [mu1*mu2*W*B' zeros(m,n);zeros(m,n) zeros(m,n)];
B1hcl = [zeros(2,3) mu1*X;mu2*B'*omega1' zeros(2,3)];
Pcl  = [P1-(omega1+omega1') zeros(n,n);zeros(n,n) P2-(omega2+omega2')];

omegaT1 = inv(V')*pinv(S)*inv(U)*omega1*U*S*V';
omegaT2 = inv(V')*pinv(S)*inv(U)*omega2*U*S*V';

C1cl = [C'*omegaT2' zeros(3,6);zeros(3,2) zeros(3,6)];
C2cl = [zeros(3,6) zeros(3,2);zeros(3,6) Z];
C3cl = [zeros(3,6) mu1*C'*W;zeros(3,6) zeros(3,2)];
D1cl = [omegaT2' zeros(2,6);zeros(2,2) zeros(2,6)];
D2cl = [zeros(2,6) zeros(2,2);zeros(2,6) omegaT1'];
D3cl = [zeros(2,6) mu1*W;zeros(2,6) zeros(2,2)];
PQRST = -P+(tau2-tau1+1)*R+(d2-d1+1)*Q+(tau4-tau3+1)*O+(tau4+tau2-tau1-tau3+1)*T;
DomegaT = [omegaT2 zeros(2,2);zeros(2,2) omegaT1]
OT = [zeros(4,4) DomegaT;DomegaT' zeros(4,4)]

delta = delta1^2+delta2^2;
mu = inv(mu1)-1+inv(mu2)-1;

minimize gama1sq*delta+gama2sq*mu

subject to 

% % H_infinite
[PQRST zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,4) zeros(6,4) zeros(6,4) Acl zeros(6,8);
zeros(6,6) -Q zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,4) zeros(6,4) zeros(6,4) Adcl zeros(6,8);
zeros(6,6) zeros(6,6) -R zeros(6,6) zeros(6,6) zeros(6,4) zeros(6,4) zeros(6,4) A1cl C1cl;
zeros(6,6) zeros(6,6) zeros(6,6) -O zeros(6,6) zeros(6,4) zeros(6,4) zeros(6,4) A2cl C2cl;
zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,6) -T zeros(6,4) zeros(6,4) zeros(6,4) A3cl C3cl;
zeros(4,6) zeros(4,6) zeros(4,6) zeros(4,6) zeros(4,6) -gama1sq*eye(4) zeros(4,4) zeros(4,4) B1cl D1cl;
zeros(4,6) zeros(4,6) zeros(4,6) zeros(4,6) zeros(4,6) zeros(4,4) -gama1sq*eye(4) zeros(4,4) B2cl D2cl;
zeros(4,6) zeros(4,6) zeros(4,6) zeros(4,6) zeros(4,6) zeros(4,4) zeros(4,4) -gama1sq*eye(4) B3cl D3cl;
Acl' Adcl' A1cl' A2cl' A3cl' B1cl' B2cl' B3cl' Pcl zeros(6,8);
zeros(8,6) zeros(8,6) C1cl' C2cl' C3cl' D1cl' D2cl' D3cl' zeros(8,6) OT]<=0

%H2-constraint
AH = [Acl;Adcl;A1cl;A2cl;A3cl]
CH = [zeros(6,8);zeros(6,8);C1cl;C2cl;C3cl]   
AHH=[Acl' Adcl' A1cl' A2cl' A3cl']
CHH =[zeros(8,6) zeros(8,6) C1cl' C2cl' C3cl']

B1h = [zeros(2,3) mu1*X;mu2*B'*omega1' zeros(2,3)];
B2h = [mu1*mu2*W*B' zeros(2,3);zeros(2,3) zeros(2,3)];
BH = [B1h;B2h];
BHH = [B1h' B2h'];
DH = [zeros(4,8);D3cl];
DHH =[zeros(8,4) D3cl'];

PH = [P zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,6);zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,6);zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,6);zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,6);zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,6) zeros(6,6)]

[PH AH CH;
AHH -Pcl zeros(6,8);
CHH zeros(8,6) OT]>=0

[E BH DH;
BHH -Pcl zeros(6,8);
DHH zeros(8,6) OT]>=0

trace(E)< gama2sq

cvx_end

%% matrices controller
Ac = inv(omega2)*Y'
Bc = inv(omega2)*X'
Cc = inv(omegaT1)*Z'
Dc = inv(omegaT1)*W'
sys = ss(Ac,Bc,Cc,Dc,0.1)
K =tf(sys)

The optimal values of gama1sq and gama2sq are in reality zero, but the reported solution is solver tolerance away from zeros. That is because your LMIs are feasible with gama1sq and gama2sq at zero.

Running your problem in sdpt3 and sedumi, I get somewhat different solutions, but here is the output of your post cvx_end calculations using sedumi (magnitudes are smaller in sdpt3);

Ac =
   1.0e-04 *
    0.0340   -0.0010    0.0082
    0.1366   -0.0041    0.0333
    0.0354    0.0000    0.0106
Bc =
   1.0e-04 *
   -0.0089    0.0257
   -0.0356    0.1033
   -0.0065    0.0264
Cc =
   1.0e-05 *
   -0.0270    0.0252   -0.0344
   -0.2634    0.0112   -0.1568
Dc =
   1.0e-05 *
    0.0608   -0.2096
    0.0896   -0.2690
>> inv(omega2)
ans =
   1.0e+11 *
    0.1446    0.5712   -0.0008
    0.5820    2.3006    0.0171
    0.1528    0.6243    0.2920

Then I re-ran the problem in sedumi, but this time I constrained gama1sq==0;gama2sq==0;
and changed the objective function to maximize(trace(diag(diag(X)))) . There is nothing special about this objective function, I just made up something rather arbitrary to see if I could induce Bc = inv(omega2)*X' to come out significantly different than in your problem as originally specified, even though my modified version is optimal for your original problem, because it has gama1sq and gama2sq constrained to be at the optimal values for your original problem. Here is the result:

Ac =
   1.0e-06 *
    0.0263   -0.0066    0.0005
    0.1065   -0.0268    0.0020
    0.0392   -0.0099    0.0007
Bc =
    0.0413   -0.2003
    0.1662   -0.8070
    0.0465   -0.2259
Cc =
   1.0e-09 *
   -0.0172   -0.0015    0.0360
    0.0055   -0.0871    0.1221
Dc =
   1.0e-09 *
   -0.0175    0.0565
   -0.0240    0.1153
>> inv(omega2)
ans =
   1.0e+06 *
    0.3982    1.5814    0.1146
    1.6044    6.3759    0.5261
    0.4438    1.8270    1.0495

As you can see, I came out with a quite different Bc, even though this solution and the solution from your original problem are both optimal for that original problem. This shows that your calculations of Ac, Bc, and I suspect Cc and Dc are rather meaningless, or in any event, far from unique. If they should have unique meaningful values, then your problem formulation is inadequate.