'What to do when the fminunc exitflag=5?

I'm using MATLAB Optimization Toolbox's 'fminunc' to minimize a problem, but I can only get the "Local minimum possible" and not "Local minimum found", and I want to understand why.

The function I'm calling is

S = @(b) action_DBI(TR,b);
gradS = @(b) bc_mask .* action_DBI_grad(TR,b);

options = optimoptions('fminunc','Algorithm','quasi-newton',...
'SpecifyObjectiveGradient',true,'Display','iter-detailed',...
'OptimalityTolerance',1e-10,'MaxIterations',4000,'StepTolerance',1e-10);
[bopt,Sopt,exitflag,output]=fminunc({S, gradS},b0,options);

and the outcome is

Local minimun possible.

Optimization stopped because the objective function cannot be decreased in the 
current search direction. Either the predicted change in the objective function, 
or the line search interval is less than eps.

exitflag = 5

output = struct with fields:

       iterations: 352
        funcCount: 720
         stepsize: 5.5501e-09
     lssteplength: 0.0059
    firstorderopt: 4.3373e-05

The functions action_DBI and action_DBI_grad are rather lengthy, but I can share them if needed. My question is: since I get "Local minimum found" with simpler functions, is this result "bound" to my function, or is there anything I can do (options-wise, scaling-wise etc) to make sure that the local minimum is, indeed, found?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source