l-bfgs-b-0.1.0.1: Bindings to L-BFGS-B, Fortran code for limited-memory quasi-Newton bound-constrained optimization

Safe HaskellNone

Numeric.LBFGSB

Description

Minimize functions using the Fortran L-BFGS-B library for limited-memory Broyden–Fletcher–Goldfarb–Shanno bound-constrained minimization. More information on assumptions and function parameters can be found at the L-BFGS-B homepage http://users.eecs.northwestern.edu/~nocedal/lbfgsb.html and in its source code.

A bound-constrained domain is one that is a finite product of the reals, closed intervals, and half-infinite intervals. We describe the factors by (Maybe Double, Maybe Double), with (Just a, Just b) describing the closed interval [a,b], and so forth.

Synopsis

Documentation

minimize

Arguments

:: Int

m: The maximum number of variable metric corrections used to define the limited memory matrix. Suggestion: 5.

-> Double

factr: Iteration stops when the relative change in function value is smaller than factr*eps, where eps is a measure of machine precision generated by the Fortran code. 1e12 is low accuracy, 1e7 is moderate, and 1e1 is extremely high. Must be >=1. Suggestion: 1e7.

-> Double

pgtol: Iteration stops when the largest component of the projected gradient is smaller than pgtol. Must be >=0. Suggestion: 1e-5.

-> Maybe Int

Just steps means the minimization is aborted if it has not converged after steps>0 iterations. Nothing signifies no limit.

-> [(Maybe Double, Maybe Double)]

Constraints, as described in the beginning of this module. If there are fewer bounds than components in x0, the remaining dimensions are assumed to be unbounded. [] thus gives unbounded minimization. Moreover, if there are more bounds than components in x0, only as many as needed are used. repeat (Just 0, Just 1) thus specifies the unit cube of any dimension as constraint.

-> Vector Double

x0: Starting point. The point must be within the bounds.

-> (Vector Double -> Double)

f: Function to minimize. Must take Vectors of precisely the same length as x0, or else behavior is undefined (the program may crash)!

-> (Vector Double -> Vector Double)

g: Gradient of f. Must take and return Vectors of precisely the same length as x0, or else behavior is undefined (the program may crash)! Numeric.LBFGSB.Convenience provides a simple approximation of the gradient if you do not have the real one.

-> Result 

Minimization using L-BFGS-B. If you only require the solution point, and not the full Result, see minimize'. Take care to satisfy the requirements on the arguments. Failure to do so may result in a runtime error, or, when noted, undefined behavior/crash.

minimize' :: Int -> Double -> Double -> Maybe Int -> [(Maybe Double, Maybe Double)] -> Vector Double -> (Vector Double -> Double) -> (Vector Double -> Vector Double) -> Maybe (Vector Double)

If L-BFGS-B converges within the specified number of steps, the solution point is returned as Just solution. Otherwise Nothing is returned. The arguments are the same as for minimize.