I totally forgot about the symmetric spdvar matrices. What is the default behaviour of yalmip when you put non symmetric stuff in it anyway ? Is it going to override the information ? This might explain the difference between the predictions and the manual computations.
For the big M relaxation, are those bounds really needed if the matrices are fixed for a given optimization problem ? They won't change over the horizon. This is the reason I brought up the convex hull function in the first place, as I thought it might solve this issue.
I'm afraid I won't be able to work on this before monday as I'll be abroad this week end. Thanks again for your help, I'm looking forward to implement your fixes !
>> a = sdpvar(2,1);>> b = sdpvar(2,1);>> c = sdpvar(2,1);>> [a <= b <= c]++++++++++++++++++++++++++++++++++++++| ID| Constraint|++++++++++++++++++++++++++++++++++++++| #1| Element-wise inequality 4x1|++++++++++++++++++++++++++++++++++++++
[a <= b, b <= c]
(a <= b) & (b <= c)
(a <= b) + (b <= c)
>> sdpvar a x>> binvar d>> optimizer([-1 <= [x a] <= 1,implies(d, 1 == x*a)],x^2,[],a,x)Warning: You have unbounded variables in IMPLIES leading to a lousy big-M relaxation.
% propagate bilinear. This is needed when implies etc are used in a% bilinearly parameterized optimzer object[monomtable,variabletype] = yalmip('monomtable');bilin = find(variabletype == 1);if ~isempty(bilin) monomtable = monomtable(bilin,:); [i,j] = find(monomtable'); i = reshape(i,2,[]); x = i(1,:)'; y = i(2,:)'; z = bilin(:); lb = LU(:,1); ub = LU(:,2) corners = [lb(x).*lb(y) ub(x).*lb(y) lb(x).*ub(y) ub(x).*ub(y)]; maxz = max(corners,[],2); minz = min(corners,[],2); LU(bilin,1) = max(LU(bilin,1),minz); LU(bilin,2) = min(LU(bilin,2),maxz);end