Sedumi 1.3 on YALMIP: Dual infeasible, primal improving direction found

307 views
Skip to first unread message

sharmila svsas

unread,
Jan 19, 2018, 5:01:37 AM1/19/18
to YALMIP
clc;
clear all;
 global A
 global B
 global C
 global D
 global E
 global L
 global M
 global K
yalmip('clear');

c1=1;
C1=[c1 0 0 0;
   0 c1 0 0;
   0 0 c1 0;
   0 0 0 c1];


A{1}=[-.021 0;
0 -2];
A{2}=[-1 -.031;
0 -2];

B=[.021
-1];

D{1}=[-.011
    1];
D{2}=[1;
    0];

E{1}=[-.022 0;
     0 .013];
E{2}=[-.010 0;
     0 -.041];
C{1}=[0 .011];  
C{2}=[0 0.011];
%%v{2}=C{2}'*C{2};

K{1}=[-.1 -1];
K{2}=[-1.02 -1];
M{1}=1;
M{2}=.91;

zer=[0 0;0 0];
zer1=[0;0];
L=[1.01 0.95];
Omeg1=[1 0 0;0 0 0;0 0 0];
In=[1 0;0 1];
rho=0.03;
alpha=0;
beta=1;
sigma=0.005;
taum=.2;
tauM=1;
     
n=size(C1,1);
ze=zeros(n,n);
ze1=zeros(4,3);
ze2=zeros(4,1);
ze3=zeros(3,1);
ze4=zeros(3,3);
CR{1}=sigma*alpha*In+(sigma*beta+1)*C{1}'*C{1};
CR{2}=sigma*alpha*In+(sigma*beta+1)*C{2}'*C{2};

for k=1:2
    for l=1:2
a{k,l}=[A{k} zer;
    zer A{l}+B*K{l}]
    end
end
for l=1:2
a{l}=[-B*M{l}*C{l} zer; zer -B*M{l}*C{l}]
b{l}=[-B*M{l} B*M{l}*C{l}; zer1 zer]
end
for k=1:2
d{k}=[D{k};zer1]
e{k}=[E{k}; zer]
Ome2{k}=[C{k}'; C{k}'];
%Omeg2{k}=Ome2{k}*rho*Omega*Ome2{k}';
dC{k}=[CR{k} CR{k};CR{k} CR{k}]
end



p1=sdpvar(n,n,'symmetric')
p2=sdpvar(n,n,'symmetric')
p3=sdpvar(n,n,'symmetric')
p4=sdpvar(n,n,'symmetric')
p5=sdpvar(n,n,'symmetric')
p6=sdpvar(n,n,'symmetric')
Omega=sdpvar(1,1,'symmetric')
p7=sdpvar(n,n,'symmetric')

%Omega1=sdpvar(3,3,'symmetric')
t=sdpvar(n,n,'full')
gam=sdpvar(1,1,'full')

