Initial point in fminunc

3 Ansichten (letzte 30 Tage)
Tejaswini Miryala
Tejaswini Miryala am 19 Apr. 2020
Bearbeitet: Ameer Hamza am 19 Apr. 2020
Hi,
I am working on the optimisation of a function 2x^2+y^2+3x*y+y-1. I do not have linear or non linear constraints i.e. working on unconstrained part. Could anyone let me know how to find the initial point that to be provided in the fmincon code? through analytical solution I arrived to (-3,4). When I plugged the same its giving me the result as of analytical one. But any other point, even a small decimal change is leading to 10^10 etc.
please do help me.

Antworten (1)

Ameer Hamza
Ameer Hamza am 19 Apr. 2020
Bearbeitet: Ameer Hamza am 19 Apr. 2020
fminunc is giving correct results. You function does not have a minimum at (-3,4). In fact, it is unbounded, i.e., it has a minumum value of -infinity. This function is a hyperbolic paraboloid and the point (-3,4) is a saddle point: https://en.wikipedia.org/wiki/Saddle_point. Following code shows that the point returned by fminunc gives smaller values as compared to (-3,4)
f = @(x,y) 2*x.^2+y.^2+3*x.*y+y-1;
sol_x = fmincon(@(x) f(x(1),x(2)), [1 1]);
f1 = f(-3, 4)
f2 = f(sol_x(1), sol_x(2))
Result:
f1 =
1
f2 =
-1.172249112720687e+24 % smaller than 1
Following shows that you function looks like a hyperbolic paraboloid
f = @(x,y) 2*x.^2+y.^2+3*x.*y+y-1;
[X,Y] = meshgrid(linspace(-1e13, 1e13));
Z = f(X,Y);
surf(X,Y,Z);
zlim([-1e25 1e25]);
caxis([-1e25 1e25]);

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by