CVX error on an constraint


(eliiiiiiiiiiiiiiiii) #1

Hi ,
I have a LMI constraint …But it take this error :
"Both sides of an SDP constraint must be affine"

Is there anyone that know the reason of it.

Could anyone help me to solve the error?

clear all
close all
clc
%% First: sensor-to-controller 
A = [-0.45 0.45 0;0.09 0.225 -0.45;0.135 0.135 -0.54];
B = [1 0;0.2 1;0 3];
C = [0.1 0.8 0.7;-0.6 0.9 0.6];
Ad = [-0.04 0.02 0;0.02 -0.16 0.04;0.2 -0.06 -0.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;
mu2 = 0.6;
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 j1(15,15) symmetric;
variable j2(15,15) symmetric;
variable E(4,4) 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 gama;
variable gama1;
 
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)];
OT = [zeros(2,2) -omegaT2 zeros(2,2) zeros(2,2);-omegaT2' 2*eye(2) zeros(2,2) zeros(2,2);zeros(2,2) zeros(2,2) zeros(2,2) -omegaT1;zeros(2,2) zeros(2,2) -omegaT1' 2*eye(2)];
PQRST = -P+(tau2-tau1+1)*R+(d2-d1+1)*Q+(tau4-tau3+1)*O+(tau4+tau2-tau1-tau3+1)*T;

% 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) -gama^2*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) -gama^2*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) -gama^2*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

(Mark L. Stone) #2

The error is because gama^2 is in your sdp constraint.

Given that gama doesn’t appear anywhere else, you could use
variable gamasq nonnegative
instead of gama^2 , and that will be accepted by CVX.

However, even just changing gama^2 to gama, i.e., without imposing a nonnegative constraint, the problem is reported infeasible by both sdpt3 and sedumi.

I also noticed that you declare a variable gama1, but never use it.


(eliiiiiiiiiiiiiiiii) #3

Thank you for your answer…
I changed one as you said…but it be infeasible…
Why?
I mean what is the reason of a problem to be infeasible?


(Mark L. Stone) #4

It’s your model, so I leave it to you to determine why it is infeasible.

I did run it, replacing gama^2 by gamasq declared to be nonnegative, and replacing the LMI with an objective minimize(lambda_max(matrix)), where matrix is the LHS of LMI. The optimal objective value is 2 (needs to be <= 0 for feasibility of your problem), and eigenvalues of optimal matrix are

  Columns 1 through 17
   -0.4270   -0.4270   -0.4270   -0.4270   -0.4270   -0.4270   -0.4270   -0.4270   -0.4270   -0.4270   -0.4270   -0.4270   -0.0149   -0.0148   -0.0140   -0.0135   -0.0088
  Columns 18 through 34
   -0.0058   -0.0057   -0.0051   -0.0047   -0.0000   -0.0000   -0.0000   -0.0000    0.0005    0.0015    0.0037    0.0038    0.0086    0.0087    0.0093    0.0099    0.0109
  Columns 35 through 51
    0.0126    0.0137    0.0137    0.0137    0.0137    0.0142    0.0156    0.0200    0.0228    0.0234    0.0283    0.0408    0.0408    0.0408    0.0408    0.0408    0.0408
  Columns 52 through 56
    0.0601    2.0000    2.0000    2.0000    2.0000

The minimum maximum eigenvalue is also 2 even when gama is not constrained (declared) nonnegative.