66. lbfgs

66.1 Introduction to lbfgs

lbfgs is an implementation of the L-BFGS algorithm [1]
to solve unconstrained minimization problems via a limited-memory quasi-Newton (BFGS) algorithm.
It is called a limited-memory method because a low-rank approximation of the
Hessian matrix inverse is stored instead of the entire Hessian inverse.
The program was originally written in Fortran [2] by Jorge Nocedal,
incorporating some functions originally written by Jorge J. Moré and David J. Thuente,
and translated into Lisp automatically via the program f2cl.
The Maxima package lbfgs comprises the translated code plus
an interface function which manages some details.

66.2 Functions and Variables for lbfgs

Finds an approximate solution of the unconstrained minimization of the figure of merit FOM
over the list of variables X,
starting from initial estimates X0,
such that norm(grad(FOM)) < epsilon*max(1, norm(X)).

grad, if present, is the gradient of FOM with respect to the variables X.
grad may be a list or a function that returns a list, with one element for each element of X.
If not present, the gradient is computed automatically by symbolic differentiation.
If FOM is a function, the gradient grad must be supplied by the user.

The algorithm applied is a limited-memory quasi-Newton (BFGS) algorithm [1].
It is called a limited-memory method because a low-rank approximation of the
Hessian matrix inverse is stored instead of the entire Hessian inverse.
Each iteration of the algorithm is a line search, that is,
a search along a ray in the variables X,
with the search direction computed from the approximate Hessian inverse.
The FOM is always decreased by a successful line search.
Usually (but not always) the norm of the gradient of FOM also decreases.

iprint controls progress messages printed by lbfgs.

iprint[1]

iprint[1] controls the frequency of progress messages.

iprint[1] < 0

No progress messages.

iprint[1] = 0

Messages at the first and last iterations.

iprint[1] > 0

Print a message every iprint[1] iterations.

iprint[2]

iprint[2] controls the verbosity of progress messages.

iprint[2] = 0

Print out iteration count, number of evaluations of FOM, value of FOM,
norm of the gradient of FOM, and step length.

iprint[2] = 1

Same as iprint[2] = 0, plus X0 and the gradient of FOM evaluated at X0.

iprint[2] = 2

Same as iprint[2] = 1, plus values of X at each iteration.

iprint[2] = 3

Same as iprint[2] = 2, plus the gradient of FOM at each iteration.

The columns printed by lbfgs are the following.

I

Number of iterations. It is incremented for each line search.

NFN

Number of evaluations of the figure of merit.

FUNC

Value of the figure of merit at the end of the most recent line search.

GNORM

Norm of the gradient of the figure of merit at the end of the most recent line search.

STEPLENGTH

An internal parameter of the search algorithm.

Additional information concerning details of the algorithm are found in the
comments of the original Fortran code [2].

The same FOM as computed by FGCOMPUTE in the program sdrive.f in the LBFGS package from Netlib.
Note that the variables in question are subscripted variables.
The FOM has an exact minimum equal to zero at u[k] = 1 for k = 1, ..., 8.

A regression problem.
The FOM is the mean square difference between the predicted value F(X[i])
and the observed value Y[i].
The function F is a bounded monotone function (a so-called "sigmoidal" function).
In this example, lbfgs computes approximate values for the parameters of F
and plot2d displays a comparison of F with the observed data.