MATLAB: Fminunc : Stopping critrea related to the gradient

fminuncsttoping critrea

I want to use fminunc, and I have read a little about it, so it stops for some critera and tolerances fixed at the beginning. My questions are : 1) what's this stopping critrea that make fminunc stop? 2) Could I put a critrea on the norm of the gradient to force fminunc to stop

Best Answer

The documentation on the stopping criteria has always been vague. Basically, though, TolX triggers a stop when the change in x is too small, TolFun triggers a stop when the change in the function value is too small or the gradient magnitude gets sufficiently small. How the thresholds are derived from the values of TolFun and TolX is not documented consistently and varies among different solvers that use these parameters. Stopping will also occur if the number of function evaluations (MaxFunEvals) or the number of iterations (MaxIter) exceeds the values of those parameters.
You can add your own stopping criterion using the OutputFcn option. You write the Output Function to return a 'stop' flag when your criterion is met.