Why do the Optimization Toolbox functions return only a local minimum and not the global minimum?

6 次查看(过去 30 天)
If I run a simulation using functions from the Optimization Toolbox multiple times, I receive different final solutions, all of which are local minima. I want to find the global minimum of my function.

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2023-5-21
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Nonlinear Optimization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by