multivariate-optimization {fntl} | R Documentation |
Multivariate Optimization
Description
Multivariate Optimization
Usage
cg1(init, f, g, args)
cg2(init, f, args)
bfgs1(init, f, g, args)
bfgs2(init, f, args)
lbfgsb1(init, f, g, args)
lbfgsb2(init, f, args)
neldermead(init, f, args)
nlm1(init, f, g, h, args)
nlm2(init, f, g, args)
nlm3(init, f, args)
Arguments
init |
Initial value |
f |
Function |
g |
Gradient function of |
args |
List of additional arguments for optimization. |
h |
Hessian function of |
Details
The argument args
should be a list constructed from one of the following
functions:
-
bfgs_args
for BFGS; -
lbfgsb_args
for L-BFGS-B; -
cg_args
for CG; -
neldermead_args
for Nelder-Mead; -
nlm_args
for the Newton-type algorithm used innlm
.
When g
or h
are omitted, the gradient or Hessian will be respectively
be computed via finite differences.
Value
A list with results corresponding to the specified function. See the package vignette for further details.
-
cg1
andcg2
return acg_result
which is documented in the section "Conjugate Gradient". -
bfgs1
andbfgs2
return abfgs_result
which is documented in the section "BFGS". -
lbfgsb1
andlbfgsb2
return albfgsb_result
which is documented in the section "L-BFGS-B". -
neldermead
returns aneldermead_result
which is documented in the section "Nelder-Mead". -
nlm1
,nlm2
, andnlm3
return anlm_result
which is documented in the section "Newton-Type Algorithm for Nonlinear Optimization".
Examples
f = function(x) { sum(x^2) }
g = function(x) { 2*x }
h = function(x) { 2*diag(length(x)) }
x0 = c(1,1)
args = cg_args()
cg1(x0, f, g, args)
cg2(x0, f, args)
args = bfgs_args()
bfgs1(x0, f, g, args)
bfgs2(x0, f, args)
args = lbfgsb_args()
lbfgsb1(x0, f, g, args)
lbfgsb2(x0, f, args)
args = neldermead_args()
neldermead(x0, f, args)
args = nlm_args()
nlm1(x0, f, g, h, args)
nlm2(x0, f, g, args)
nlm3(x0, f, args)