MATLAB: Fminsearch how to stop optimization if constantly return Inf and continue to use a new set of initial values

fminsearchinf valuesoptimization

I feed fminsearch with a pre-defined grids of initial values. Some initial values result in Inf function value. I want to stop the optimization when detecting constantly many Inf returns, and proceeds to another set of initial values. Any advice?

Best Answer

Use the OutputFcn option to define your own stopping criteria.