simple optimization question

21 views
Skip to first unread message

optimizer

unread,
Jan 5, 2019, 9:18:46 AM1/5/19
to YALMIP
This is my MWW, i would like to find parameters x and y leading the expression (A+X)*v1+(B+Y)*v2 to zero.

How to do that with optimize?

% Minimal Work Example
A=[7    -2   3   2   -3;
   2    -1  0   1   0;
   -2   5   11  -5  -6;
   3    2   -2  1   0;
   5    7   8   -9  1;
   2    9   0   1   -5];

v1=[1;-1;2;1;4];

B=[3    1   3;
   -2   5   4;
   0    7   -1;
   2    9   0;
   -2   5   11;
   7    2   3];

v2=[2;1;-1];

x=sdpvar(2,1);

y=sdpvar(2,1);

X=[0        0       x(2)   0   0;
   -x(1)    0       0       0   0;
   0        -x(1)   0       0   0;
   x(2)     0       x(1)   0   0;
   x(1)     -x(2)   0    0   0;
   -x(1)    0       0       0   0];

Y=[y(1)     y(2)       0;
   0        0       -y(1);
   0        y(2)       0;
   y(1)     0       -y(2);
   -y(1)    y(1)    0;
   0        -y(1)  0];

xL=[-10;-10];              
xU=[10;10];              
yL=[-10;-10];            
yU=[10;10];      
ConstrX=[xL<=x<=xU];   
ConstrY=[yL<=y<=yU];

p=(A+X)*v1+(B+Y)*v2;

oldval=A*v1+B*v2;

I think about using:

sol=optimize(ConstrX+ConstrY,p);

Is this correct?

Johan Löfberg

unread,
Jan 5, 2019, 10:05:04 AM1/5/19
to YALMIP
No, you are currently minimizing p (which makes no sense since p is a vector), but you say you want to find a solution which simply satisfies p == 0 (which is infeasible)

optimizer

unread,
Jan 6, 2019, 1:32:53 PM1/6/19
to YALMIP
So i have to use:

sol=optimize(ConstrX+ConstrY,p'*p);

And after that to find feasible constraints for my problem?

Johan Löfberg

unread,
Jan 6, 2019, 1:39:33 PM1/6/19
to yal...@googlegroups.com
You said you wanted  ConstrX + ConstrY + (p==0)

Your model here would minimize the 2-norm of p,  which perhaps could be a sensible replacement for the equality constrained problem when it is infeasible
Reply all
Reply to author
Forward
0 new messages