Solver not applicable (logdetppa)

205 views
Skip to first unread message

Andreas Steimer

unread,
Nov 24, 2016, 10:24:26 AM11/24/16
to YALMIP

Hi all,

I am trying to implement the Latent Variable Graphical Model Selection Method of Chandrasekran et al. 2010, the objective of which can be solved by some Newton-CG primal proximal point algorithm.
Based on the following code, I have tested YALMIB for the sake of some toy example (based on some Covariance matrix S0), but to no avail so far:


lam = 0;
gam = 1;
K0 = sdpvar(2,2);
L = sdpvar(2,2);
S0 = sdpvar(2,2);
assign( S0, [1.6943 -0.1030; -0.1030 0.3980] );
constraints = [K0>=0, L>=0];

objective = trace( (K0-L)*S0 ) - logdet(K0-L) + lam*( gam*sum(abs(K0(:))) + trace(L) );
optimize( constraints, objective, sdpsettings('solver','logdetppa','debug',1) )



Execution of this piece of code just results in the error message 'Solver not applicable (logdetppa)'. Changing the solver to 'sdpt3' doesn't change the picture, except for 'logdetppa' being replaced by 'sdpt3'.
Do you have an idea why this is not working? Any help is appreciated...

best,

   Andreas

Johan Löfberg

unread,
Nov 24, 2016, 11:05:49 AM11/24/16
to YALMIP
your model is nonlinear nonconvex as you have bilinear product  trace( (K0-L)*S0 )

Andreas Steimer

unread,
Nov 24, 2016, 4:06:19 PM11/24/16
to YALMIP
Much thanks for your prompt reply.
What I don't understand is why expression 'trace( (K0-L)*S0 )' should be nonlinear. 'S0' is not a variable, it has been fixed in advance, thus no quadratic terms emerge in the trace. Also, the problem has been labeled as convex in Chandrasekarans original publication ('LATENT VARIABLE GRAPHICAL MODEL SELECTION VIA CONVEX OPTIMIZATION'), and a Newton-CG primal proximal point algorithm is claimed to be an efficient solver for it in Dauwels et al. 2011 ('Inferring Brain Networks through Graphical Models with Hidden Variables').
Thanks for your patience with someone unfamiliar with optimization algorithms...

best,

    Andreas

Johan Löfberg

unread,
Nov 24, 2016, 4:09:39 PM11/24/16
to YALMIP
Huh?

S0 = sdpvar(2,2);

hence, a decision variable

assign is a command to define an initial guess specified for some nonlinear solvers capable of using initial guesses

Andreas Steimer

unread,
Nov 24, 2016, 4:16:20 PM11/24/16
to YALMIP
Ah, I see...
Seems as if we are getting close to the core of the problem.
So how can I define fixed matrices then? I am new to YALMIP, so please excuse my ignorance...

Johan Löfberg

unread,
Nov 24, 2016, 4:26:55 PM11/24/16
to YALMIP
S0=[1.6943 -0.1030; -0.1030 0.3980]

yalmip is 99.99% standard matlab syntax

Andreas Steimer

unread,
Nov 24, 2016, 4:30:26 PM11/24/16
to YALMIP
Thanks Johan, seems you've made my day. Thumbs up...

Senaka Wijayakoon

unread,
Oct 2, 2018, 3:22:25 AM10/2/18
to YALMIP
Hi John 

Can you please tell me a non linear solver which can be used in YALMIP+MATLAB to solve non linear LMI as coded bellow. I have faced same problem for following code. I think in this code, term (alpha*P) makes an non linear situation (Highlighted yellow color).  

num=0.01;
den=[1 0.2 0.01];
G=tf(num,den);
SYS=ss(G);
A=SYS.A;
B=SYS.B;
C=SYS.C;

%Defining Matrix Variables

P=sdpvar(n);

F=sdpvar(1,1);

alpha=sdpvar(1);

