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:
parent
f8b53433f9
commit
6375811810
@ -153,11 +153,12 @@ enum {
|
|||||||
/** MoreThuente method proposd by More and Thuente. */
|
/** MoreThuente method proposd by More and Thuente. */
|
||||||
LBFGS_LINESEARCH_MORETHUENTE = 0,
|
LBFGS_LINESEARCH_MORETHUENTE = 0,
|
||||||
/** Backtracking method with strong Wolfe condition. */
|
/** Backtracking method with strong Wolfe condition. */
|
||||||
LBFGS_LINESEARCH_BACKTRACKING_STRONG = 1,
|
LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE = 1,
|
||||||
/** Backtracking method with regular Wolfe condition. */
|
/** Backtracking method with regular Wolfe condition. */
|
||||||
LBFGS_LINESEARCH_BACKTRACKING = 2,
|
LBFGS_LINESEARCH_BACKTRACKING = 2,
|
||||||
/** Backtracking method with regular Wolfe condition. */
|
LBFGS_LINESEARCH_BACKTRACKING_WOLFE = 2,
|
||||||
LBFGS_LINESEARCH_BACKTRACKING_LOOSE = 2,
|
/** Backtracking method with Armijo condition. */
|
||||||
|
LBFGS_LINESEARCH_BACKTRACKING_ARMIJO = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
40
lib/lbfgs.c
40
lib/lbfgs.c
@ -347,8 +347,9 @@ int lbfgs(
|
|||||||
case LBFGS_LINESEARCH_MORETHUENTE:
|
case LBFGS_LINESEARCH_MORETHUENTE:
|
||||||
linesearch = line_search_morethuente;
|
linesearch = line_search_morethuente;
|
||||||
break;
|
break;
|
||||||
case LBFGS_LINESEARCH_BACKTRACKING:
|
case LBFGS_LINESEARCH_BACKTRACKING_ARMIJO:
|
||||||
case LBFGS_LINESEARCH_BACKTRACKING_STRONG:
|
case LBFGS_LINESEARCH_BACKTRACKING_WOLFE:
|
||||||
|
case LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE:
|
||||||
linesearch = line_search_backtracking;
|
linesearch = line_search_backtracking;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -680,26 +681,33 @@ static int line_search_backtracking(
|
|||||||
|
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
if (*f <= finit + *stp * dgtest) {
|
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;
|
width = dec;
|
||||||
} else if (dg < wolfe * dginit) {
|
} 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;
|
width = inc;
|
||||||
} else {
|
} else {
|
||||||
/* Strong Wolfe condition. */
|
if(param->linesearch == LBFGS_LINESEARCH_BACKTRACKING_WOLFE) {
|
||||||
|
/* Exit with the regular Wolfe condition. */
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* Exit with the loose Wolfe condition. */
|
/* Check the strong Wolfe condition. */
|
||||||
return count;
|
if(dg > -wolfe * dginit) {
|
||||||
}
|
|
||||||
} else {
|
|
||||||
width = dec;
|
width = dec;
|
||||||
|
} else {
|
||||||
|
/* Exit with the strong Wolfe condition. */
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*stp < param->min_step) {
|
if (*stp < param->min_step) {
|
||||||
|
Loading…
Reference in New Issue
Block a user