Importance of Positive Definitiness constraint

41 views
Skip to first unread message

pravin behera

unread,
Jul 30, 2019, 2:33:37 AM7/30/19
to YALMIP
I am trying to solve this particular program, but i am not able to solve using Yalmip, however the problem is perfectly feasible, i have solved manually. I am wondering what is the role of 1e-4, i know i have inserted those values to make the matrix positive definite, but 1e-4 is not sufficient, i have to make it 1e-8 to make it work, Also if you could tell how could I minimize the monomials for the SOS decomposition. 


sdpvar x

A=[2 3];
lam1=01e-4*(x^2);
Z = monolist(x,2);
Z=Z(2:end);
n=2;
M=[jacobian(Z,x)];
xvar=sdpvar(2*n,1)
Q=sdpvar(n);
R=sdpvar(n);
expr1=[(Q*A'*M'+M*A*Q-M*4*4'*M') Q;Q -R];
const1=-xvar'*(expr1+lam1*eye(length(expr1)))*xvar;
const2=xvar(1:2)'*(Q-1e-4*eye(n))*xvar(1:2);
const3=xvar(1:2)'*(R-1e-4*eye(n))*xvar(1:2);
F=[sos(const1),sos(const2),sos(const3)]
options = sdpsettings('solver','mosek','verbose',1);
[sol1,v1,Q1]=solvesos([F],[],options,[Q,R])

Q=value(Q)

Johan Löfberg

unread,
Jul 30, 2019, 2:47:07 AM7/30/19
to YALMIP
You appear to simply want Q >= 1e-4*eye(n) and R >= 1e-4*eye(n) . No reason to apply sos on that

From what I can tell, it is impossible to make Q positive definite. Only the (1,1) block can be made psd. Simply remove the lower bounding and then try to maximize Q(2,2), and you will see that the optimal value is 0

pravin behera

unread,
Jul 30, 2019, 6:26:16 AM7/30/19
to YALMIP
I have tried the way you instructed its coming close to zero. 
But i wanted to try find the SOS decomposition of const1, what monomial basis it is considering, i tried v1^T*Q1*v1, but thats not showing all the monomial basis

Johan Löfberg

unread,
Jul 30, 2019, 6:37:39 AM7/30/19
to YALMIP
the monomial basis used in the first sos is the first element in the cell v1. However, since you've scalaried the constraint, the basis will of course not only be based on x, but also your artificial variable xvar

sdisplay(v1{1})

   
{'xvar(4)'  }
   
{'xvar(3)'  }
   
{'xvar(1)'  }
   
{'x*xvar(4)'}
   
{'x*xvar(3)'}
   
{'x*xvar(2)'}
   
{'x*xvar(1)'}






pravin behera

unread,
Jul 30, 2019, 8:58:09 AM7/30/19
to YALMIP
Thanks, i got it.

pravin behera

unread,
Jul 30, 2019, 10:04:24 AM7/30/19
to YALMIP
Well i have now increased the bounds, and m getting this, just need confirmation that the program is indeed valid, and i am getting a correct solution ?


sdpvar x

A=[2 3];
lam1=01e-15*(x^2);
Z = monolist(x,2);
Z=Z(2:end);
n=2;
M=[jacobian(Z,x)];
xvar=sdpvar(2*n,1)
Q=sdpvar(n);
R=sdpvar(n);
expr1=[(Q*A'*M'+M*A*Q-M*4*4'*M') Q;Q -R];
const1=-xvar'*(expr1+lam1*eye(length(expr1)))*xvar;
const2=Q-1e-8*eye(n);
const3=R-1e-8*eye(n);
F=[sos(const1),const2>=0,const3>=0]
options = sdpsettings('solver','mosek','verbose',1);
[sol1,v1,Q1]=solvesos([F],[],options,[Q,R])

Q=value(Q)
X=inv(Q)

Johan Löfberg

unread,
Jul 30, 2019, 10:21:08 AM7/30/19
to YALMIP
1e-15 is the same as 0 in numerical solvers, so you can just as well skip that term. 1e-8 is on the border of drowning in numerical tolerance, so using that instead of 0 is also shaky

I'm pretty sure Q=0 is the only feasible solution. If you change all your small margins to 0, and use the objective (trace(Q)-1)^2 (i.e. try to get a significantly non-zero Q) you still get a solution Q which is very close to 0
Reply all
Reply to author
Forward
0 new messages