A patch from Takashi Imamichi. The backtracking line

search now supports Armijo, and regular/strong Wolfe
conditions.

git-svn-id: file:///home/svnrepos/software/liblbfgs/trunk@58 ecf4c44f-38d1-4fa4-9757-a0b4dd0349fc
This commit is contained in:
naoaki 2009-06-08 15:48:21 +00:00
parent f8b53433f9
commit 6375811810
2 changed files with 33 additions and 24 deletions

View File

@ -153,11 +153,12 @@ enum {
/** MoreThuente method proposd by More and Thuente. */
LBFGS_LINESEARCH_MORETHUENTE = 0,
/** Backtracking method with strong Wolfe condition. */
LBFGS_LINESEARCH_BACKTRACKING_STRONG = 1,
LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE = 1,
/** Backtracking method with regular Wolfe condition. */
LBFGS_LINESEARCH_BACKTRACKING = 2,
/** Backtracking method with regular Wolfe condition. */
LBFGS_LINESEARCH_BACKTRACKING_LOOSE = 2,
LBFGS_LINESEARCH_BACKTRACKING_WOLFE = 2,
/** Backtracking method with Armijo condition. */
LBFGS_LINESEARCH_BACKTRACKING_ARMIJO = 3,
};
/**

View File

@ -347,8 +347,9 @@ int lbfgs(
case LBFGS_LINESEARCH_MORETHUENTE:
linesearch = line_search_morethuente;
break;
case LBFGS_LINESEARCH_BACKTRACKING:
case LBFGS_LINESEARCH_BACKTRACKING_STRONG:
case LBFGS_LINESEARCH_BACKTRACKING_ARMIJO:
case LBFGS_LINESEARCH_BACKTRACKING_WOLFE:
case LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE:
linesearch = line_search_backtracking;
break;
default:
@ -680,26 +681,33 @@ static int line_search_backtracking(
++count;
if (*f <= finit + *stp * dgtest) {
/* The sufficient decrease condition. */
if (param->linesearch == LBFGS_LINESEARCH_BACKTRACKING_STRONG) {
/* Check the strong Wolfe condition. */
vecdot(&dg, g, s, n);
if (dg > -wolfe * dginit) {
width = dec;
} else if (dg < wolfe * dginit) {
width = inc;
} else {
/* Strong Wolfe condition. */
return count;
}
} else {
/* Exit with the loose Wolfe condition. */
return count;
}
} else {
if (*f > finit + *stp * dgtest) {
width = dec;
} else {
/* The sufficient decrease condition (Armijo condition). */
if (param->linesearch == LBFGS_LINESEARCH_BACKTRACKING_ARMIJO) {
/* Exit with the Armijo condition. */
return count;
}
/* Check the Wolfe condition. */
vecdot(&dg, g, s, n);
if (dg < wolfe * dginit) {
width = inc;
} else {
if(param->linesearch == LBFGS_LINESEARCH_BACKTRACKING_WOLFE) {
/* Exit with the regular Wolfe condition. */
return count;
}
/* Check the strong Wolfe condition. */
if(dg > -wolfe * dginit) {
width = dec;
} else {
/* Exit with the strong Wolfe condition. */
return count;
}
}
}
if (*stp < param->min_step) {