Skip to content

Modern Fortran Refactoring of L-BFGS-B Nonlinear Optimization Code

License

Notifications You must be signed in to change notification settings

jacobwilliams/lbfgsb

Repository files navigation

LBFGSB

This is a modern Fortran refactoring of the L-BFGS-B limited memory code for solving bound constrained optimization problems [L-BFGS-B version 3.0, march, 2011].

This is a work in progress.

Language GitHub release Build Status codecov

Compiling

The library can be compiled with recent versions the Intel Fortran Compiler and GFortran (and presumably any other Fortran compiler that supports modern standards).

A fpm.toml file is provided for compiling LBFGSB with the Fortran Package Manager. For example, to build:

fpm build --profile release

By default, the library is built with double precision (real64) real values. Explicitly specifying the real kind can be done using the following processor flags:

Preprocessor flag Kind Number of bytes
REAL32 real(kind=real32) 4
REAL64 real(kind=real64) 8
REAL128 real(kind=real128) 16

For example, to build a single precision version of the library, use:

fpm build --profile release --flag "-DREAL32"

To run the unit tests:

fpm test --profile release

Documentation

  • The latest API documentation can be found here. This was generated from the source code using FORD (i.e. by running ford ford.md).

  • The following four articles were also included in the original package:

    1. algorithm.pdf - describes the algorithm
    2. compact.pdf - presents the compact form of matrices
    3. code.pdf - describes the code
    4. acm-remark.pdf - describes the modification/correction

The most useful articles for those who only wish to use the code are [3,4]. Users interested in understanding the algorithm should read [1] and possibly also [2].

How to use L-BFGS-B

The simplest way to use the code is to modify one of the drivers provided in the package. Most users will only need to make a few changes to the drivers to run their applications.

The user is required to calculate the function value f and its gradient g. In order to allow the user complete control over these computations, reverse communication is used. The routine setulb must be called repeatedly under the control of the variable task.

License

L-BFGS-B is released under the "New BSD License" (aka "Modified BSD License" or "3-clause license") Please read attached file License.txt

References