Finding a single global solution

1 view (last 30 days)
fizzy
fizzy on 24 Aug 2020
Commented: Alan Weiss on 25 Aug 2020
I am trying to find optimum(minimum) value of a 3 variable function using simulannealbnd. Using the default parameters, optimization ends with exit flag 1. However, the x and fval output values are different based on the starting point, x0. What option should I modify to make it compute a single global solution irrespective of starting point?
x0 = [10.5,380,200]; % Different x and fval outputs based on x0
lb = [ 10;
10;
10];
ub = [ 50;
400;
300];
fnc = @(x) fun(x);
% options = optimoptions('simulannealbnd','StallIterLimit',4000,'TolFun',1e-20,''); <- this results in exit flag 0
rng default
[x,fval,exitflag,output] = simulannealbnd(fnc,x0,lb,ub,options)
Sample Output for different x0 and same lb,ub
1. x0 = [10.5,380,200] and using default options
> ANS: x =
   10.4875
  360.1725
  204.0897
    fval =
   0.1719 
2. x0 = [25,100,100] and using default options
> ANS: x =
10.3225
399.9853
116.3712
fval =
0.1673

Accepted Answer

Alan Weiss
Alan Weiss on 24 Aug 2020
The answer is that you are using the wrong solver, and might have a wrong idea about what is possible.
For almost all problems, simulannealbnd is not the solver of choice. If your problem is smooth, you should use MultiStart combined with fmincon to solve your problem. If your problem is nonsmooth, you should use patternsearch with several initial points. See Table for Choosing a Solver. And for why your solution can depend on the initial point, irrespective of the solver, see What Is Global Optimization?
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Comments
fizzy
fizzy on 25 Aug 2020
I was following information given here: https://in.mathworks.com/help/gads/improving-optimization-by-choosing-another-solver.html. The simulannealbnd is also in the category of "single global solution for smooth objective and constraints" (although it is recommended to use as last resort 😅).
The reason I went to it is because "global search with fmincon" was taking >=90 minutes to to complete while simulannealbnd does it it ~10 minutes (and the result from both solvers depend on starting point 🤷‍♂️). I will try MultiStart now to see if it's any better.
And just to be clear, if my function has many many local minima then does it mean that any of the solvers might not ever converge to a single global solution?
Alan Weiss
Alan Weiss on 25 Aug 2020
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!