Are my optimset conditions functioning correctly?

1 view (last 30 days)
I'm currently using the fminsearch routine to parameterise a function I have developed. I have set the following code for my optimisation routine:
options = optimset('Display','iter','MaxIter',400,'MaxFunEvals',400,'TolFun',0.001,'TolX',0.001);
z_optimal = fminsearch(@(z) PBM_optimalRK4(m,SieveFrac,SelFunc,BrkFunc,z,f_0,t_max,ExpRes(:,b),ySrl,dt),z,options);
My understanding is that when my objective function change is less than 0.001 from one iteration to the next the optimisation routine should end. However as you can see from the attached picture this isn't happening and is instead ending when the maximum number of function evaluations (400) has been reached. This has the undesired effect of increasing execution time for program. Would anyone happen to know why this is? And what can be done about it if so?
Thanks, Gary

Answers (1)

Alan Weiss
Alan Weiss on 9 Nov 2015
Unlike other optimization algorithms, fminsearch stops when it satisfies BOTH the TolX and TolFun tolerances, not when it satisfies just one tolerance. You can see this by examining the fminsearch function at around line 300.
edit fminsearch
I will have to make that clear in the documentation. Sorry for not doing so earlier.
Alan Weiss
MATLAB mathematical toolbox documentation

Categories

Find more on Optimization in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!