| l_bfgs_b | R Documentation |
Performs bound-constrained minimization using the L-BFGS-B algorithm. This implementation handles box constraints via Generalized Cauchy Point (GCP) estimation and subspace minimization, featuring a limited-memory (two-loop recursion) inverse Hessian approximation.
l_bfgs_b(
start,
objective,
gradient = NULL,
hessian = NULL,
lower = -Inf,
upper = Inf,
control = list(),
...
)
start |
Numeric vector. Initial values for the parameters. |
objective |
Function. The scalar objective function to be minimized. |
gradient |
Function (optional). Returns the gradient vector. If |
hessian |
Function (optional). Returns the Hessian matrix. Used for final
positive definiteness verification if |
lower, upper |
Numeric vectors. Lower and upper bounds for the parameters. Can be scalars if all parameters share the same bounds. |
control |
A list of control parameters:
|
... |
Additional arguments passed to objective, gradient, and Hessian functions. |
A list containing optimization results and metadata.
This function adds three features for rigorous convergence control. First, it
applies an AND rule: all selected convergence criteria must be satisfied
simultaneously. Second, users can choose among eight distinct criteria
(e.g., changes in f, x, gradient, or predicted decrease) instead of relying
on fixed defaults. Third, it provides an optional verification using the
Hessian computed from derivatives (analytically when provided, or via numerical
differentiation). Checking the positive definiteness of this Hessian at the final
solution reduces the risk of declaring convergence at non-minimizing stationary
points, such as saddle points.
Byrd, R. H., Lu, P., Nocedal, J., & Zhu, C. (1995). A limited memory algorithm for bound constrained optimization. SIAM Journal on Scientific Computing, 16(5), 1190-1208.
Morales, J. L., & Nocedal, J. (2011). L-BFGS-B: Remark on algorithm 778: L-BFGS-B: Fortran subroutines for large-scale bound-constrained optimization. ACM Transactions on Mathematical Software, 38(1), 1-4.
quad <- function(x) (x[1] - 2)^2 + (x[2] + 1)^2
res <- l_bfgs_b(start = c(0, 0), objective = quad)
print(res$par)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.