Taking difference of sdpvar

23 views
Skip to first unread message

Abhishek B

unread,
Jul 6, 2018, 1:52:14 AM7/6/18
to YALMIP
Hi Prof Lofberg, 

I'm working on an optimization problem and trying to set constraints of all 2x2 minors of a matrix being zero.
Here is the code I'm currently working with;

function [ del ] = step3_KKT(n,m)

%Step3_KKT - Running step 3 

 

%{

   Detailed explanation goes here

%}

X = sdpvar(n,1);

Y = sdpvar(m,1);

Z = kron(X,Y);

sdisplay(Z)

f = kron(Z,Z);

 

Z = reshape(Z, [m,n]);

 

for i=1:n-1

    for k=i+1:n

        for j=1:m-1

            for l=j+1:m

                a = Z(i,j)*Z(k,l); 

                b = Z(i,l)*Z(k,j);

                c = a-b;

                disp(class(c))

            end

        end

    end

end

 

end


Somehow taking the difference of two sdpvar objects, returns a double object. As it can be seen, I need to be able to do this for arbitrary (n,m)>(3,3). 

I have tried writing down "c=sdpvar(a-b)", but that doesn't help either.


Do you have any advice on how I can do this? Is there something wrong in my code?


More specifically, I need the gradient of these minors for implementing KKT conditions. I imagine I can do this by somehow looping over i,j,k,l and using blkvar, or perhaps even the jacobian commands.

If you have any advice on how I might do this, it would be much appreciated.


Best,

Abhishek B.

Johan Löfberg

unread,
Jul 6, 2018, 2:31:41 AM7/6/18
to YALMIP
That expression is 0 for some combinations so no surprise there. Define X and Y as random, and you will see 0 in that case too

I hope you realize that the optimization problem you get where you constrain nonlinear minors to be zero will be a very nasty nonconvex program

Abhishek B

unread,
Jul 25, 2018, 11:21:36 PM7/25/18
to YALMIP
Thanks Prof Lofberg, 

I see where the error was. And yeah, its a really crappy problem I'm working with...

Best,
Abhishek B.
Reply all
Reply to author
Forward
0 new messages