MATLAB: Finding a single global solution

MATLABminimummultivariableoptimizationsimulannealbnd

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

Best Answer

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