Dear Prof. Lofberg,
Thank you very much for your previous helps. YALMIP is so great for us!
Now I have a question: what's the difference between the two expressions below? Why do I get different results with the two expressions ? Could you help me please : )
-----------------------------------------------------------------
x = sdpvar(1,24);
y = sdpvar(1,24);
z = max(max(x),max(y)); %expression A
z = max(x+y); %expression B
-----------------------------------------------------------------
Full m-code as follows:
%**********************************************************************
close all;clear;clc;
X = sdpvar(1,24);
Y = sdpvar(1,24);
onoffX = binvar(1,24);
onoffY = binvar(1,24);
F = [onoffX+onoffY<=1,
0<=X<=1e5.*onoffX,
0<=Y<=1e5.*onoffY];
%**********************************************************************
% Is the two expressions the same? Why do I get different results?
% expression A:
max_XY = max(max(X),max(Y));
% expression B:
max_XY = max(X+Y);
%**********************************************************************
f = sum(X)+max_XY;
ops = sdpsettings('verbose',0,'debug',1,'solver','gurobi');
result = optimize(F,-f,ops);
f = value(f)
% The result with expression A is 4.3e5, and another is 2.5e6.