LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
kpcfit_ph_outfun.m
1function stop = kpcfit_ph_outfun(x,optimValues,state)
2global stagnval;
3global stagniter;
4global lgkx;
5stop = false;
6if ~isnan(optimValues.fval) & sum(isnan(x)) == 0
7 lgkx = x; % last good known solution
8else
9 stop = true;
10 %fprintf(' optimization halted: numerical difficulties\n')
11end
12if stagnval == 0
13 stagnval = optimValues.fval;
14end
15delta = abs(optimValues.fval-stagnval)/stagnval;
16if delta < 0.01
17 stagniter = stagniter + 1;
18 if stagniter == 100
19 %fprintf(' optimization halted: stagnation ')
20 stop = true;
21 end
22else
23 stagniter = 0;
24end
25stagnval = optimValues.fval;
26end