Hi,how are you?
I am a beginner in YALMIP, but I like this toolbox very much.
I am trying to solve a two-dimensional unconstrained optimization problem described by
min f(x,y)=-3/((x+2)^2+3)-1/((y-1)^2+0.5)
obviously, the optimal solution is x=-2, y=1.
The codes are as follows.
clc
clear
x = sdpvar(1,1);
y = sdpvar(1,1);
assign(x,2);
assign(y,-1);
fun = -3/((x+2)^2+3)-1/((y-1)^2+0.5);
Cons = [];
ops = sdpsettings('solver','fmincon-standard','verbose',2,'usex0',1);
result = solvesdp(Cons,fun,ops)
x = double(x)
y = double(y)
fmin = double(fun)
The result is x=2, y=1 ! I try to alter the initial point of x, but it doesn't work properly. Exactly speaking, when I set x0=10, it returns x=10!
However, when I change the objective function to fun = x^2+y^2, no matter what the initial point is, it can return a proper answer, i.e., x=0,y=0.
So I wonder where I am wrong? Hope you can help me. Thank you very much!
By the way, the only solver available in my machine is fmincon-standard, when I use 'fmincon' instead of 'fmincon-standard', I get an information written as
'Solver not applicable (fmincon-geometric)'. But when I type 'yalmiptest' in Matlab workspace, I can see that both geometric and standard fmincon solver are found.
I am looking forward to hearing from you! Thanks again!
Best regards,
Dr. chuanjiang Li