%making a random symmetric positive definite matrix
n=length(A);
Q0 = rand(n,n);
Q0 = 0.5*(Q0+Q0');
Q0 = Q0 + n*eye(n);

        %solving Riccati equation to find X

        [X,L,GG] = care(A,B,Q0);

        %X is not a variable while P, alpha and F are matrix variables

        M11=(A'*P)+(P*A)-(X*B*B'*P)-(P*B*B'*X)+(X*B*B'*X)-(alpha*P);
        M12=((B'*P)+(F*C))';
        M21=(B'*P)+(F*C);
        M22=-eye(1,1);
        M=[M11 M12;M21 M22];

        %defining needed constraints

        constr = [(M<=0),(0<=P)];
        
        %select solver

        options = sdpsettings('solver','mosek');
        
        %solve LMI by minimizing alpha 

        optimize(constr,alpha,options);

Thank you




Johan Löfberg

unread,
Oct 2, 2018, 3:25:57 AM10/2/18
to YALMIP
First, calling something a nonlinear LMI makes no sense, 

Senaka Wijayakoon

unread,
Oct 2, 2018, 3:48:35 AM10/2/18
to YALMIP
Hello John 

Many thanks for your quick response 

I meant alpha and P are both matrix variables, their product (alpha*P) coming within the LMI matrix M is an non linear. That is why I thought it is an non linear component. Then why, solver like mosek is not applicable to minimize the value of alpha while considering LMI  [(M<=0),(0<=P)]???. If we set  P as a constant (ex:- P=[1 2;3 4]) then solver can minimize alpha properly for LMI (M<=0). When both become variables (P and alpha) this problem 'solver not applicable ' problem arises.

Thank you 

Johan Löfberg

unread,
Oct 2, 2018, 3:51:39 AM10/2/18
to YALMIP
It is nonlinear, but quasi-convex and can be solved precisely as described in the two articles.

It makes no sense to talk about a nonlinear linear matrix inequality. It's like talking about living dead people.

Senaka Wijayakoon

unread,
Oct 2, 2018, 4:41:39 AM10/2/18
to YALMIP
Many thanks John for your kind help 

Senaka Wijayakoon

unread,
Oct 4, 2018, 1:08:58 AM10/4/18
to YALMIP
Hello Johan 

I got a problem with function bisection. fault message is 'Failed to initialize bisection space (bisection)'. This is a non linear case due to alpha*P term. Can you tell me please the reason. Code is as follows 

Here Abar is a 12x12 matrix (not variable)
Bbar is a 12x2 matrix (not variable)
Cbar is a 6x12 matrix (not variable)
X is a 12x12 matrix (not variable)

Only P, F and alpha are variables as follows

P=sdpvar(12);
F=sdpvar(2,6);
alpha=sdpvar(1);


        %defining matrix to be test for LMI
        M11=(Abar'*P)+(P*Abar)-(X*Bbar*Bbar'*P)-(P*Bbar*Bbar'*X)+(X*Bbar*Bbar'*X)-(alpha*P);
        M12=((Bbar'*P)+(F*Cbar))';
        M21=(Bbar'*P)+(F*Cbar);
        [~,nc]=size(M12);
        [nr,~]=size(M21);
        M22=-eye(nr,nc);
        M=[M11 M12;M21 M22];
        
        %defining needed constraints
        constr = [(M<=0),(0<=P)];

        %select solver
        options = sdpsettings('solver','mosek');

        %solve LMI by minimizing alpha 
        diagnostics = bisection(constr,alpha,options)

Thank you

Johan Löfberg

unread,
Oct 4, 2018, 1:57:36 AM10/4/18
to YALMIP
For generic random data it works here

Abar = randn(12,12);Abar = Abar - 20*eye(12);
Bbar = randn(12,2);
Cbar = randn(6,12);
X = randn(12,12);X = X*X';

Your error message is issued if YALMIP tries to find an upper bound on alpha, but fails to do so (i.e. your specific problem is infeasible, YALMIP tries up to alpha = 1e6 but gives up if that is still infeasible, You can easily confirm this by using alpha 1e6 and see that it is infeasible)

Senaka Wijayakoon

unread,
Oct 4, 2018, 2:23:45 AM10/4/18
to YALMIP
Hi Johan 

Many thanks for your reply. 

But here alpha should be a variable. full code is as follows

num11=-0.37237;
den11=[0.0797 5.689 1 0];
G11=tf(num11,den11);
num12=0.019761;
den12=[301.091 27.693 1 0];
G12=tf(num12,den12);
num21=-0.2018;
den21=[6.315 4.5234 1 0];
G21=tf(num21,den21);
num22=-0.07345;
den22=[16.112 3.523 1 0];
G22=tf(num22,den22);
GMIMO=[G11 G12;G21 G22];
SYS=ss(GMIMO,'minimal');
A=SYS.A;
B=SYS.B;
C=SYS.C;

delta=0;

[~,l]=size(B);%no of inputs
[m,~]=size(C);%no of outputs

%making a random symmetric positive definite matrix
n=length(A);%no of states
Q0 = rand((n+m),(n+m));
Q0 = 0.5*(Q0+Q0');
Q0 = Q0 + (n+m)*eye(n+m);

P=sdpvar(n+m);
F=sdpvar(l,3*m);
alpha=sdpvar(1);

Abar=[A zeros(n,m);C zeros(m,m)];
Bbar=[B;zeros(m,l)];
C1=[C zeros(m,m)];
C2=[zeros(m,n) eye(m,m)];
C3=[(C*A) zeros(m,m)];
Cbar=[C1' C2' C3']';

        %solving Riccati equation
        [X,L,GG] = care(Abar,Bbar,Q0);
        
        %defining matrix to be test for LMI
        M11=(Abar'*P)+(P*Abar)-(X*Bbar*Bbar'*P)-(P*Bbar*Bbar'*X)+(X*Bbar*Bbar'*X)-(alpha*P);
        M12=((Bbar'*P)+(F*Cbar))';
        M21=(Bbar'*P)+(F*Cbar);
        [~,nc]=size(M12);
        [nr,~]=size(M21);
        M22=-eye(nr,nc);
        M=[M11 M12;M21 M22];
        
        %defining needed constraints
        constr = [(M<=0),(0<=P)];

        %select solver
        options = sdpsettings('solver','lmilab');

        %solve LMI by minimiying alpha 
        diagnostics = bisection(constr,alpha,options)

        alphasol=double(alpha)
        Fsol=double(F)

Can you please check this out

Thank you

Johan Löfberg

unread,
Oct 4, 2018, 2:31:51 AM10/4/18
to YALMIP
You cannot use lmilab. It lacks functionality so it cannot be used robustly with YALMIP, in particular in bisection where feasibility info is central.

The problem is easily solved using mosek or sdpt3 (problem appears numerically challenging for sedumi). Note that you are specifying the solver in the wrong way, so you have effectively not specified any solver

%select solver
options = sdpsettings('bisection.solver','mosek');

%solve LMI by minimiying alpha
diagnostics = bisection(constr,alpha,options)
Selected solver: MOSEK-SDP
Iteration  Lower bound    Test           Upper bound    Gap          Status at test
    1 :   -1.00000E+00   -5.00000E-01   -0.00000E+00    1.00000E+00  Successfully solved 
    2 :   -1.00000E+00   -7.50000E-01   -5.00000E-01    5.00000E-01  Infeasible problem 
    3 :   -7.50000E-01   -6.25000E-01   -5.00000E-01    2.50000E-01  Successfully solved 
    4 :   -7.50000E-01   -6.87500E-01   -6.25000E-01    1.25000E-01  Successfully solved 
    5 :   -7.50000E-01   -7.18750E-01   -6.87500E-01    6.25000E-02  Successfully solved 
    6 :   -7.50000E-01   -7.34375E-01   -7.18750E-01    3.12500E-02  Infeasible problem 
    7 :   -7.34375E-01   -7.26563E-01   -7.18750E-01    1.56250E-02  Infeasible problem 
    8 :   -7.26563E-01   -7.22656E-01   -7.18750E-01    7.81250E-03  Infeasible problem 
    9 :   -7.22656E-01   -7.20703E-01   -7.18750E-01    3.90625E-03  Successfully solved 
   10 :   -7.22656E-01   -7.21680E-01   -7.20703E-01    1.95313E-03  Successfully solved 
   11 :   -7.22656E-01   -7.22168E-01   -7.21680E-01    9.76563E-04  Successfully solved 
   12 :   -7.22656E-01   -7.22412E-01   -7.22168E-01    4.88281E-04  Successfully solved 
   13 :   -7.22656E-01   -7.22534E-01   -7.22412E-01    2.44141E-04  Successfully solved 
   14 :   -7.22656E-01   -7.22595E-01   -7.22534E-01    1.22070E-04  Successfully solved 
   15 :   -7.22656E-01   -7.22626E-01   -7.22595E-01    6.10352E-05  Successfully solved 
   16 :   -7.22656E-01   -7.22641E-01   -7.22626E-01    3.05176E-05  Successfully solved 
   17 :   -7.22656E-01   -7.22649E-01   -7.22641E-01    1.52588E-05  Unknown error (looks like failure)

diagnostics = 

  struct with fields:

    yalmiptime: 9.9626
    solvertime: 0.72323
          info: 'Successfully solved (bisection)'
       problem: 0



Senaka Wijayakoon

unread,
Oct 4, 2018, 3:48:04 AM10/4/18
to YALMIP
Hello Johan 

Thank you for your reply. Unfortunately I am having same message even after following your instructions. Can you please run this code in your machine to confirm what this problem is. Some time there may be a problem with MATLAB or MOSEK. Thank you.

 num11=-0.37237;
den11=[0.0797 5.689 1 0];
G11=tf(num11,den11);
num12=0.019761;
den12=[301.091 27.693 1 0];
G12=tf(num12,den12);
num21=-0.2018;
den21=[6.315 4.5234 1 0];
G21=tf(num21,den21);
num22=-0.07345;
den22=[16.112 3.523 1 0];
G22=tf(num22,den22);
GMIMO=[G11 G12;G21 G22];
SYS=ss(GMIMO,'minimal');
A=SYS.A;
B=SYS.B;
C=SYS.C;

delta=0;

%defining matrix variables
[~,l]=size(B);%no of inputs
[m,~]=size(C);%no of outputs

%making a random symmetric positive definite matrix
n=length(A);%no of states
Q0 = rand((n+m),(n+m));
Q0 = 0.5*(Q0+Q0');
Q0 = Q0 + (n+m)*eye(n+m);

P=sdpvar(n+m);
F=sdpvar(l,3*m);
alpha=sdpvar(1);

Abar=[A zeros(n,m);C zeros(m,m)];
Bbar=[B;zeros(m,l)];
C1=[C zeros(m,m)];
C2=[zeros(m,n) eye(m,m)];
C3=[(C*A) zeros(m,m)];
Cbar=[C1' C2' C3']';
>> [X,L,GG] = care(Abar,Bbar,Q0);
        
        %defining matrix to be test for LMI
        M11=(Abar'*P)+(P*Abar)-(X*Bbar*Bbar'*P)-(P*Bbar*Bbar'*X)+(X*Bbar*Bbar'*X)-(alpha*P);
        M12=((Bbar'*P)+(F*Cbar))';
        M21=(Bbar'*P)+(F*Cbar);
        [~,nc]=size(M12);
        [nr,~]=size(M21);
        M22=-eye(nr,nc);
        M=[M11 M12;M21 M22];
        
        %defining needed constraints
        constr = [(M<=0),(0<=P)];
        %select solver
        options = sdpsettings('bisection.solver','mosek');
        %solve LMI by minimiying alpha 
        diagnostics = bisection(constr,alpha,options);
>> diagnostics = bisection(constr,alpha,options)

diagnostics = 

  struct with fields:

    yalmiptime: 3.2690
    solvertime: 0.4814
          info: 'Failed to initialize bisection space (bisection)'
       problem: 21

Johan Löfberg

unread,
Oct 4, 2018, 3:51:27 AM10/4/18
to YALMIP
Solved easily

so
1. Are you using the latest version of YALMIP
2. Have you checked that mosek actually works

Senaka Wijayakoon

unread,
Oct 4, 2018, 4:01:23 AM10/4/18
to YALMIP
1. Yes I got the latest version from https://yalmip.github.io/download/

2. I believe mosek should work properly. Any way ,can you please tell me how to check mosek actually works. I am using a trial version of it.

Johan Löfberg

unread,
Oct 4, 2018, 4:02:51 AM10/4/18
to YALMIP
 mosekdiag

or simply run a trivial problem optimize(sdpvar(2)>=0,[],sdpsettings('solver','mosek'))

Senaka Wijayakoon

unread,
Oct 4, 2018, 4:10:16 AM10/4/18
to YALMIP
Please see highlighted warning
1. 
mosekdiag

Matlab version: 9.3.0.713579 (R2017b)
Architecture  : PCWIN64
The mosek optimizer executed successfully from the command line:

MOSEK Version 8.1.0.63 (Build date: 2018-9-5 20:39:09)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

FlexLM
 Version                  : 11.14
 Hostname                 : DedicatedMATLAB
 Host ID                  : 3417ebb5473d
 License path             : C:\Users\Bandara\mosek\mosek.lic

Operating system variables
 PATH                     :

*** No input file specfied. No optimization is performed.

Return code - 0  [MSK_RES_OK]

mosekopt: C:\Program Files\Mosek\8\toolbox\r2014a\mosekopt.mexw64
Found MOSEK version : major(8), minor(1), revision(63)
mosekopt is working correctly.
Warning: MOSEK Fusion is not configured correctly; check that mosek.jar is added to the javaclasspath. 
> In mosekdiag (line 85) 


2. 
 optimize(sdpvar(2)>=0,[],sdpsettings('solver','mosek'))

MOSEK Version 8.1.0.63 (Build date: 2018-9-5 20:39:09)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 3               
  Cones                  : 0               
  Scalar variables       : 0               
  Matrix variables       : 1               
  Integer variables      : 0               

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries                  : 1                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.00            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.03    
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 3               
  Cones                  : 0               
  Scalar variables       : 0               
  Matrix variables       : 1               
  Integer variables      : 0               

Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 3
Optimizer  - Cones                  : 0
Optimizer  - Scalar variables       : 0                 conic                  : 0               
Optimizer  - Semi-definite variables: 1                 scalarized             : 3               
Factor     - setup time             : 0.00              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 6                 after factor           : 6               
Factor     - dense dim.             : 0                 flops                  : 6.00e+01        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   1.0e+00  1.0e+00  1.0e+00  0.00e+00   0.000000000e+00   0.000000000e+00   1.0e+00  0.05  
1   0.0e+00  0.0e+00  0.0e+00  1.00e+00   0.000000000e+00   0.000000000e+00   0.0e+00  0.13  
Optimizer terminated. Time: 0.17    


Interior-point solution summary
  Problem status  : PRIMAL_AND_DUAL_FEASIBLE
  Solution status : OPTIMAL
  Primal.  obj: 0.0000000000e+00    nrm: 0e+00    Viol.  con: 0e+00    barvar: 0e+00  
  Dual.    obj: 0.0000000000e+00    nrm: 1e+00    Viol.  con: 0e+00    barvar: 0e+00  
Optimizer summary
  Optimizer                 -                        time: 0.17    
    Interior-point          - iterations : 1         time: 0.13    
      Basis identification  -                        time: 0.00    
        Primal              - iterations : 0         time: 0.00    
        Dual                - iterations : 0         time: 0.00    
        Clean primal        - iterations : 0         time: 0.00    
        Clean dual          - iterations : 0         time: 0.00    
    Simplex                 -                        time: 0.00    
      Primal simplex        - iterations : 0         time: 0.00    
      Dual simplex          - iterations : 0         time: 0.00    
    Mixed integer           - relaxations: 0         time: 0.00    


ans = 

  struct with fields:

    yalmiptime: 0.5069
    solvertime: 0.2801
          info: 'Successfully solved (MOSEK)'
       problem: 0

Johan Löfberg

unread,
Oct 4, 2018, 4:16:26 AM10/4/18
to YALMIP
Simply set alpha = 10 and solve problem using mosek with sdpsettings('solver','mosek','debug',1))

If that doesn't work, it is your mosek installation (although it looks fine).

If it does work, install develop version of YALMIP https://github.com/yalmip/YALMIP/archive/develop.zip which has improved error detection in bisection and see what happens

Senaka Wijayakoon

unread,
Oct 4, 2018, 8:25:20 AM10/4/18
to YALMIP
Hello Johan 

If we set alpha to a fix value as you have mentioned, then how is it optimized or minimized by the solver? because it is not a variable any more. Are you proposing to do it as an initial value of alpha?.  Any way I followed you and got an error message as shown at the end highlighted texts. 

% alpha=1e06;

Abar=[A zeros(n,m);C zeros(m,m)];
Bbar=[B;zeros(m,l)];
C1=[C zeros(m,m)];
C2=[zeros(m,n) eye(m,m)];
C3=[(C*A) zeros(m,m)];
Cbar=[C1' C2' C3']';
>> alpha=10;
>> [X,L,GG] = care(Abar,Bbar,Q0);
        
        %defining matrix to be test for LMI
        M11=(Abar'*P)+(P*Abar)-(X*Bbar*Bbar'*P)-(P*Bbar*Bbar'*X)+(X*Bbar*Bbar'*X)-(alpha*P);
        M12=((Bbar'*P)+(F*Cbar))';
        M21=(Bbar'*P)+(F*Cbar);
        [~,nc]=size(M12);
        [nr,~]=size(M21);
        M22=-eye(nr,nc);
        M=[M11 M12;M21 M22];
>> constr = [(M<=0),(0<=P)];

>> options=sdpsettings('solver','mosek','debug',1);
>> diagnostics = bisection(constr,alpha,options)

Undefined function or variable 'diagnostic'.

Error in bisection (line 47)
diagnostic.yalmiptime = toc(solvertime)-diagnostic.solvertime;

Johan Löfberg

unread,
Oct 4, 2018, 8:30:15 AM10/4/18
to YALMIP
It's not. The idea with that test is to see if mosek behaves as expected when you solve the type of problem which bisection will solve (the command bisection is just a convenient way to perform bisection over different fixed alpha)

You should fix alpha, and then solve the LMI using mosek in the test

diagnostics = optimize(constr,[],sdpsettings('solver','mosek','debug',1))

Senaka Wijayakoon

unread,
Oct 4, 2018, 8:54:20 AM10/4/18
to YALMIP
It shows an MOSEK error message which I have highlighted. Is this an expected result to confirm MOSEK works fine?
>> alpha=10;
>> Abar=[A zeros(n,m);C zeros(m,m)];
Bbar=[B;zeros(m,l)];
C1=[C zeros(m,m)];
C2=[zeros(m,n) eye(m,m)];
C3=[(C*A) zeros(m,m)];
Cbar=[C1' C2' C3']';
>>         [X,L,GG] = care(Abar,Bbar,Q0);
        
        %defining matrix to be test for LMI
        M11=(Abar'*P)+(P*Abar)-(X*Bbar*Bbar'*P)-(P*Bbar*Bbar'*X)+(X*Bbar*Bbar'*X)-(alpha*P);
        M12=((Bbar'*P)+(F*Cbar))';
        M21=(Bbar'*P)+(F*Cbar);
        [~,nc]=size(M12);
        [nr,~]=size(M21);
        M22=-eye(nr,nc);
        M=[M11 M12;M21 M22];
        
        %defining needed constraints
        constr = [(M<=0),(0<=P)];
>> diagnostics = optimize(constr,[],sdpsettings('solver','mosek','debug',1))

MOSEK Version 8.1.0.63 (Build date: 2018-9-5 20:39:09)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (13) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (27) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (41) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (55) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (69) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (83) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (97) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (111) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (125) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (139) of matrix 'A'.
Warning number 710 is disabled.
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 90              
  Cones                  : 0               
  Scalar variables       : 192             
  Matrix variables       : 1               
  Integer variables      : 0               

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator - tries                  : 0                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.00            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.01    
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 90              
  Cones                  : 0               
  Scalar variables       : 192             
  Matrix variables       : 1               
  Integer variables      : 0               

Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 86
Optimizer  - Cones                  : 0
Optimizer  - Scalar variables       : 126               conic                  : 0               
Optimizer  - Semi-definite variables: 1                 scalarized             : 78              
Factor     - setup time             : 0.00              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 3397              after factor           : 3489            
Factor     - dense dim.             : 0                 flops                  : 2.65e+05        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   1.0e+00  3.1e+02  1.0e+00  0.00e+00   0.000000000e+00   0.000000000e+00   1.0e+00  0.03  
1   2.5e-01  7.7e+01  1.7e-01  -7.52e-01  -9.901731528e+01  0.000000000e+00   2.5e-01  0.13  
2   8.1e-02  2.5e+01  4.3e-02  -3.00e-01  -1.969644101e+02  0.000000000e+00   8.1e-02  0.14  
3   2.5e-02  7.9e+00  7.8e-03  -8.78e-01  -6.503255977e+02  0.000000000e+00   2.5e-02  0.14  
4   9.1e-03  2.9e+00  2.4e-03  -3.67e-01  -8.825288711e+02  0.000000000e+00   9.1e-03  0.14  
5   3.6e-03  1.1e+00  2.5e-04  -1.08e+00  -1.360575615e+04  0.000000000e+00   3.6e-03  0.16  
6   1.2e-03  3.8e-01  3.8e-05  -4.08e+00  -6.379551555e+04  0.000000000e+00   1.2e-03  0.16  
7   2.8e-04  8.7e-02  2.4e-06  -1.83e+00  -8.863934052e+05  0.000000000e+00   2.8e-04  0.16  
8   7.2e-05  2.3e-02  2.0e-07  -1.95e+00  -8.273406207e+06  0.000000000e+00   7.2e-05  0.16  
9   1.7e-05  5.4e-03  1.6e-08  -1.46e+00  -7.119027889e+07  0.000000000e+00   1.7e-05  0.17  
10  4.6e-06  1.4e-03  1.9e-09  -1.26e+00  -3.799101659e+08  0.000000000e+00   4.6e-06  0.17  
11  1.8e-06  5.6e-04  6.1e-10  -8.30e-01  -5.532210869e+08  0.000000000e+00   1.8e-06  0.17  
12  6.6e-07  2.1e-04  1.7e-10  -2.46e-01  -9.190285271e+08  0.000000000e+00   6.6e-07  0.19  
13  2.1e-07  6.6e-05  2.8e-11  -9.45e-01  -3.584415396e+09  0.000000000e+00   2.1e-07  0.19  
14  7.3e-08  2.3e-05  6.1e-12  -8.05e-01  -9.116274483e+09  0.000000000e+00   7.3e-08  0.19  
15  1.8e-08  5.6e-06  9.5e-13  -8.35e-01  -2.281883015e+10  0.000000000e+00   1.8e-08  0.20  
16  5.2e-09  1.6e-06  4.2e-13  2.09e-01   -1.013021135e+10  0.000000000e+00   5.2e-09  0.20  
17  1.1e-09  3.3e-07  1.0e-13  2.50e-01   -7.159577313e+09  0.000000000e+00   1.1e-09  0.20  
18  2.1e-10  6.6e-08  2.2e-14  1.51e-01   -6.052861787e+09  0.000000000e+00   2.1e-10  0.20  
19  9.2e-11  1.3e-08  4.1e-15  6.02e-02   -6.390099457e+09  0.000000000e+00   4.1e-11  0.22  
20  3.6e-11  5.8e-09  1.7e-15  -6.28e-02  -7.952910325e+09  0.000000000e+00   1.8e-11  0.22  
21  1.1e-11  1.8e-09  5.6e-16  -1.87e-01  -7.110307001e+09  0.000000000e+00   5.9e-12  0.22  
22  4.4e-12  1.7e-09  2.2e-16  4.77e-02   -8.090430353e+09  0.000000000e+00   2.5e-12  0.22  
23  3.4e-12  2.4e-08  5.9e-17  -1.02e-01  -7.371693747e+09  0.000000000e+00   6.3e-13  0.23  
24  1.5e-12  1.3e-07  2.1e-17  6.21e-02   -8.085751516e+09  0.000000000e+00   2.4e-13  0.23  
25  8.0e-13  2.6e-07  6.6e-18  -2.91e-02  -7.176227852e+09  0.000000000e+00   7.0e-14  0.23  
26  3.6e-13  1.6e-06  2.7e-18  2.57e-02   -8.322343047e+09  0.000000000e+00   3.1e-14  0.23  
27  3.1e-13  2.8e-06  2.2e-18  -1.14e-01  -8.278395653e+09  0.000000000e+00   2.5e-14  0.25  
28  1.7e-13  1.1e-06  5.6e-19  -7.28e-02  -7.871800871e+09  0.000000000e+00   6.3e-15  0.25  
29  1.6e-13  1.3e-06  4.0e-19  6.42e-02   -7.900009206e+09  0.000000000e+00   4.4e-15  0.25  
30  1.2e-13  1.1e-05  3.2e-19  3.06e-02   -7.908911972e+09  0.000000000e+00   3.6e-15  0.27  
31  5.6e-14  4.5e-06  7.8e-20  2.11e-02   -8.013703746e+09  0.000000000e+00   8.8e-16  0.27  
32  5.5e-14  3.5e-06  7.6e-20  -4.01e-02  -8.012899301e+09  0.000000000e+00   8.6e-16  0.27  
33  5.5e-14  3.5e-06  7.6e-20  -3.84e-02  -8.012899301e+09  0.000000000e+00   8.6e-16  0.27  
Optimizer terminated. Time: 0.34    


MOSEK DUAL INFEASIBILITY REPORT.

Problem status: The problem is dual infeasible

Interior-point solution summary
  Problem status  : DUAL_INFEASIBLE
  Solution status : DUAL_INFEASIBLE_CER
  Primal.  obj: -2.1429681939e-02   nrm: 8e+01    Viol.  con: 2e-11    var: 2e-14    barvar: 0e+00  
Optimizer summary
  Optimizer                 -                        time: 0.34    
    Interior-point          - iterations : 34        time: 0.28    
      Basis identification  -                        time: 0.00    
        Primal              - iterations : 0         time: 0.00    
        Dual                - iterations : 0         time: 0.00    
        Clean primal        - iterations : 0         time: 0.00    
        Clean dual          - iterations : 0         time: 0.00    
    Simplex                 -                        time: 0.00    
      Primal simplex        - iterations : 0         time: 0.00    
      Dual simplex          - iterations : 0         time: 0.00    
    Mixed integer           - relaxations: 0         time: 0.00    

Mosek error: MSK_RES_TRM_STALL ()

diagnostics = 

  struct with fields:

    yalmiptime: 0.4835
    solvertime: 0.5155
          info: 'Infeasible problem (MOSEK)'
       problem: 1

Johan Löfberg

unread,
Oct 4, 2018, 9:02:36 AM10/4/18
to YALMIP
I have no idea why it is infeasible on your machine

run
diagnostics = optimize(constr,[],sdpsettings('solver','mosek','debug',1,'savedebug'))

and send the file mosekdebug.mat to me

Johan Löfberg

unread,
Oct 4, 2018, 9:04:01 AM10/4/18
to YALMIP
'savedebug',1


Johan Löfberg

unread,
Oct 4, 2018, 9:21:17 AM10/4/18
to YALMIP
Also run once with presolve turned off

diagnostics = optimize(constr,[],sdpsettings('solver','mosek','debug',1,'mosek.MSK_IPAR_PRESOLVE_USE','MSK_OFF'))

to see if it is a presolve bug in your mosek version (the reduced model size is not the same in your model as in mine as displayed by mosek)

Johan Löfberg

unread,
Oct 4, 2018, 9:33:22 AM10/4/18
to YALMIP
you can also test with numerical noise eliminated, to see if that is causing some weird issue in your mosek version

constr = [(clean(M,1e-6)<=0),(0<=P)];

Senaka Wijayakoon

unread,
Oct 4, 2018, 9:33:39 AM10/4/18
to YALMIP
diagnostics = optimize(constr,[],sdpsettings('solver','mosek','debug',1,'savedebug',1))
Presolve terminated. Time: 0.00    
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 90              
  Cones                  : 0               
  Scalar variables       : 192             
  Matrix variables       : 1               
  Integer variables      : 0               

Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 86
Optimizer  - Cones                  : 0
Optimizer  - Scalar variables       : 126               conic                  : 0               
Optimizer  - Semi-definite variables: 1                 scalarized             : 78              
Factor     - setup time             : 0.00              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 3397              after factor           : 3489            
Factor     - dense dim.             : 0                 flops                  : 2.65e+05        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   1.0e+00  3.1e+02  1.0e+00  0.00e+00   0.000000000e+00   0.000000000e+00   1.0e+00  0.03  
1   2.5e-01  7.7e+01  1.7e-01  -7.52e-01  -9.901731528e+01  0.000000000e+00   2.5e-01  0.11  
2   8.1e-02  2.5e+01  4.3e-02  -3.00e-01  -1.969644101e+02  0.000000000e+00   8.1e-02  0.11  
3   2.5e-02  7.9e+00  7.8e-03  -8.78e-01  -6.503255977e+02  0.000000000e+00   2.5e-02  0.11  
4   9.1e-03  2.9e+00  2.4e-03  -3.67e-01  -8.825288711e+02  0.000000000e+00   9.1e-03  0.13  
5   3.6e-03  1.1e+00  2.5e-04  -1.08e+00  -1.360575615e+04  0.000000000e+00   3.6e-03  0.13  
6   1.2e-03  3.8e-01  3.8e-05  -4.08e+00  -6.379551555e+04  0.000000000e+00   1.2e-03  0.13  
7   2.8e-04  8.7e-02  2.4e-06  -1.83e+00  -8.863934052e+05  0.000000000e+00   2.8e-04  0.13  
8   7.2e-05  2.3e-02  2.0e-07  -1.95e+00  -8.273406207e+06  0.000000000e+00   7.2e-05  0.14  
9   1.7e-05  5.4e-03  1.6e-08  -1.46e+00  -7.119027889e+07  0.000000000e+00   1.7e-05  0.14  
10  4.6e-06  1.4e-03  1.9e-09  -1.26e+00  -3.799101659e+08  0.000000000e+00   4.6e-06  0.14  
11  1.8e-06  5.6e-04  6.1e-10  -8.30e-01  -5.532210869e+08  0.000000000e+00   1.8e-06  0.14  
12  6.6e-07  2.1e-04  1.7e-10  -2.46e-01  -9.190285271e+08  0.000000000e+00   6.6e-07  0.14  
13  2.1e-07  6.6e-05  2.8e-11  -9.45e-01  -3.584415396e+09  0.000000000e+00   2.1e-07  0.16  
14  7.3e-08  2.3e-05  6.1e-12  -8.05e-01  -9.116274483e+09  0.000000000e+00   7.3e-08  0.16  
15  1.8e-08  5.6e-06  9.5e-13  -8.35e-01  -2.281883015e+10  0.000000000e+00   1.8e-08  0.16  
16  5.2e-09  1.6e-06  4.2e-13  2.09e-01   -1.013021135e+10  0.000000000e+00   5.2e-09  0.16  
17  1.1e-09  3.3e-07  1.0e-13  2.50e-01   -7.159577313e+09  0.000000000e+00   1.1e-09  0.17  
18  2.1e-10  6.6e-08  2.2e-14  1.51e-01   -6.052861787e+09  0.000000000e+00   2.1e-10  0.17  
19  9.2e-11  1.3e-08  4.1e-15  6.02e-02   -6.390099457e+09  0.000000000e+00   4.1e-11  0.17  
20  3.6e-11  5.8e-09  1.7e-15  -6.28e-02  -7.952910325e+09  0.000000000e+00   1.8e-11  0.17  
21  1.1e-11  1.8e-09  5.6e-16  -1.87e-01  -7.110307001e+09  0.000000000e+00   5.9e-12  0.19  
22  4.4e-12  1.7e-09  2.2e-16  4.77e-02   -8.090430353e+09  0.000000000e+00   2.5e-12  0.19  
23  3.4e-12  2.4e-08  5.9e-17  -1.02e-01  -7.371693747e+09  0.000000000e+00   6.3e-13  0.19  
24  1.5e-12  1.3e-07  2.1e-17  6.21e-02   -8.085751516e+09  0.000000000e+00   2.4e-13  0.19  
25  8.0e-13  2.6e-07  6.6e-18  -2.91e-02  -7.176227852e+09  0.000000000e+00   7.0e-14  0.20  
26  3.6e-13  1.6e-06  2.7e-18  2.57e-02   -8.322343047e+09  0.000000000e+00   3.1e-14  0.20  
27  3.1e-13  2.8e-06  2.2e-18  -1.14e-01  -8.278395653e+09  0.000000000e+00   2.5e-14  0.20  
28  1.7e-13  1.1e-06  5.6e-19  -7.28e-02  -7.871800871e+09  0.000000000e+00   6.3e-15  0.20  
29  1.6e-13  1.3e-06  4.0e-19  6.42e-02   -7.900009206e+09  0.000000000e+00   4.4e-15  0.22  
30  1.2e-13  1.1e-05  3.2e-19  3.06e-02   -7.908911972e+09  0.000000000e+00   3.6e-15  0.22  
31  5.6e-14  4.5e-06  7.8e-20  2.11e-02   -8.013703746e+09  0.000000000e+00   8.8e-16  0.22  
32  5.5e-14  3.5e-06  7.6e-20  -4.01e-02  -8.012899301e+09  0.000000000e+00   8.6e-16  0.22  
33  5.5e-14  3.5e-06  7.6e-20  -3.84e-02  -8.012899301e+09  0.000000000e+00   8.6e-16  0.23  
Optimizer terminated. Time: 0.28    


MOSEK DUAL INFEASIBILITY REPORT.

Problem status: The problem is dual infeasible

Interior-point solution summary
  Problem status  : DUAL_INFEASIBLE
  Solution status : DUAL_INFEASIBLE_CER
  Primal.  obj: -2.1429681939e-02   nrm: 8e+01    Viol.  con: 2e-11    var: 2e-14    barvar: 0e+00  
Optimizer summary
  Optimizer                 -                        time: 0.28    
    Interior-point          - iterations : 34        time: 0.23    
      Basis identification  -                        time: 0.00    
        Primal              - iterations : 0         time: 0.00    
        Dual                - iterations : 0         time: 0.00    
        Clean primal        - iterations : 0         time: 0.00    
        Clean dual          - iterations : 0         time: 0.00    
    Simplex                 -                        time: 0.00    
      Primal simplex        - iterations : 0         time: 0.00    
      Dual simplex          - iterations : 0         time: 0.00    
    Mixed integer           - relaxations: 0         time: 0.00    

Mosek error: MSK_RES_TRM_STALL ()

diagnostics = 

  struct with fields:

    yalmiptime: 0.1717
    solvertime: 0.4383

Senaka Wijayakoon

unread,
Oct 4, 2018, 9:34:15 AM10/4/18
to YALMIP
diagnostics = optimize(constr,[],sdpsettings('solver','mosek','debug',1,'mosek.MSK_IPAR_PRESOLVE_USE','MSK_OFF'))

MOSEK Version 8.1.0.63 (Build date: 2018-9-5 20:39:09)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (13) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (27) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (41) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (55) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (69) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (83) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (97) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (111) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (125) of matrix 'A'.
MOSEK warning 710: #8 (nearly) zero elements are specified in sparse col '' (139) of matrix 'A'.
Warning number 710 is disabled.
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 90              
  Cones                  : 0               
  Scalar variables       : 192             
  Matrix variables       : 1               
  Integer variables      : 0               

Optimizer started.
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 90              
  Cones                  : 0               
  Scalar variables       : 192             
  Matrix variables       : 1               
  Integer variables      : 0               

Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 90
Optimizer  - Cones                  : 0
Optimizer  - Scalar variables       : 192               conic                  : 0               
Optimizer  - Semi-definite variables: 1                 scalarized             : 78              
Factor     - setup time             : 0.00              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 3425              after factor           : 3517            
Factor     - dense dim.             : 0                 flops                  : 2.87e+05        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   1.0e+00  3.1e+02  1.0e+00  0.00e+00   0.000000000e+00   0.000000000e+00   1.0e+00  0.00  
1   2.5e-01  7.7e+01  1.6e-01  -7.63e-01  -1.061587819e+02  0.000000000e+00   2.5e-01  0.08  
2   7.0e-02  2.2e+01  2.7e-02  -5.35e-01  -3.880956347e+02  0.000000000e+00   7.0e-02  0.08  
3   2.6e-02  8.2e+00  9.9e-03  -7.91e-01  -4.243182677e+02  0.000000000e+00   2.6e-02  0.09  
4   1.0e-02  3.1e+00  2.6e-03  -7.94e-01  -9.621393714e+02  0.000000000e+00   1.0e-02  0.09  
5   7.4e-03  2.3e+00  7.8e-04  -2.21e+00  -5.715806511e+03  0.000000000e+00   7.4e-03  0.09  
6   2.4e-03  7.6e-01  6.8e-05  -2.46e+00  -8.050309727e+04  0.000000000e+00   2.4e-03  0.09  
7   6.5e-04  2.0e-01  6.1e-06  -2.30e+00  -7.224217332e+05  0.000000000e+00   6.5e-04  0.11  
8   1.6e-04  5.1e-02  4.3e-07  -2.05e+00  -9.328227409e+06  0.000000000e+00   1.6e-04  0.11  
9   5.1e-05  1.6e-02  5.9e-08  -1.64e+00  -4.829035717e+07  0.000000000e+00   5.1e-05  0.11  
10  1.5e-05  4.8e-03  7.8e-09  -1.43e+00  -2.514049506e+08  0.000000000e+00   1.5e-05  0.11  
11  4.9e-06  1.5e-03  1.3e-09  -1.15e+00  -8.807231927e+08  0.000000000e+00   4.9e-06  0.11  
12  3.3e-06  1.0e-03  9.4e-10  -6.09e-01  -8.039379072e+08  0.000000000e+00   3.3e-06  0.13  
13  9.8e-07  3.1e-04  2.4e-10  -3.38e-01  -1.102187333e+09  0.000000000e+00   9.8e-07  0.13  
14  2.6e-07  8.1e-05  2.5e-11  -8.70e-01  -6.694300969e+09  0.000000000e+00   2.6e-07  0.13  
15  7.8e-08  2.4e-05  4.0e-12  -9.10e-01  -2.463405605e+10  0.000000000e+00   7.8e-08  0.13  
16  2.1e-08  6.7e-06  8.9e-13  -7.77e-01  -3.690234286e+10  0.000000000e+00   2.1e-08  0.14  
17  6.2e-09  1.9e-06  3.9e-13  2.80e-01   -1.590550774e+10  0.000000000e+00   6.2e-09  0.14  
18  1.3e-09  4.0e-07  9.2e-14  2.31e-01   -1.254932796e+10  0.000000000e+00   1.3e-09  0.14  
19  3.0e-10  9.2e-08  2.3e-14  1.33e-01   -1.032004736e+10  0.000000000e+00   3.0e-10  0.14  
20  8.2e-11  2.0e-08  4.9e-15  4.76e-02   -1.124146814e+10  0.000000000e+00   6.5e-11  0.16  
21  4.8e-11  5.2e-09  1.1e-15  -8.92e-02  -1.523020755e+10  0.000000000e+00   1.7e-11  0.16  
22  2.1e-11  2.3e-09  4.3e-16  -6.67e-02  -1.837133685e+10  0.000000000e+00   7.3e-12  0.16  
23  1.5e-11  1.7e-08  1.5e-16  -9.03e-02  -1.546624873e+10  0.000000000e+00   2.3e-12  0.16  
24  8.1e-12  9.2e-08  5.6e-17  5.83e-02   -1.797804112e+10  0.000000000e+00   9.4e-13  0.17  
25  2.7e-12  3.4e-07  1.8e-17  2.60e-04   -1.556042319e+10  0.000000000e+00   2.8e-13  0.17  
26  9.0e-13  3.9e-07  6.8e-18  3.83e-02   -1.810763150e+10  0.000000000e+00   1.2e-13  0.17  
27  2.1e-13  8.9e-07  2.2e-18  1.82e-02   -1.573383068e+10  0.000000000e+00   3.4e-14  0.17  
Optimizer terminated. Time: 0.23    


MOSEK DUAL INFEASIBILITY REPORT.

Problem status: The problem is dual infeasible

Interior-point solution summary
  Problem status  : DUAL_INFEASIBLE
  Solution status : DUAL_INFEASIBLE_CER
  Primal.  obj: -1.8066541375e-01   nrm: 6e+01    Viol.  con: 1e-10    var: 9e-13    barvar: 0e+00  
Optimizer summary
  Optimizer                 -                        time: 0.23    
    Interior-point          - iterations : 27        time: 0.19    
      Basis identification  -                        time: 0.00    
        Primal              - iterations : 0         time: 0.00    
        Dual                - iterations : 0         time: 0.00    
        Clean primal        - iterations : 0         time: 0.00    
        Clean dual          - iterations : 0         time: 0.00    
    Simplex                 -                        time: 0.00    
      Primal simplex        - iterations : 0         time: 0.00    
      Dual simplex          - iterations : 0         time: 0.00    
    Mixed integer           - relaxations: 0         time: 0.00    


diagnostics = 

  struct with fields:

    yalmiptime: 0.1229
    solvertime: 0.3801

Senaka Wijayakoon

unread,
Oct 4, 2018, 9:37:48 AM10/4/18
to YALMIP
constr = [(clean(M,1e-6)<=0),(0<=P)];
>> diagnostics = optimize(constr,[],sdpsettings('solver','mosek','debug',1,'savedebug',1))

MOSEK Version 8.1.0.63 (Build date: 2018-9-5 20:39:09)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 90              
  Cones                  : 0               
  Scalar variables       : 192             
  Matrix variables       : 1               
  Integer variables      : 0               

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator - tries                  : 0                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.00            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.02    
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 90              
  Cones                  : 0               
  Scalar variables       : 192             
  Matrix variables       : 1               
  Integer variables      : 0               

Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 86
Optimizer  - Cones                  : 0
Optimizer  - Scalar variables       : 126               conic                  : 0               
Optimizer  - Semi-definite variables: 1                 scalarized             : 78              
Factor     - setup time             : 0.00              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 3397              after factor           : 3489            
Factor     - dense dim.             : 0                 flops                  : 2.65e+05        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   1.0e+00  3.1e+02  1.0e+00  0.00e+00   0.000000000e+00   0.000000000e+00   1.0e+00  0.03  
1   2.5e-01  7.7e+01  1.7e-01  -7.52e-01  -9.901731528e+01  0.000000000e+00   2.5e-01  0.11  
2   8.1e-02  2.5e+01  4.3e-02  -3.00e-01  -1.969644101e+02  0.000000000e+00   8.1e-02  0.11  
3   2.5e-02  7.9e+00  7.8e-03  -8.78e-01  -6.503255977e+02  0.000000000e+00   2.5e-02  0.11  
4   9.1e-03  2.9e+00  2.4e-03  -3.67e-01  -8.825288711e+02  0.000000000e+00   9.1e-03  0.13  
5   3.6e-03  1.1e+00  2.5e-04  -1.08e+00  -1.360575615e+04  0.000000000e+00   3.6e-03  0.13  
6   1.2e-03  3.8e-01  3.8e-05  -4.08e+00  -6.379551555e+04  0.000000000e+00   1.2e-03  0.13  
7   2.8e-04  8.7e-02  2.4e-06  -1.83e+00  -8.863934052e+05  0.000000000e+00   2.8e-04  0.13  
8   7.2e-05  2.3e-02  2.0e-07  -1.95e+00  -8.273406207e+06  0.000000000e+00   7.2e-05  0.13  
MOSEK DUAL INFEASIBILITY REPORT.

Problem status: The problem is dual infeasible

Interior-point solution summary
  Problem status  : DUAL_INFEASIBLE
  Solution status : DUAL_INFEASIBLE_CER
  Primal.  obj: -2.1429681939e-02   nrm: 8e+01    Viol.  con: 2e-11    var: 2e-14    barvar: 0e+00  
Optimizer summary
  Optimizer                 -                        time: 0.28    
    Interior-point          - iterations : 34        time: 0.23    
      Basis identification  -                        time: 0.00    
        Primal              - iterations : 0         time: 0.00    
        Dual                - iterations : 0         time: 0.00    
        Clean primal        - iterations : 0         time: 0.00    
        Clean dual          - iterations : 0         time: 0.00    
    Simplex                 -                        time: 0.00    
      Primal simplex        - iterations : 0         time: 0.00    
      Dual simplex          - iterations : 0         time: 0.00    
    Mixed integer           - relaxations: 0         time: 0.00    

Mosek error: MSK_RES_TRM_STALL ()

diagnostics = 

  struct with fields:

    yalmiptime: 0.1439
    solvertime: 0.3991

Johan Löfberg

unread,
Oct 4, 2018, 9:38:46 AM10/4/18
to YALMIP
you were supposed to send the file mosekdebug.mat to me

Senaka Wijayakoon

unread,
Oct 4, 2018, 9:39:24 AM10/4/18
to YALMIP
 constr = [(clean(M,1e-6)<=0),(0<=P)];
>> diagnostics = optimize(constr,[],sdpsettings('solver','mosek','debug',1,'mosek.MSK_IPAR_PRESOLVE_USE','MSK_OFF'))

MOSEK Version 8.1.0.63 (Build date: 2018-9-5 20:39:09)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 90              
  Cones                  : 0               
  Scalar variables       : 192             
  Matrix variables       : 1               
  Integer variables      : 0               

Optimizer started.
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 90              
  Cones                  : 0               
  Scalar variables       : 192             
  Matrix variables       : 1               
  Integer variables      : 0               

Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 90
Optimizer  - Cones                  : 0
Optimizer  - Scalar variables       : 192               conic                  : 0               
Optimizer  - Semi-definite variables: 1                 scalarized             : 78              
Factor     - setup time             : 0.00              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 3425              after factor           : 3517            
Factor     - dense dim.             : 0                 flops                  : 2.87e+05        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   1.0e+00  3.1e+02  1.0e+00  0.00e+00   0.000000000e+00   0.000000000e+00   1.0e+00  0.00  
1   2.5e-01  7.7e+01  1.6e-01  -7.63e-01  -1.061587819e+02  0.000000000e+00   2.5e-01  0.09  
2   7.0e-02  2.2e+01  2.7e-02  -5.35e-01  -3.880956347e+02  0.000000000e+00   7.0e-02  0.09  
3   2.6e-02  8.2e+00  9.9e-03  -7.91e-01  -4.243182677e+02  0.000000000e+00   2.6e-02  0.09  
4   1.0e-02  3.1e+00  2.6e-03  -7.94e-01  -9.621393714e+02  0.000000000e+00   1.0e-02  0.09  
5   7.4e-03  2.3e+00  7.8e-04  -2.21e+00  -5.715806511e+03  0.000000000e+00   7.4e-03  0.11  
6   2.4e-03  7.6e-01  6.8e-05  -2.46e+00  -8.050309727e+04  0.000000000e+00   2.4e-03  0.11  
7   6.5e-04  2.0e-01  6.1e-06  -2.30e+00  -7.224217332e+05  0.000000000e+00   6.5e-04  0.11  
8   1.6e-04  5.1e-02  4.3e-07  -2.05e+00  -9.328227409e+06  0.000000000e+00   1.6e-04  0.11  
9   5.1e-05  1.6e-02  5.9e-08  -1.64e+00  -4.829035717e+07  0.000000000e+00   5.1e-05  0.11  
10  1.5e-05  4.8e-03  7.8e-09  -1.43e+00  -2.514049506e+08  0.000000000e+00   1.5e-05  0.13  
11  4.9e-06  1.5e-03  1.3e-09  -1.15e+00  -8.807231927e+08  0.000000000e+00   4.9e-06  0.13  
12  3.3e-06  1.0e-03  9.4e-10  -6.09e-01  -8.039379072e+08  0.000000000e+00   3.3e-06  0.13  
13  9.8e-07  3.1e-04  2.4e-10  -3.38e-01  -1.102187333e+09  0.000000000e+00   9.8e-07  0.14  
14  2.6e-07  8.1e-05  2.5e-11  -8.70e-01  -6.694300969e+09  0.000000000e+00   2.6e-07  0.14  
15  7.8e-08  2.4e-05  4.0e-12  -9.10e-01  -2.463405605e+10  0.000000000e+00   7.8e-08  0.14  
16  2.1e-08  6.7e-06  8.9e-13  -7.77e-01  -3.690234286e+10  0.000000000e+00   2.1e-08  0.14  
17  6.2e-09  1.9e-06  3.9e-13  2.80e-01   -1.590550774e+10  0.000000000e+00   6.2e-09  0.14  
18  1.3e-09  4.0e-07  9.2e-14  2.31e-01   -1.254932796e+10  0.000000000e+00   1.3e-09  0.16  
19  3.0e-10  9.2e-08  2.3e-14  1.33e-01   -1.032004736e+10  0.000000000e+00   3.0e-10  0.16  
20  8.2e-11  2.0e-08  4.9e-15  4.76e-02   -1.124146814e+10  0.000000000e+00   6.5e-11  0.16  
21  4.8e-11  5.2e-09  1.1e-15  -8.92e-02  -1.523020755e+10  0.000000000e+00   1.7e-11  0.16  
22  2.1e-11  2.3e-09  4.3e-16  -6.67e-02  -1.837133685e+10  0.000000000e+00   7.3e-12  0.17  
23  1.5e-11  1.7e-08  1.5e-16  -9.03e-02  -1.546624873e+10  0.000000000e+00   2.3e-12  0.17  
24  8.1e-12  9.2e-08  5.6e-17  5.83e-02   -1.797804112e+10  0.000000000e+00   9.4e-13  0.17  
25  2.7e-12  3.4e-07  1.8e-17  2.60e-04   -1.556042319e+10  0.000000000e+00   2.8e-13  0.17  
26  9.0e-13  3.9e-07  6.8e-18  3.83e-02   -1.810763150e+10  0.000000000e+00   1.2e-13  0.19  
27  2.1e-13  8.9e-07  2.2e-18  1.82e-02   -1.573383068e+10  0.000000000e+00   3.4e-14  0.19  
Optimizer terminated. Time: 0.23    


MOSEK DUAL INFEASIBILITY REPORT.

Problem status: The problem is dual infeasible

Interior-point solution summary
  Problem status  : DUAL_INFEASIBLE
  Solution status : DUAL_INFEASIBLE_CER
  Primal.  obj: -1.8066541375e-01   nrm: 6e+01    Viol.  con: 1e-10    var: 9e-13    barvar: 0e+00  
Optimizer summary
  Optimizer                 -                        time: 0.23    
    Interior-point          - iterations : 27        time: 0.19    
      Basis identification  -                        time: 0.00    
        Primal              - iterations : 0         time: 0.00    
        Dual                - iterations : 0         time: 0.00    
        Clean primal        - iterations : 0         time: 0.00    
        Clean dual          - iterations : 0         time: 0.00    
    Simplex                 -                        time: 0.00    
      Primal simplex        - iterations : 0         time: 0.00    
      Dual simplex          - iterations : 0         time: 0.00    
    Mixed integer           - relaxations: 0         time: 0.00    


diagnostics = 

  struct with fields:

    yalmiptime: 0.0719
    solvertime: 0.3531

Senaka Wijayakoon

unread,
Oct 4, 2018, 9:47:20 AM10/4/18
to YALMIP
Thank you lot
mosekdebug.mat

Johan Löfberg

unread,
Oct 4, 2018, 9:54:41 AM10/4/18
to YALMIP
your problem is numerically sensitive leading to non-symmetry on things you would think are symmetric

>> M11=(Abar'*P)+(P*Abar)-(X*Bbar*Bbar'*P)-(P*Bbar*Bbar'*X)+(X*Bbar*Bbar'*X)-(alpha*P)
Linear matrix variable 12x12 (full, real, 78 variables)
>> norm(getbase(M11-M11'),inf)

ans =

   1.9323e-11


Hence, symmetrize M11 = (M11 + M11')/2

Johan Löfberg

unread,
Oct 4, 2018, 10:01:40 AM10/4/18
to YALMIP
I get completely different data in my model though, so assuming you're really using the most recent release, there must be differences in matlabs code to generate your data

Report

>> Abar

Abar =

  Columns 1 through 8

  -38.2537   -3.7183   -0.1042  -14.6877   13.4813    6.6874  -24.6399   -4.9530
   -4.3918   -0.3332   -0.3937   -1.5858    1.4555    0.7220   -2.6602   -0.5347
   -0.4291    0.6005   -0.7943    0.1055   -0.0472   -0.0234    0.0863    0.0173
  -16.8199   -1.5684    0.0411   -6.5971    5.8820    2.9650  -10.9248   -2.1960
   15.4232    1.4366   -0.0694    6.3089   -5.4809   -2.5005    9.9205    1.9942
    7.7247    0.5247   -0.1151    2.8002   -2.7634   -1.4584    4.9525    1.0197
  -28.1736   -2.7883   -0.0406  -10.7512   10.0478    5.0831  -18.4221   -3.6961
   -5.4796   -1.2128   -0.5901   -2.2995    2.0030    1.1185   -3.7454   -0.7739
   -2.4608   -0.3130   -0.0737   -0.9959    0.6346    0.3429   -1.7892   -0.2642
    2.3839    0.3334    0.0628    0.7330   -1.6946   -0.1455    1.2806    0.3114
    0.9628    1.2260   -0.4648   -0.3605    0.4991    0.1266   -0.8700   -0.3957
   -0.0053   -0.0086    0.0021    0.0158   -0.0168   -0.0366    0.0011   -0.1196

  Columns 9 through 12

   -2.1707    2.0911         0         0
   -0.2344    0.2258         0         0
    0.0076   -0.0073         0         0
   -0.9625    0.9272         0         0
    0.8740   -0.8419         0         0
    0.4469   -0.4305         0         0
   -1.6167    1.5574         0         0
   -0.3348    0.3225         0         0
   -0.1494    0.1439         0         0
    0.1496   -0.1441         0         0
   -0.0692    0.0743         0         0
   -0.0311   -0.0660         0         0

>> Bbar

Bbar =

    1.5342    0.0000
    0.0410    0.0080
    0.1932   -0.0062
    0.5642   -0.1193
   -0.5313   -0.0051
   -0.2681   -0.0468
    0.9720    0.0546
    0.1958   -0.0009
    0.0858   -0.0000
   -0.0827    0.0000
         0         0
         0         0

>> Q0

Q0 =

  Columns 1 through 8

   12.6690    0.6662    0.5334    0.3713    0.1807    0.4057    0.3368    0.4977
    0.6662   12.6174    0.7185    0.9012    0.3383    0.5841    0.2510    0.3691
    0.5334    0.7185   12.9870    0.5478    0.5692    0.0938    0.2556    0.5341
    0.3713    0.9012    0.5478   12.4406    0.6743    0.5427    0.3363    0.6079
    0.1807    0.3383    0.5692    0.6743   12.1126    0.3506    0.1507    0.4626
    0.4057    0.5841    0.0938    0.5427    0.3506   12.2976    0.3070    0.1920
    0.3368    0.2510    0.2556    0.3363    0.1507    0.3070   12.1425    0.1682
    0.4977    0.3691    0.5341    0.6079    0.4626    0.1920    0.1682   12.4363
    0.5090    0.4528    0.3851    0.6063    0.7697    0.5701    0.3636    0.1960
    0.5044    0.4809    0.2005    0.5813    0.6569    0.8078    0.3651    0.1793
    0.2760    0.3605    0.4204    0.5083    0.2889    0.2828    0.5014    0.7516
    0.3392    0.4604    0.7367    0.6514    0.5896    0.7567    0.5384    0.3955

  Columns 9 through 12

    0.5090    0.5044    0.2760    0.3392
    0.4528    0.4809    0.3605    0.4604
    0.3851    0.2005    0.4204    0.7367
    0.6063    0.5813    0.5083    0.6514
    0.7697    0.6569    0.2889    0.5896
    0.5701    0.8078    0.2828    0.7567
    0.3636    0.3651    0.5014    0.5384
    0.1960    0.1793    0.7516    0.3955
   12.7724    0.5405    0.2098    0.5399
    0.5405   12.4424    0.7285    0.0172
    0.2098    0.7285   12.2748    0.2790
    0.5399    0.0172    0.2790   12.6996

>> X

X =

   1.0e+03 *

  Columns 1 through 8

    1.8331    2.0056   -1.1186   -0.8082    0.7925    0.3984   -1.6291   -0.4804
    2.0056    2.3295   -1.2232   -0.8820    0.8757    0.4439   -1.7828   -0.5883
   -1.1186   -1.2232    0.6927    0.4907   -0.4804   -0.2180    1.0077    0.2814
   -0.8082   -0.8820    0.4907    0.4453   -0.2567   -0.2601    0.6861    0.2191
    0.7925    0.8757   -0.4804   -0.2567    0.5348    0.2534   -0.6241   -0.2549
    0.3984    0.4439   -0.2180   -0.2601    0.2534    0.7464   -0.0202   -0.2709
   -1.6291   -1.7828    1.0077    0.6861   -0.6241   -0.0202    1.6341    0.3353
   -0.4804   -0.5883    0.2814    0.2191   -0.2549   -0.2709    0.3353    0.2218
   -0.0645   -0.0881    0.0276    0.0485   -0.0899   -0.2797   -0.0916    0.0906
    0.2203    0.2433   -0.1324   -0.1382    0.0323    0.1010   -0.1852   -0.0581
    0.4043    0.4601   -0.2453   -0.1754    0.1782    0.0850   -0.3609   -0.1131
   -0.3680   -0.3679    0.2287    0.1849   -0.1291   -0.1108    0.3201    0.0672

  Columns 9 through 12

   -0.0645    0.2203    0.4043   -0.3680
   -0.0881    0.2433    0.4601   -0.3679
    0.0276   -0.1324   -0.2453    0.2287
    0.0485   -0.1382   -0.1754    0.1849
   -0.0899    0.0323    0.1782   -0.1291
   -0.2797    0.1010    0.0850   -0.1108
   -0.0916   -0.1852   -0.3609    0.3201
    0.0906   -0.0581   -0.1131    0.0672
    0.1956   -0.0298   -0.0164    0.0134
   -0.0298    0.0794    0.0482   -0.0687
   -0.0164    0.0482    0.1175   -0.0689
    0.0134   -0.0687   -0.0689    0.2040

>> L

L =

 -71.5638 + 0.0000i
  -1.0140 + 0.0000i
  -0.6673 + 0.6439i
  -0.6673 - 0.6439i
  -0.6026 + 0.0000i
  -0.3649 + 0.4846i
  -0.3649 - 0.4846i
  -0.1978 + 0.0911i
  -0.1978 - 0.0911i
  -0.0670 + 0.0000i
  -0.0464 + 0.0386i
  -0.0464 - 0.0386i

>> GG

GG =

  Columns 1 through 8

   -6.5999  -21.4709    5.8616    1.4045   -4.9059    0.8134    7.7027    6.7827
    8.0414    9.2224   -5.1139  -12.4175   -7.9019   -1.2024   -9.1835   -0.4611

  Columns 9 through 12

    0.7364   -0.3122   -3.1147   -1.7022
    1.8124    4.2860    1.6043   -3.1309





Senaka Wijayakoon

unread,
Oct 4, 2018, 10:18:54 AM10/4/18
to YALMIP
Hello Johan 

Many thanks for your great helps so far. It seems your final symmetric proposal (M11=(M11+M11')/2) is working nicely. Any way could please tell me what your MOSEK version is and where can I download it?. What is your MATLAB version too? is it 64x bits?. Final result after setting alpha as a variable and (M11=(M11+M11')/2) is as follows 

alpha=sdpvar(1);
% alpha=1e06;

Abar=[A zeros(n,m);C zeros(m,m)];
Bbar=[B;zeros(m,l)];
C1=[C zeros(m,m)];
C2=[zeros(m,n) eye(m,m)];
C3=[(C*A) zeros(m,m)];
Cbar=[C1' C2' C3']';
>> [X,L,GG] = care(Abar,Bbar,Q0);
        
        %defining matrix to be test for LMI
        M11=(Abar'*P)+(P*Abar)-(X*Bbar*Bbar'*P)-(P*Bbar*Bbar'*X)+(X*Bbar*Bbar'*X)-(alpha*P);
        M12=((Bbar'*P)+(F*Cbar))';
        M21=(Bbar'*P)+(F*Cbar);
        [~,nc]=size(M12);
        [nr,~]=size(M21);
        M22=-eye(nr,nc);
>> M11 = (M11 + M11')/2;
>>         M=[M11 M12;M21 M22];
        
        %defining needed constraints
        constr = [(M<=0),(0<=P)];

>>  diagnostics = bisection(constr,alpha,sdpsettings('solver','mosek','debug',1,'savedebug',1))
Selected solver: MOSEK-SDP
Iteration  Lower bound    Test           Upper bound    Gap          Status at test
    1 :   -0.00000E+00    6.25000E-02    1.25000E-01    1.25000E-01  Successfully solved 
    2 :   -0.00000E+00    3.12500E-02    6.25000E-02    6.25000E-02  Successfully solved 
    3 :   -0.00000E+00    1.56250E-02    3.12500E-02    3.12500E-02  Successfully solved 
    4 :   -0.00000E+00    7.81250E-03    1.56250E-02    1.56250E-02  Infeasible problem 
    5 :    7.81250E-03    1.17188E-02    1.56250E-02    7.81250E-03  Successfully solved 
    6 :    7.81250E-03    9.76563E-03    1.17188E-02    3.90625E-03  Numerical problems (looks like failure)
    7 :    9.76563E-03    1.07422E-02    1.17188E-02    1.95313E-03  Successfully solved 
    8 :    9.76563E-03    1.02539E-02    1.07422E-02    9.76563E-04  Successfully solved 
    9 :    9.76563E-03    1.00098E-02    1.02539E-02    4.88281E-04  Unknown error (looks like failure)
   10 :    1.00098E-02    1.01318E-02    1.02539E-02    2.44141E-04  Successfully solved 
   11 :    1.00098E-02    1.00708E-02    1.01318E-02    1.22070E-04  Unknown error (looks like failure)
   12 :    1.00708E-02    1.01013E-02    1.01318E-02    6.10352E-05  Unknown error (looks like failure)
   13 :    1.01013E-02    1.01166E-02    1.01318E-02    3.05176E-05  Successfully solved 
   14 :    1.01013E-02    1.01089E-02    1.01166E-02    1.52588E-05  Unknown error (looks like failure)

diagnostics = 

  struct with fields:

    yalmiptime: 4.0084
    solvertime: 0.8504
          info: 'Successfully solved (bisection)'
       problem: 0

>> alphasol=double(alpha)

alphasol =

    0.0101

>> Fsol=double(F)

Fsol =

  674.3580  -31.6682  457.2575  239.8155  568.5078  795.1818
   -2.5101  -17.9303   22.5568   12.3303  -45.3880  134.9198
mosekdebug.mat

Johan Löfberg

unread,
Oct 4, 2018, 11:24:39 AM10/4/18
to YALMIP
As I said, I think the problem (besides the symmetry loss now corrected) is the fact that you get different data on your machine, thus leading to other optimization problems than what I have. Hence, look at the data and compare to what I wrote (and perhaps save them and post them)

Johan Löfberg

unread,
Oct 4, 2018, 2:07:12 PM10/4/18
to YALMIP
I saw now that you have randomized data, so of course we get different results....

With the symmetry fix, it appears to have fixed everything. Works as expected now.

Senaka Wijayakoon

unread,
Oct 4, 2018, 10:49:38 PM10/4/18
to YALMIP
Hello Johan 

1. In this program our ultimate goal is to find F (variable) and P (variable) while minimizing alpha and considering  constr = [(M<=0),(0<=P)]. Could you please tell me whether we should have same results for F and P for different simulation sessions?. I believe they may be different because of it is a quasi-convex problem which is tried to solve from different initial conditions for each session.  

2. It seems your machine and my one are still producing different Abar, Bbar and Cbar which depends on only A,B and C matrices. I think according to principles this scenario may also be possible. My transfer function matrix can be converted to different equivalent state space realizations. What is your idea?

Thank you   

Johan Löfberg

unread,
Oct 5, 2018, 2:12:08 AM10/5/18
to yal...@googlegroups.com
Well if your realization of the model is dependent on matlab version, there is no meaning to compare results on my machine and yours. If I lock Q0 = I, and run your code I get alpha = .0287. If I now do SYS = balreal(SYS) and thus simply create another realization, the problem is extremely easy to satisfy as optimal alpha even is negative, -0.092. Making a simple variable transformation instead by multiplying B with 10 and C with 0.1 i,e still same input-output relation, just a different realization) leads to alpha = 0.19. Your method is not invariant to variable changes, which can happen over different matlab versions

Senaka Wijayakoon

unread,
Oct 5, 2018, 6:00:52 AM10/5/18
to YALMIP
Finally I could run whole algorithm for finding a Static Output Feedback (SOF) PID controller. I found 2by2 gain matrices for P,I and D components. F1 for P, F2 for I and F3 for D. Unfortunately control can't follow the step reference input at all. Eventually system's output reaches zero instead of step reference input 1. If you can please run m-file attached with mail ans see it. Results are don't make any sense as an controller. Thank you.
lmiTxAuto.m

Johan Löfberg

unread,
Oct 5, 2018, 7:28:42 AM10/5/18
to YALMIP
it is impossible for anyone but you to know what you are doing. All I can say is when I run your code, I would not trust the result coming out from

        constr = [(M<=0),(0<=P),(0<=(eye(size(C*B*f3bar))+(C*B*f3bar)'+(C*B*f3bar)))];
        options=sdpsettings('solver','mosek');
        optimize(constr,trace(P),options)


looking at the diagnostic from mosek and from yalmip, it tells you the results are dubious, and indeed the solution is far from feasible

s = 

  struct with fields:

    yalmipversion: '20180926'
       yalmiptime: 0.2651
       solvertime: 0.5039
             info: 'Numerical problems (MOSEK)'
          problem: 4

K>> check(constr)
 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|   ID|          Constraint|   Primal residual|   Dual residual|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|   #1|   Matrix inequality|        -0.0022697|        0.041435|
|   #2|   Matrix inequality|            4.5606|       0.0030977|
|   #3|   Matrix inequality|                 1|        918.0677|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| A primal-dual optimal solution would show non-negative residuals.|
| In practice, many solvers converge to slightly infeasible    |
| solutions, which may cause some residuals to be negative.    |
| It is up to the user to judge the importance and impact of   |
| slightly negative residuals (i.e. infeasibilities)           |
| https://yalmip.github.io/command/check/                      |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Senaka Wijayakoon

unread,
Oct 6, 2018, 9:12:46 AM10/6/18
to YALMIP
Hello Johan 

Can you please run the bellow code to see the results for F1,F2,F3 and alpha. If alpha get reduced bellow zero for Q0 identity matrix then results for F should be correct. Here my results make crazy things for SOF-PID. F1,F2 and F3 are proportional, Integral and derivative gain matrices respectively. Output is not following reference step input at all.

num11=-0.37237;
den11=[0.0797 5.689 1 0];
G11=tf(num11,den11);
num12=0.019761;
den12=[301.091 27.693 1 0];
G12=tf(num12,den12);
num21=-0.2018;
den21=[6.315 4.5234 1 0];
G21=tf(num21,den21);
num22=-0.07345;
den22=[16.112 3.523 1 0];
G22=tf(num22,den22);
GMIMO=[G11 G12;G21 G22];
SYS=ss(GMIMO,'minimal');
A=SYS.A;
B=SYS.B;
C=SYS.C;

%defining matrix variables
[~,l]=size(B);%no of inputs
[m,~]=size(C);%no of outputs

%making a random symmetric positive definite matrix

Q0=eye(n+m);

P=sdpvar(n+m);
F=sdpvar(l,3*m);
alpha=sdpvar(1);

Abar=[A zeros(n,m);C zeros(m,m)];
Bbar=[B;zeros(m,l)];
C1=[C zeros(m,m)];
C2=[zeros(m,n) eye(m,m)];
C3=[(C*A) zeros(m,m)];
Cbar=[C1' C2' C3']';

        %solving Riccati equation
        [X,L,GG] = care(Abar,Bbar,Q0);
        
        %defining matrix to be test for LMI
        M11=(Abar'*P)+(P*Abar)-(X*Bbar*Bbar'*P)-(P*Bbar*Bbar'*X)+(X*Bbar*Bbar'*X)-(alpha*P);
        M12=((Bbar'*P)+(F*Cbar))';
        M21=(Bbar'*P)+(F*Cbar);
        [~,nc]=size(M12);
        [nr,~]=size(M21);
        M22=-eye(nr,nc);
        M11=(M11+M11')/2;
        M=[M11 M12;M21 M22];
        
        %defining needed constraints
        f3bar=F(:,5:6);
        constr = [(M<=0),(0<=P),(0<=(eye(size(C*B*f3bar))+(C*B*f3bar)'+(C*B*f3bar)))];

        %select solver
        options=sdpsettings('solver','mosek','debug',1);

        %solve LMI by minimizing alpha 

        diagnostics = bisection(constr,alpha,options);
        alphasol=double(alpha);
        Fsol=double(F);
       
            fprintf('The value of F is %d',Fsol);
            fprintf('The value of alpha is %d',alphasol);

            F1bar=Fsol(:,1:2);
            F2bar=Fsol(:,3:4);
            F3bar=Fsol(:,5:6);

            F3=F3bar*inv(eye(size(C*B*F3bar))+(C*B*F3bar))
            F2=(eye(size(F3*C*B))-(F3*C*B))*F2bar
            F1=(eye(size(F3*C*B))-(F3*C*B))*F1bar
            

Johan Löfberg

unread,
Oct 6, 2018, 11:32:35 AM10/6/18
to YALMIP
optimal -0.04, solution strictly feasible


F3 =

  550.1115  294.9079
  -26.4204   50.5502


F2 =

  127.4715   63.2173
    5.6316    2.9827


F1 =

  419.6013   45.4063
   -1.7137   -4.7159

Reply all
Reply to author
Forward
0 new messages