Fixed several bugs in OW-LQN.
git-svn-id: file:///home/svnrepos/software/liblbfgs/trunk@29 ecf4c44f-38d1-4fa4-9757-a0b4dd0349fc
This commit is contained in:
parent
1cb0436e32
commit
fb183a2880
18
lib/lbfgs.c
18
lib/lbfgs.c
@ -663,10 +663,11 @@ static int line_search_backtracking_owlqn(
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
// Update the current point.
|
||||
veccpy(x, xp, n);
|
||||
vecadd(x, s, *stp, n);
|
||||
|
||||
/* The current point is projected onto the orthant of the initial one. */
|
||||
/* The current point is projected onto the orthant. */
|
||||
owlqn_project(x, wp, param->orthantwise_start, param->orthantwise_end);
|
||||
|
||||
/* Evaluate the function and gradient values. */
|
||||
@ -680,18 +681,23 @@ static int line_search_backtracking_owlqn(
|
||||
|
||||
dgtest = 0.;
|
||||
for (i = 0;i < n;++i) {
|
||||
dgtest += (x[i] - xp[i]) * g[i];
|
||||
dgtest += (x[i] - xp[i]) * gp[i];
|
||||
}
|
||||
|
||||
if (*f <= finit + param->ftol * dgtest) {
|
||||
/* The sufficient decrease condition. */
|
||||
return count;
|
||||
}
|
||||
|
||||
if (*stp < param->min_step) {
|
||||
/* The step is the minimum value. */
|
||||
ret = LBFGSERR_MINIMUMSTEP;
|
||||
break;
|
||||
}
|
||||
if (*stp > param->max_step) {
|
||||
/* The step is the maximum value. */
|
||||
return LBFGSERR_MAXIMUMSTEP;
|
||||
}
|
||||
if (param->max_linesearch <= count) {
|
||||
/* Maximum number of iteration. */
|
||||
ret = LBFGSERR_MAXIMUMLINESEARCH;
|
||||
@ -776,6 +782,10 @@ static int line_search_backtracking_loose(
|
||||
ret = LBFGSERR_MINIMUMSTEP;
|
||||
break;
|
||||
}
|
||||
if (*stp > param->max_step) {
|
||||
/* The step is the maximum value. */
|
||||
return LBFGSERR_MAXIMUMSTEP;
|
||||
}
|
||||
if (param->max_linesearch <= count) {
|
||||
/* Maximum number of iteration. */
|
||||
ret = LBFGSERR_MAXIMUMLINESEARCH;
|
||||
@ -874,6 +884,10 @@ static int line_search_backtracking_strong_wolfe(
|
||||
ret = LBFGSERR_MINIMUMSTEP;
|
||||
break;
|
||||
}
|
||||
if (*stp > param->max_step) {
|
||||
/* The step is the maximum value. */
|
||||
return LBFGSERR_MAXIMUMSTEP;
|
||||
}
|
||||
if (param->max_linesearch <= count) {
|
||||
/* Maximum number of iteration. */
|
||||
ret = LBFGSERR_MAXIMUMLINESEARCH;
|
||||
|
Loading…
Reference in New Issue
Block a user