Hi All,
I want solve a simple optimization problem as follows:
maximize f = x1^2 + x2.^2
subject to: 0<= x1 <= 10
0<= x2 <= 10
Then, I write the code like this:
x = sdpvar(1,2);
% f = [1 1]*(x'.^2);
f = x*x';
F = set(10 >= x >= 0);
solvesdp(F,-f);
double(f)
double(x)
The solution of yalmip is:
f = 100
x = [10 0]
Obviously, the solution x is not the optimal solution. I don't know why the solution is not the optimal one.
In addition, the solution x euqal to [10 10] (the optimal one ) when I change the definition of x to intvar(1,2). Thanks for any help.
Best Regards,
Cai Ran