Mercurial > hg > octave-lojdl
changeset 9199:399884c9d4a1
import the step adaptation strategy from fsolve to fminunc
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 15 May 2009 07:07:41 +0200 |
parents | 3b9aacf07744 |
children | 72620af9cbaf |
files | scripts/ChangeLog scripts/optimization/fminunc.m |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2009-05-14 Jaroslav Hajek <highegg@gmail.com> + + * optimization/fminunc.m: Import the step adaptation strategy + improvements from fsolve. + 2009-05-08 Ben Abbott <bpabbott@mac.com> * plot/__gnuplot_has_feature__.m: Add feature "key_has_font_properties".
--- a/scripts/optimization/fminunc.m +++ b/scripts/optimization/fminunc.m @@ -137,6 +137,7 @@ endif nsuciter = 0; + lastratio = 0; grad = []; @@ -230,7 +231,7 @@ endif ## Update delta. - if (ratio < 0.1) + if (ratio < min(max(0.1, lastratio), 0.9)) delta *= 0.5; if (delta <= 1e1*macheps*xn) ## Trust region became uselessly small. @@ -238,6 +239,7 @@ break; endif else + lastratio = ratio; if (abs (1-ratio) <= 0.1) delta = 2*sn; elseif (ratio >= 0.5)