The Global Optimization Toolbox is a separate toolbox that has specific functions designed to deal with global minima and maxima.
Finding the global minimum of a function, if one exists, can be a difficult problem. There is no guarantee that the Optimization Toolbox functions will return a global minimum, unless the global minimum is the only minimum and the function you are minimizing is continuous.
One type of problem which can definitely cause problems are oscillatory functions. For example:
x=-10:0.1:10;
f=inline('1e-2*x.^2.*sin(x)');
plot(x,f(x))
From the plot, it appears the minima is around x=-8. However, with various starting points FMINCON terminates at different x values, some of which are only local minima.
x=[]; fv=[];
for i=-8:2:8
[x(end+1),fv(end+1)]=fmincon(f,i,[],[],[],[],-10,10);
end
[x;fv]
Based on where FMINCON starts, it may terminate at the global minimum or at one of the local minima. The optimizer gets 'stuck in the local valley' and can't escape to reach the 'global valley'. On the other hand:
x=-10:0.1:10;
y=inline('x.^2');
plot(x,y(x));
There is only one minimum and the function is continuous. Therefore, wherever FMINCON starts, it should stop when it reaches the one minimum (or gets within the default tolerance of that minimum.)
x=[]; fv=[];
for i=-8:2:8
[x(end+1),fv(end+1)]=fmincon(y,i,[],[],[],[],-10,10);
end
[x;fv]
One possible way to find a global minimum is to run FMINCON with multiple starting points, as demonstrated in the code above, and choose the starting point with the lowest function value. Even this is not guaranteed to find the global minimum, however.
Best Answer