Dual infeasible, primal improving direction found.

252 views
Skip to first unread message

Ashfin Raseem

unread,
May 17, 2021, 8:56:02 AM5/17/21
to YALMIP
Dear Professor Johan,

I am trying to solve a problem involving Differential LMI (DLMI) constraints. I am using the same method followed in the appendix of the book, "Finite-Time Stability
An Input-Output Approach by Francesco Amato" (appendix D1 attached).

It shows an error 1( Infeasible problem) and the message "Dual infeasible, primal improving direction found". I am attaching the Matlab file with working code below, please look into it, any help would be appreciated. 



Solving Optimization Problems Involving DLMIs using MATLAB.pdf
code.m

Johan Löfberg

unread,
May 17, 2021, 9:09:27 AM5/17/21
to YALMIP
What's up with all the weird use of strings and eval??

Johan Löfberg

unread,
May 17, 2021, 9:14:07 AM5/17/21
to YALMIP
1. Get rid of all the strings and evals and just write normal readable code. Nothing in your model merits the use of evals
2. You probably don't want U to be symmetric as you define it now
3. If you define an options structure, you have to use it also
4. If you are struggling with errors, why are you trying to silent the solver (although it doesn't work as you don't use the options)
5. Never ever use lmilab in YALMIP
6. removeequalities is never needed in 2021

måndag 17 maj 2021 kl. 14:56:02 UTC+2 skrev ashfin...@iitdh.ac.in:

Ashfin Raseem

unread,
May 17, 2021, 12:34:10 PM5/17/21
to YALMIP
Dear Professor Johan,

Thank you for the response.

1. I apologize if the code seems complicated. I am new to LMIs and have to solve a DLMI problem. I found the Matlab implementation only using eval and strings. I don't know how else to approach this. I will look into alternate options for eval. (According to the text I attached, they use eval to take care of the differential variable involved.)

% the DLMI constraints:

Capturse.JPG

% their approach to handle the differential term:


Capture.JPG
% using eval to implement the above:


Capture2.JPG


2. OK, will change it.
3. OK.
4. OK, will look into it.
5. OK, will use a different solver.
6. OK.



Johan Löfberg

unread,
May 17, 2021, 1:34:54 PM5/17/21
to YALMIP
Don't try to learn any YALMIP coding from that books as the code is absolutely horrible

>> Theta = sdpvar(5*ones(1,nOfIntervals));Theta{1}
Linear matrix variable 5x5 (symmetric, real, 15 variables)
Coeffiecient range: 1 to 1
>> for i = 1:nOfIntervals;Theta{i} = sdpvar(5);end;Theta{1}
Linear matrix variable 5x5 (symmetric, real, 15 variables)
Coeffiecient range: 1 to 1
>> Theta = sdpvar(5,5,nOfIntervals);Theta(:,:,1)
Linear matrix variable 5x5 (symmetric, real, 15 variables)
Coeffiecient range: 1 to 1

and then index those variable like any other normal array or cell in MATLAB



Ashfin Raseem

unread,
May 17, 2021, 9:59:10 PM5/17/21
to YALMIP

Dear Professor Johan,

Thank you so much for the help. I will change the code accordingly and also include all the corrections you mentioned earlier. I hope it works out. 

Ashfin Raseem

unread,
May 18, 2021, 3:10:32 AM5/18/21
to YALMIP
Dear Professor Johan,

Thank you for this method of removing eval, the code looks more readable now. I also did all the 6 corrections you suggested. However I am still facing the same issue, it gives the message: "Dual infeasible, primal improving direction found".

I am attaching the changed Matlab code below. Any advice or suggestion would be very helpful for me in this situation.

Capture11.JPG
Capture2.JPG
Captu3re.JPG

The result:

Captu4re.JPG

With regards,
Ashfin.
code_2.m

Johan Löfberg

unread,
May 18, 2021, 3:48:18 AM5/18/21
to YALMIP
already this is infeasible

 constr = [P_0 >= 0]      
 constr = constr + [ P_0 <= R ]
 
 time = 0;
 PP = P_0;
 i=1;
      constr = constr + [ [        (Theta{i} + Q1)       (hatA + hatB*U*hatC + PP)'    (hatA + hatB*U*hatC )'   PP'         (U*hatC)'      PP*hatE1 ;
                           (hatA + hatB*U*hatC + PP)          -eye(5)                       zeros(5)         zeros(5)      zeros(5,3)    zeros(5,1);
                               (hatA + hatB*U*hatC)           zeros(5)                       eye(5)          zeros(5)      zeros(5,3)    zeros(5,1);
                                       PP                    zeros(5)                      zeros(5)          eye(5)        zeros(5,3)    zeros(5,1);  
                                    (U*hatC)                zeros(3,5)                    zeros(3,5)       zeros(3,5)       -Q2^-1       zeros(3,1); 
                                  (hatE1'* PP)              zeros(1,5)                    zeros(1,5)       zeros(1,5)      zeros(1,3)   -gamma*gamma ] <= 0] 
    optimize(constr)

which it should be as you have positive definite diagonal blocks

Ashfin Raseem

unread,
May 18, 2021, 5:58:17 AM5/18/21
to YALMIP

Dear Professor Johan,

Thank you for this valuable observation. I will look into into it.
Reply all
Reply to author
Forward
0 new messages