A simple two-dimensional unconstrained optimization problem

213 views
Skip to first unread message

Chuanjiang Li

unread,
Feb 18, 2014, 4:54:38 AM2/18/14
to yal...@googlegroups.com
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

Johan Löfberg

unread,
Feb 18, 2014, 5:12:24 AM2/18/14
to yal...@googlegroups.com
A convex quadratic objective and the nonconvex fractional objective you have leads to problems classes worlds apart so the comparison you make is kind of redundant. QPs are basically trivial to solve, while your objective eaily can lead to problems (it is nonconvex)

Note, when YALMIP comes up on a fractional expression such as the one here, it normalizes the model to a canonical form. It basically solves
sdpvar z w
fun
= -3/z-1/w;
Model = [(((x+2)^2+3)) == z, ((y-1)^2+0.5) == w];
result
= solvesdp(Model,fun)

However, this can easily lead to problems, since the solver might run into points where it divides by zero. I would rewrite the model to the following, and thus ensure no such nastyness can occur. Still nonconvex though, so it is still a hard problem
sdpvar z w
fun
= -3*z-1*w;
Model = [z*(((x+2)^2+3))==1, w*((y-1)^2+0.5) == 1];
result
= solvesdp(Model,fun)


Chuanjiang Li

unread,
Feb 18, 2014, 5:28:07 AM2/18/14
to yal...@googlegroups.com
Thank you for your rapid response.
So in another word, it is difficult to use YALMIP to solve this kind of nonconvex fractional optimization problem, isn't it?
(I tried to solve this problem in Matlab with fminunc function, it can be successfully solved.)

Regards,

Johan Löfberg

unread,
Feb 18, 2014, 5:35:06 AM2/18/14
to yal...@googlegroups.com
There are pros and cons of using a modelling layer. In a trivial example such as this, a manual model with the solver might perform better, but in many cases the modelling layer does tricks for you that would be messy to do manually.
Reply all
Reply to author
Forward
0 new messages