M11=ze
M22=-p2-p4-p5
M33=-p5+t'+t-p5'
M44=-p3-p5
M55=-Omega*Omeg1
M66=-gam
M77=-1/tauM^2*(p6+p6')
M88=-1/(tauM^2-taum^2)*(p7+p7')
M99=-1/(tauM^2-taum^2)*(p7+p7')-1/tauM^2*(p6+p6')
M1010=-p4
M1111=-p5
M1212=-p6
M1313=-p7

%%%%%%%%%%%%% 1ST ROW
M12=p4
M13=ze
M14=ze
M15=ze1
M16=ze2
M17=1/tauM*(p6+p6')
M18=1/(tauM+taum)*(p7+p7')
M19=1/(tauM)*(p6+p6')+1/(tauM+taum)*(p7+p7')
M110=ze
M111=ze
M112=ze
M113=ze

%%%%%%%%%%%%%% 2ND ROW
M23=p5-t
M24=t
M25=ze1 
M26=ze2
M27=ze 
M28=ze
M29=ze
M210=ze 
M211=ze 
M212=ze
M213=ze

%%%%%%%%%%%% 3RD ROW
M34=-t+p5
M35=ze1
M36=ze2
M37=ze
M38=ze
M39=ze
M310=ze
M311=ze
M312=ze
M313=ze
%%%%%%%%%%%% 4TH ROW
%m44=-p3-p5;
M45=ze1
M46=ze2
M47=ze 
M48=ze
M49=ze
M410=ze
M411=ze
M412=ze
M413=ze

%%%%%%%%%%%% 5TH ROW
M56=ze3
M57=ze1'
M58=ze1'
M59=ze1'
M510=ze1'
M511=ze1'
M512=ze1'
M513=ze1'
%%%%%%%%%%%% 6TH ROW

M67=ze2'
M68=ze2'
M69=ze2'
M610=ze2'
M611=ze2'
M612=ze2'
M613=ze2'
%%%%%%%%%% 7TH ROW
M78=ze
M79=-1/tauM^2*(p6+p6')
M710=ze
M711=ze
M712=ze
M713=ze

%%%%%%%%%%%% 8th row
M89=-1/(tauM^2-taum^2)*(p7+p7')
M810=ze
M811=ze
M812=ze
M813=ze
%%%%%%%%%%%%% 9TH ROW
M910=ze
M911=ze
M912=ze
M913=ze

%%%%%%%%%%%%%%%%% 10TH ROW
M1011=ze
M1012=ze
M1013=ze

%%%%%%%%%%%%% 11TH ROW
M1112=ze
M1113=ze

%%%%%%%%%%%%% 12TH ROW
M1213=ze
%%%%%%%%%%% 13TH ROW

%2nd matrix
for k=1:2
    for l=1:2
m11{k,l}=p1*a{k,l}+a{k,l}'*p1+dC{k}+p2+p3-p4-p6-p6'-(tauM-taum)/(tauM+taum)*(p7+p7')
m110{k,l}=taum*a{k,l}'*p4
m111{k,l}=(tauM-taum)*a{k,l}'*p5
m112{k,l}=tauM/sqrt(2)*a{k,l}'*p6
m113{k,l}=sqrt(tauM^2-taum^2)/sqrt(2)*a{k,l}'*p7
    end
end
m22=ze
m44=ze
m55=ze4
m66=0
m77=ze
m88=ze
m99=ze
m1010=ze
m1111=ze
m1212=ze
m1313=ze

%%%%%%%%%%%%% 1ST ROW
m12=ze;
for l=1:2
m13{l}=p1*a{l}
m15{l}=p1*b{l}
m310{l}=taum*a{l}'*p4
m311{l}=(tauM-taum)*a{l}'*p5
m312{l}=tauM/sqrt(2)*a{l}'*p6
m313{l}=sqrt(tauM^2-taum^2)/sqrt(2)*a{l}'*p7
m510{l}=taum*b{l}'*p4
m511{l}=(tauM-taum)*b{l}'*p5
m512{l}=tauM/sqrt(2)*b{l}'*p6
m513{l}=sqrt(tauM^2-taum^2)/sqrt(2)*b{l}'*p7
end
for k=1:2
 m16{k}=p1*d{k}
 m610{k}=taum*d{k}'*p4
m611{k}=(tauM-taum)*d{k}'*p5
m612{k}=tauM/sqrt(2)*d{k}'*p6
m613{k}=sqrt(tauM^2-taum^2)/sqrt(2)*d{k}'*p7
m33{k}=Ome2{k}*rho*Omega*Ome2{k}'
end
m14=ze
m17=ze
m18=ze
m19=ze

%%%%%%%%%%%%%% 2ND ROW
m23=ze
m24=ze
m25=ze1
m26=ze2
m27=ze 
m28=ze
m29=ze
m210=ze 
m211=ze 
m212=ze
m213=ze

%%%%%%%%%%%% 3RD ROW
m34=ze
m35=ze1
m36=ze2
m37=ze
m38=ze
m39=ze

%%%%%%%%%%%% 4TH ROW
%m44=-p3-p5;
m45=ze1
m46=ze2
m47=ze 
m48=ze
m49=ze
m410=ze
m411=ze
m412=ze
m413=ze

%%%%%%%%%%%% 5TH ROW
m56=ze3
m57=ze1'
m58=ze1'
m59=ze1'


%%%%%%%%%%%% 6TH ROW

m67=ze2'
m68=ze2'
m69=ze2'

%%%%%%%%%% 7TH ROW
m78=ze
m79=ze
m710=ze
m711=ze
m712=ze
m713=ze

%%%%%%%%%%%% 8th row
m89=ze
m810=ze
m811=ze
m812=ze
m813=ze
%%%%%%%%%%%%% 9TH ROW
m910=ze
m911=ze
m912=ze
m913=ze

%%%%%%%%%%%%%%%%% 10TH ROW
m1011=ze
m1012=ze;
m1013=ze

%%%%%%%%%%%%% 11TH ROW
m1112=ze
m1113=ze

%%%%%%%%%%%%% 12TH ROW
m1213=ze
%%%%%%%%%%% 13TH ROW

for k=1:2
    for l=1:2
  Comi_LMI{k,l}=[m11{k,l}   m12   m13{l}   m14   m15{l}    m16{k}    m17   m18   m19   m110{k,l} m111{k,l}  m112{k,l} m113{k,l}
                 m12'       m22   m23      m24   m25       m26       m27   m28   m29   m210      m211       m212      m213
                 m13{l}'    m23'  m33{k}      m34   m35       m36       m37   m38   m39   m310{l}   m311{l}    m312{l}   m313{l}  
                 m14'       m24'  m34'     m44   m45       m46       m47   m48   m49   m410      m411       m412      m413
                 m15{l}'    m25'  m35'     m45'  m55       m56       m57   m58   m59   m510{l}   m511{l}    m512{l}   m513{l} 
                 m16{k}'    m26'  m36'     m46'  m56'      m66       m67   m68   m69   m610{k}   m611{k}    m612{k}   m613{k} 
                 m17'       m27'  m37'     m47'  m57'      m67'      m77   m78   m79   m710      m711       m712      m713 
                 m18'       m28'  m38'     m48'  m58'      m68'      m78'  m88   m89   m810      m811       m812      m813 
                 m19'       m29'  m39'     m49'  m59'      m69'      m79'  m89'  m99   m910      m911       m912      m913  
                 m110{k,l}' m210' m310{l}' m410' m510{l}'  m610{k}'  m710' m810' m910' m1010     m1011      m1012     m1013 
                 m111{k,l}' m211' m311{l}' m411' m511{l}'  m611{k}'  m711' m811' m911' m1011'    m1111      m1112     m1113  
                 m112{k,l}' m212' m312{l}' m412' m512{l}'  m612{k}'  m712' m812' m912' m1012'    m1112'     m1212     m1213 
                 m113{k,l}' m213' m313{l}' m413' m513{l}'  m613{k}'  m713' m813' m913' m1013'    m1113'     m1213'    m1313]     
    end
end

R=[ M11   M12   M13   M14   M15   M16   M17   M18   M19   M110   M111   M112   M113
    M12'  M22   M23   M24   M25   M26   M27   M28   M29   M210   M211   M212   M213
    M13'  M23'  M33   M34   M35   M36   M37   M38   M39   M310   M311   M312   M313
    M14'  M24'  M34'  M44   M45   M46   M47   M48   M49   M410   M411   M412   M413
    M15'  M25'  M35'  M45'  M55   M56   M57   M58   M59   M510   M511   M512   M513
    M16'  M26'  M36'  M46'  M56'  M66   M67   M68   M69   M610   M611   M612   M613
    M17'  M27'  M37'  M47'  M57'  M67'  M77   M78   M79   M710   M711   M712   M713
    M18'  M28'  M38'  M48'  M58'  M68'  M78'  M88   M89   M810   M811   M812   M813
    M19'  M29'  M39'  M49'  M59'  M69'  M79'  M89'  M99   M910   M911   M912   M913
    M110' M210' M310' M410' M510' M610' M710' M810' M910' M1010  M1011  M1012  M1013
    M111' M211' M311' M411' M511' M611' M711' M811' M911' M1011' M1111  M1112  M1113
    M112' M212' M312' M412' M512' M612' M712' M812' M912' M1012' M1112' M1212  M1213
    M113' M213' M313' M413' M513' M613' M713' M813' M913' M1013' M1113' M1213' M1313]
   
 for k=1:2
    for l=1:2
        Final_LMI{k,l}=Comi_LMI{k,l}+R
    end
end
 
 ineqs=[Final_LMI{1,1}<0, Final_LMI{1,2}<0, Final_LMI{2,2}<0, p1>0, p2>0, p3>0, p4>0, p5>0, p6>0, p7>0, Omega>0];


 opts=sdpsettings;
  opts.solver='sedumi';
 %ops = sdpsettings('solver','sedumi','sedumi.eps',1e-11);
  yalmipdiagnostics=solvesdp(ineqs,[],opts);
  yalmipdiagnostics;

gamma=double(sqrt(gam))
Omega=double(Omega)


My problem is with the message I am receiving - "  Dual infeasible, primal improving direction found. I have tried to scale the states with a matrix 





Johan Löfberg

unread,
Jan 19, 2018, 5:17:01 AM1/19/18
to YALMIP
as always, simplify simplify simplify.

Already the very first constraint you have is infeasible, so you are doomed from the start. Start there...

>> optimize(Final_LMI{1,1}<=0)
ans = 

  struct with fields:

    yalmiptime: 2.2495
    solvertime: 1.7085
          info: 'Infeasible problem (SDPT3-4)'
       problem: 1

sharmila svsas

unread,
Jan 19, 2018, 5:38:23 AM1/19/18
to YALMIP

Ok sir, but whatever I gave values in known matrices, same error appeared. So which type I want to apply values in that known matrices

Johan Löfberg

unread,
Jan 19, 2018, 6:30:23 AM1/19/18
to YALMIP
I have no idea what you are saying.

If you are saying it fails for any dynamical system you try, then it means the theory is wrong, or you have some severe severe bug in your implementation of the problem. We cannot solve that for you

sharmila svsas

unread,
Jan 20, 2018, 12:14:24 AM1/20/18
to YALMIP
I think my doubt is the following steps
Omega=sdpvar(1,1,'symmetric');
Omeg1=[1 0 0;0 0 0;0 0 0];
Omega1=Omega*Omeg1;
.
.
.
M55=-Omega1;
.
.
.
option1: Is the correct?
option 2: want I define Omega1=sdpvar(3,3,'symmetric');?
option 1 is correct means "Dual infeasible, primal improving direction found"
option 2 is correct means I get a feasibility

Johan Löfberg

unread,
Jan 20, 2018, 3:30:49 AM1/20/18
to YALMIP

sdpvar(1,1,'symmetric') is completely redundant as a scalar always is symmetric (and full).

Dual infeasible means the solver suspects there is no solution to the problem, it is infeasible

Placing the matrix Omega*Omeg1 as a diagonal block in a constraint is very bad. Since Omega1 has zeros on the diagonal, that means you are working with an LMI condition which has zeros in the diagonal, which is numerically ill-conditioned, as that implies that the corresponding rows and columns have to be exactly zero, so the feasible set has no interior. [a b;b 0]>=0 should really be written as a>=0, b==0 for numerical sanity
Reply all
Reply to author
Forward
0 new messages