lmi constraint interpreted as elementwise inequality constraint

713 views
Skip to first unread message

Chang Liu

unread,
Apr 7, 2017, 4:38:24 PM4/7/17
to YALMIP
Hi Johan,

I want to add LMI constraints to my problem. However, such constraints are sometimes interpreted as the element-wise inequality constraints. Here is a MWE:

clear
num = 1;
N = 1;

% define variables
x = sdpvar(2*num,N+1,'full');
t = sdpvar(num*num,N+1); % dummy variable for LMI

P = cell(num,N+1);
for ii = 1:N+1
    for jj = 1:num
        P{jj,ii} = sdpvar(2,2,'full');
    end
end

% objective
obj = sum(sum(t));

% constraints
constr = [t>=0];

% psd constraint
for ii = 1:N+1
    for jj = 1:num
        constr = [constr,[P{jj,ii} >= 0]:'psd of P']; 
    end
end

% LMI constraint
for ii = 1:N
    for jj = 1:num
        tmp = 0;
        for ll = 1:num
            constr = [constr,[[P{ll,ii+1} x(2*jj-1:2*jj,ii+1)-x(2*ll-1:2*ll,ii+1);
                (x(2*jj-1:2*jj,ii+1)-x(2*ll-1:2*ll,ii+1))' t(num*(jj-1)+ll,ii+1)]>=0]:'LMI'];
        end
    end
end

% intentionally add this constraint to show, via the optimization result,
% that LMI is interpreted as something else
constr = [constr, P{1,1}(2,1) == -1, P{1,1}(1,2) == -1];

opt = sdpsettings('solver','mosek','verbose',3,'debug',1,'showprogress',1);
sol = optimize(constr,obj,opt);

The solver gives an infeasible error. And 
check(constr)
gives the following result:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|   ID|               Constraint|   Primal residual|   Dual residual|        Tag|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|   #1|   Elementwise inequality|                 0|               0|           |
|   #2|   Elementwise inequality|                 0|               0|   psd of P|
|   #3|   Elementwise inequality|                 0|               0|   psd of P|
|   #4|   Elementwise inequality|                 0|               0|        LMI|
|   #5|      Equality constraint|                -1|              -1|           |
|   #6|      Equality constraint|                -1|               0|           |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
As it shows, LMI is interpreted as elementwise inequality.

However, if I define P in the following way:
P{jj,ii} = sdpvar(2,2)
then LMI is correctly interpreted. But this causes problem in my other part of code (which I don't include here).

I'm wondering what is the best way to define LMI in Yalmip, as adding "full" seems to be a safe to define matrices in general but here ruins the LMI interpretation.

Thanks!

Johan Löfberg

unread,
Apr 8, 2017, 11:23:38 AM4/8/17
to YALMIP
You are not adding any LMIs, as X>=0 for a full matrix is interpreted as an elementwise constraint. For psd to make sense in a convex optimization framework and yalmip, the matrix has to be structurally symmetric (not just constrained to be symmetric)

If your code fails, you must have some other misconception in your view of semidefinite programming. Psd only makes sense for structurally symmetric parameterizations

Chang Liu

unread,
Apr 11, 2017, 8:31:57 PM4/11/17
to YALMIP
Thanks! It turns that the problems of my code, besides the structurally non-symmetric, are the numerical inaccuracy and badly scaled variables. I post them here in case other people encounter the same problem:

It seems that Matlab treats -0 and 0 as different values and thus even matrix A=[1 -0; 0 1] is not symmetric, causing a problem when imposing the equality constraint (P == A). So I just use triu in the equality constraint.

The badly scaled variables causes infeasibility issue when using Mosek, even the primal problem is feasible.
Reply all
Reply to author
Forward
0 new messages