multiplication of two decision variables

518 views
Skip to first unread message

Hassan D

unread,
May 4, 2015, 5:05:25 PM5/4/15
to yal...@googlegroups.com


Hi, I have a question. I need to check the feasibility of some LMIs. the problem I have is, two decision variables are multiplied. I don't know how to write the code. I tried both matlab's lmi lab. and YALMIP. :( 

I am desperate. :(

here is an image of the problem. A and Ah are known matrices. I have to find "h". 

eight.m
third_try.m

Hassan D

unread,
May 4, 2015, 5:11:22 PM5/4/15
to yal...@googlegroups.com
Forgot to mention that, the feasible value of h, according to the article, is 0.6.
Message has been deleted

Mark L. Stone

unread,
May 4, 2015, 7:40:00 PM5/4/15
to yal...@googlegroups.com
Starting from eight.m, I added
rhb = sdpvar
Then I added a constraint
rhb *hb == 1
I replaced 1/hb in the final line of constraints with rhb.
Then I solved it with PENLAB.

The optimal value of hb = 0.6290 .

Of course, Yohan would tell you not to use strict inequalities, and to to change to the notation lmi=[lmi,added constraint] rather than using the obsolete +.

Mark L. Stone

unread,
May 4, 2015, 7:47:51 PM5/4/15
to yal...@googlegroups.com
Optimal values from PENLAB:

disp(value(P))
   1.0e+08 *
   2.239739562512086  -0.522345562825789
  -0.522345562825789   2.655481789729393
>> disp(value(Z))
   1.0e+08 *
   0.562083437757605  -1.322016124736004
  -1.322016124736004   3.363453205284785
>> disp(value(Q))
   1.0e+08 *
  -0.408092577731382   0.882652344298102
   0.882652344298102  -2.267011418170922
>> disp(value(hb))
   0.629044590568057

Mark L. Stone

unread,
May 4, 2015, 7:51:00 PM5/4/15
to yal...@googlegroups.com
Well, I should actually say "feasible" values, since I had no objective function.  I have no idea if this is the only feasible solution.  Do you also have an objective function?

Hassan D

unread,
May 4, 2015, 11:44:55 PM5/4/15
to yal...@googlegroups.com
Dear Mark,

Thank you so much for answering. No there is no objective function. According to the article h should be 0.6344, which is very close to the answer you have mentioned. I used the hints you gave me, but still couldn't get the results you have mentioned. I get the following response:



...changing x starting point
*******************************************************************************
PenLab 1.0
*******************************************************************************
Number of variables                           11
Number of matrix variables                     0
   - degrees of freedom (var. elements)        0
(Function) constraints
   - box inequalities                          0
   - linear inequalities                       1
   - nonlinear inequalities                    0
   - linear equalities                         0
   - nonlinear equalities                      0
Matrix constraints
   - box inequalities                          0
   - linear inequalities                       2
   - nonlinear inequalities                    2
 
Min./Max. ineq-mult.:   1.000000 /  1.000000

ans = 

    yalmiptime: NaN
    solvertime: NaN
          info: 'Unknown problem in solver (try using 'debug'-flag in sdpsettings) (Cell conten...'
       problem: 9
nine.m

Johan Löfberg

unread,
May 5, 2015, 1:56:16 AM5/5/15
to yal...@googlegroups.com
You are using an old version of penlab, and it appears to have crashed. My guess is that you have included the entire penlab directoy in your path after unzipping it. Penlab ships will a bunch of old versions also, and  you have to delete those directories (or don't add them to your path). Look in the penlab directory and you see two old versions there.

There is no unique solution hb to this problem so it doesn't make sense to say that you want to recover a particular solution. 0.6344 is the largest possible hb though. Penlab does not like the problem when you try to optimize the objective value -hb, but the value can easily be found to be the optimal value by simple bisection (which doesn't require any BMI solver)

BTW, rather strange to call your constraints lmi, when the whole crux is the fact that your model isn't an lmi, but, after some reformulations, at most can be called a bmi.


Johan Löfberg

unread,
May 5, 2015, 1:57:06 AM5/5/15
to yal...@googlegroups.com
and please get rid of those strict inequalities...

Mark L. Stone

unread,
May 5, 2015, 2:17:18 AM5/5/15
to yal...@googlegroups.com
Johan, you need to check the translation of PENLAB exit status to YALMIP info.  I have run PENLAB with the message "PenLab didn't converge: unconstrained minimization failed", but YALMIP info is 'Successfully solved (PENLAB)'.

Hassan D

unread,
May 5, 2015, 2:20:58 AM5/5/15
to yal...@googlegroups.com
Thank you sir, I appreciate your answer. You were right, I hadn't paid attention that there were older versions in the folder too. I deleted them. Now, the m-file runs, but seems it's stuck at the second iteration. The article I am trying to work on was published in a good journal, (the international journal of robust and nonlinear control,wiley) It was stated in the article that they had used LMI toolbox. That's why I called it an LMI problem. I also changed the code :) 


ten.m

Johan Löfberg

unread,
May 5, 2015, 2:21:08 AM5/5/15
to yal...@googlegroups.com
I definitely have to! This is the code at the moment...

switch 0
    case {0,1}
        problem = 0;


Johan Löfberg

unread,
May 5, 2015, 2:30:14 AM5/5/15
to yal...@googlegroups.com
Yes, as I said, penlab fails when you add the objective function (which should -hb, not hb, as you want to maximize hb). It simply isn't robust enough

Since they have used a linear solver, they have obviously performed a bisection to find the largest possible hb. That is the approach I would use too (and used when I checked if 0.6344 was the best possible)

Johan Löfberg

unread,
May 5, 2015, 3:46:34 AM5/5/15
to yal...@googlegroups.com
I've added a simple bisection solver to YALMIP. When I try it on your problem, using Mosek to solve the LMIs, the problem is solved in 0.3s on my machine to a tolerance of 10^-4. 

Note that your model is homogeneous, which is bad (all zeros is a feasible solution), so I've dehomogenized it.

clc
clear
A=[0.2570, -1.2872;0.1633 0.6261];
Ah=[-0.2657 0.5974;0.3088 -0.8085];
Q=sdpvar(2,2);
P=sdpvar(2,2);
Z=sdpvar(2,2);
hb=sdpvar(1,1);

Model=[P>=eye(2),Z>=0];
Model=[Model, [P+Z -Z;-Z hb*Q+Z]>=0];
Model=[Model, [P*A+A'*P+Q-(1/hb)*Z, P*Ah+(1/hb)*Z, hb*A'*Z; 
              Ah'*P+(1/hb)*Z, -Q-(1/hb)*Z, hb*Ah'*Z;
              hb*Z*A,hb*Z*Ah -hb*Z]<=0];
          
tolerance = 1e-4;
lower = 1e-4; % default 0 does not work as we divide by hb
bisection(Model,hb,sdpsettings('solver','mosek'),tolerance,lower);
value(hb)


bisection.m

Hassan D

unread,
May 5, 2015, 4:21:20 AM5/5/15
to yal...@googlegroups.com
Before I got to see your new post, I wrote an m-file for bisection. It fortunately worked, but I also downloaded mosek, and used your bisection mfile. I don't know how to thank you. You saved my day!! Thanks a million!
mylmi.m
bisection_1.m
Reply all
Reply to author
Forward
0 new messages