LMI solving issue using MOSEK and GUROBI

144 views
Skip to first unread message

Md. Abdur Rahim

unread,
Nov 2, 2023, 12:52:36 AM11/2/23
to YALMIP
I tried to solve the LMI using YALMIP with mosek as a solver. Unfortunately, it is showing "'Infeasible problem (learn to debug) (MOSEK-SDP)'". Also, I tried to use Gurobi, but it is not working and showing "Warning: Solver not applicable (gurobi does not support semidefinite constraints) Unrecognized field name "used_variables"." I am attaching my codes here. I would be grateful if you could help me with this code.

%System_parameters
m = 1800; % mass in kg
Iz= 2500; % Vehicle total inertia about the yaw axis in kg m2
lf= 1.03; % Distance of the front axle from CG in m
lr= 1.49; % Distance of the rear axle from CG in m
C_f= 40; % Nominal cornering stiffness of front tyres in KN/rad
C_r= 40; % Nominal cornering stiffness of rear tyres in KN/rad
D_l = 10; %look ahead distance in m
%for varying parameter vector p = (p1,...,ps)
v_x_min= 5;
v_x_max= 35;
%sys {v_x_min, 1/v_x_max}
A{1} = [-(C_r+C_f)./(m*v_x_max) ((lr*C_r)-(lf*C_f))./(m*v_x_max)-v_x_min 0 0; ((lr*C_r)-(lf*C_f))./(Iz*v_x_max) -((lr^2*C_r)+(lf^2*C_f))./(Iz*v_x_max) 0 0; -1 -D_l 0 v_x_min; 0 -1 0 0];
B{1} = [C_f./m; (lf*C_f)./Iz; 0; 0];
C{1} = [0 1 0 0; 0 0 1 0; 0 0 0 1];
E{1}=[0; 0; 0; v_x_min];
D{1} = zeros(3,1);
s1= ltisys(A{1},B{1},C{1},D{1});
%Sys {v_x_min, 1/v_x_min}
A{2} = [-(C_r+C_f)./(m*v_x_min) ((lr*C_r)-(lf*C_f))./(m*v_x_min)-v_x_min 0 0; ((lr*C_r)-(lf*C_f))./(Iz*v_x_min) -((lr^2*C_r)+(lf^2*C_f))./(Iz*v_x_min) 0 0; -1 -D_l 0 v_x_min; 0 -1 0 0];
B{2} = [C_f./m; (lf*C_f)./Iz; 0; 0];
C{2} = [0 1 0 0; 0 0 1 0; 0 0 0 1];
E{2}=[0; 0; 0; v_x_min];
D{2} = zeros(3,1);
s2= ltisys(A{2},B{2},C{2},D{2});
% Sys{v_x_max, 1/v_x_min}
A{3} = [-(C_r+C_f)./(m*v_x_min) ((lr*C_r)-(lf*C_f))./(m*v_x_min)-v_x_max 0 0; ((lr*C_r)-(lf*C_f))./(Iz*v_x_min) -((lr^2*C_r)+(lf^2*C_f))./(Iz*v_x_min) 0 0; -1 -D_l 0 v_x_max; 0 -1 0 0];
B{3} = [C_f./m; (lf*C_f)./Iz; 0; 0];
C{3} = [0 1 0 0; 0 0 1 0; 0 0 0 1];
E{3}=[0; 0; 0; v_x_max];
D{3} = zeros(3,1);
s3= ltisys(A{3},B{3},C{3},D{3});
% Sys {v_x_max, 1/v_x_max}
A{4} = [(C_r+C_f)./(m*v_x_max) ((lr*C_r)-(lf*C_f))./(m*v_x_max) - v_x_max 0 0; ((lr*C_r)-(lf*C_f))./(Iz*v_x_max) -((lr^2*C_r)+(lf^2*C_f))./(Iz*v_x_max) 0 0; -1 -D_l 0 v_x_max; 0 -1 0 0];
B{4} = [C_f./m; (lf*C_f)./Iz; 0; 0];
C{4} = [0 1 0 0; 0 0 1 0; 0 0 0 1];
E{4}=[0; 0; 0; v_x_max];
D{4} = zeros(3,1)
s4= ltisys(A{4},B{4},C{4},D{4});
pols = psys([s1,s2,s3,s4]);
[tmin,P] = quadstab(pols)
%% LMI Solution - Prepare Yalmip
yalmip('clear');
LMIs = [];
gamma2=sdpvar(1);
Z = sdpvar(4,4,'symmetric');
N = 4;
r = 40;
q = 40;
Z >= 0;
for k = 1:N % N is number of vertices
W{k} = sdpvar(1,4,'full');
%% Condition for Quadratic Stability
LMIs = [LMIs, A{k}*Z + Z*A{k}'+ B{k}*W{k} + W{k}'*B{k}'<= 0];
%% Condition for H_∞ Performance
LMIs = [LMIs, [A{k}*Z+Z'*A{k}'+B{k}*W{k}+W{k}'*B{k}' E{k} Z'*C{k}'; E{k}' -eye(1) D{k}'; C{k}*Z D{k} -gamma2*eye(3)] <= 0];
%% Condition for LMI Reion
LMIs = [LMIs, [-r*Z q*Z+A{k}*Z+B{k}*W{k}; q*Z+Z'*A{k}'+W{k}'*B{k}' -r*Z] <= 0];
end
%options = sdpsettings('solver','gurobi');
options = sdpsettings('solver','mosek');
solution1 = optimize(LMIs,Z,options)
solution2 = optimize(LMIs,gamma2,options)
%% Controller Gain at Individual Vertices
K1 = value(W{1})*inv(value(Z))
K2 = value(W{2})*inv(value(Z))
K3 = value(W{3})*inv(value(Z))
K4 = value(W{4})*inv(value(Z))

Johan Löfberg

unread,
Nov 2, 2023, 3:05:47 AM11/2/23
to YALMIP
It makes no sense to have a matrix objective

>> Z
Linear matrix variable 4x4 (symmetric, real, 10 variables)

And yes, your model is infeasible, already the second and third constraint together form an ill-posed (most likely infeasible) model (i.e. H∞ Performance+LMI region for a single system fails) . Trying to use gurobi makes absolutely no sense as you have an SDP

>> optimize(LMIs(2:3))

MOSEK Version 10.0.16(BETA) (Build date: 2022-6-21 16:34:57)
Copyright (c) MOSEK ApS, Denmark WWW: mosek.com
Platform: Windows/64-X86

numbarvars = 2
numbarvars = 2
numbarvars = 2
Problem
  Name                   :                
  Objective sense        : minimize        
  Type                   : CONIC (conic optimization problem)
  Constraints            : 15              
  Affine conic cons.     : 0              
  Disjunctive cons.      : 0              
  Cones                  : 0              
  Scalar variables       : 0              
  Matrix variables       : 2              
  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.02            
Lin. dep.  - number                 : 0              
Presolve terminated. Time: 0.03    
Problem
  Name                   :                
  Objective sense        : minimize        
  Type                   : CONIC (conic optimization problem)
  Constraints            : 15              
  Affine conic cons.     : 0              
  Disjunctive cons.      : 0              
  Cones                  : 0              
  Scalar variables       : 0              
  Matrix variables       : 2              
  Integer variables      : 0              

Optimizer  - threads                : 2              
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 15
Optimizer  - Cones                  : 0
Optimizer  - Scalar variables       : 0                 conic                  : 0              
Optimizer  - Semi-definite variables: 2                 scalarized             : 72              
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 : 120               after factor           : 120            
Factor     - dense dim.             : 0                 flops                  : 1.08e+04        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   3.0e+00  5.0e+00  2.0e+00  0.00e+00   1.000000000e+00   0.000000000e+00   1.0e+00  0.05  
1   4.9e-01  8.1e-01  7.9e-01  -9.23e-01  -3.930233281e+00  0.000000000e+00   1.6e-01  0.19  
2   7.9e-02  1.3e-01  3.2e-01  -9.89e-01  -3.419807106e+01  0.000000000e+00   2.6e-02  0.19  
3   1.6e-02  2.7e-02  1.4e-01  -9.95e-01  -1.749981358e+02  0.000000000e+00   5.3e-03  0.19  
4   2.7e-03  4.5e-03  5.8e-02  -1.01e+00  -1.065013674e+03  0.000000000e+00   8.9e-04  0.20  
5   2.2e-04  3.7e-04  1.7e-02  -1.00e+00  -1.266120992e+04  0.000000000e+00   7.4e-05  0.20  
6   7.2e-05  1.2e-04  9.5e-03  -1.00e+00  -3.926472578e+04  0.000000000e+00   2.4e-05  0.20  
7   1.2e-05  2.0e-05  3.9e-03  -1.00e+00  -2.379410259e+05  0.000000000e+00   4.0e-06  0.22  
8   2.3e-06  3.8e-06  1.7e-03  -1.00e+00  -1.240872769e+06  0.000000000e+00   7.6e-07  0.22  
9   4.5e-07  7.4e-07  7.6e-04  -1.01e+00  -6.510249064e+06  0.000000000e+00   1.5e-07  0.23  
10  1.6e-07  2.6e-07  4.5e-04  -1.01e+00  -1.839285562e+07  0.000000000e+00   5.2e-08  0.23  
11  5.2e-08  8.6e-08  2.5e-04  -9.81e-01  -5.362656782e+07  0.000000000e+00   1.7e-08  0.23  
12  2.6e-09  4.3e-09  4.3e-05  -9.37e-01  -6.190881577e+08  0.000000000e+00   8.5e-10  0.25  
13  4.5e-10  7.5e-10  5.7e-06  -5.56e-02  -3.596613787e+08  0.000000000e+00   1.5e-10  0.25  
14  1.5e-11  2.5e-11  2.0e-08  8.72e-01   -3.866489600e+06  0.000000000e+00   5.1e-12  0.27  
15  1.0e-15  7.5e-12  8.2e-15  9.96e-01   -1.323069083e+02  0.000000000e+00   3.5e-16  0.27  
16  8.8e-23  1.9e-12  5.0e-25  1.00e+00   -1.001184592e-05  0.000000000e+00   2.3e-23  0.27  
17  8.2e-23  2.3e-12  4.6e-25  1.00e+00   -9.386105549e-06  0.000000000e+00   2.1e-23  0.28  
18  6.2e-23  1.1e-11  3.0e-25  1.00e+00   -7.039579165e-06  0.000000000e+00   1.6e-23  0.28  
19  9.1e-30  3.5e-11  2.4e-37  1.00e+00   -2.858439529e-15  0.000000000e+00   1.0e-32  0.30  
20  1.3e-38  5.8e-11  3.4e-50  1.00e+00   -1.752358982e-24  0.000000000e+00   7.0e-42  0.30  
21  1.2e-38  4.4e-11  2.8e-50  1.00e+00   -1.533314110e-24  0.000000000e+00   6.1e-42  0.31  
22  1.2e-38  4.4e-11  2.8e-50  1.00e+00   -1.533314110e-24  0.000000000e+00   6.1e-42  0.31  
23  1.2e-38  4.4e-11  2.8e-50  1.00e+00   -1.533314110e-24  0.000000000e+00   6.1e-42  0.33  
Optimizer terminated. Time: 0.41    


Interior-point solution summary
  Problem status  : ILL_POSED
  Solution status : PRIMAL_ILLPOSED_CER
  Dual.    obj: 0.0000000000e+00    nrm: 2e+01    Viol.  con: 0e+00    barvar: 4e-09  


BTW, this line

Z >= 0;

does not do anything (and if you added it to your model it would be redundant as you already impose that in your "LMI Reion" constraint
Reply all
Reply to author
Forward
0 new messages