Class LBFGSB
Limited-memory BFGS for bound-constrained optimization (L-BFGS-B).
public sealed class LBFGSB : OptimizationMethod
- Inheritance
-
LBFGSB
- Inherited Members
Remarks
Faithful implementation of the algorithm of Byrd, Lu, Nocedal and Zhu, "A Limited Memory Algorithm for Bound Constrained Optimization", SIAM J. Sci. Comput. 16(5):1190-1208, 1995.
Coordinates whose bound is ±MaxValue are treated as unbounded, so with no active bounds the method reduces to plain limited-memory BFGS. Explicit bounds may instead be passed to the constructor, overriding the constraint.
Limited memory trades accuracy of the Hessian model for cost: it stores only the last memory correction
pairs, needing O(memory·n) storage and work per step instead of the O(n²) of dense BFGS, at the price of linear
rather than superlinear convergence. This typically results in a modest increase in iteration count.
Immutable: each minimization keeps its correction pairs and working arrays to itself. On the relative
function-reduction stop the problem's gradient norm is the projected gradient's at the point returned, where
QuantLib's keeps the previous iterate's (Divergences/LBFGSBTests.cs). The breakpoints of the Cauchy search
are sorted stably, so equal breakpoints keep QuantLib's order up to 32 variables (MSVC's insertion sort) and their
own beyond, where MSVC's introsort reorders them.
Constructors
LBFGSB(int, double, double)
Initializes a new instance of the LBFGSB class.
public LBFGSB(int memory = 10, double pgTol = 1E-08, double fTol = 2.220446049250313E-09)
Parameters
memoryintThe number of stored correction pairs, positive.
pgToldoubleThe convergence tolerance on the infinity norm of the projected gradient.
fToldoubleThe iteration stops when the relative reduction of the objective falls below it.
Exceptions
- ArgumentOutOfRangeException
memoryisn't positive.
LBFGSB(ReadOnlySpan<double>, ReadOnlySpan<double>, int, double, double)
Initializes a new instance of the LBFGSB class with explicit box bounds, which override the bounds of the problem's constraint. Use ±MaxValue for unbounded coordinates.
public LBFGSB(ReadOnlySpan<double> lowerBound, ReadOnlySpan<double> upperBound, int memory = 10, double pgTol = 1E-08, double fTol = 2.220446049250313E-09)
Parameters
lowerBoundReadOnlySpan<double>The lower bounds, which it copies.
upperBoundReadOnlySpan<double>The upper bounds, which it copies.
memoryintThe number of stored correction pairs, positive.
pgToldoubleThe convergence tolerance on the infinity norm of the projected gradient.
fToldoubleThe iteration stops when the relative reduction of the objective falls below it.
Exceptions
- ArgumentOutOfRangeException
memoryisn't positive.- ArgumentException
The bounds have different sizes.
Methods
MinimizeCore(ProblemState, EndCriteria)
The method's algorithm, QuantLib's minimize: minimizes from the state's current value.
protected override EndCriteriaType MinimizeCore(ProblemState P, EndCriteria endCriteria)
Parameters
PProblemStateThe working state, which the minimization changes.
endCriteriaEndCriteriaThe criteria that end the minimization.
Returns
- EndCriteriaType
The end criterion met.
Exceptions
- NanoQLException
The bounds' size doesn't match the number of variables.