optim2 {calibrar} | R Documentation |
General-purpose optimization with parallel numerical gradient computation
Description
General-purpose optimization with parallel numerical gradient computation
Usage
optim2(
par,
fn,
gr = NULL,
...,
method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", "Brent", "nlm", "nlminb",
"Rcgmin", "Rvmmin", "hjn", "spg", "LBFGSB3", "AHR-ES"),
lower = -Inf,
upper = +Inf,
active = NULL,
control = list(),
hessian = FALSE,
parallel = FALSE
)
Arguments
par |
A numeric vector or list. The length of the par argument defines the number of parameters to be estimated (i.e. the dimension of the problem). |
fn |
The function to be minimized. |
gr |
A function computing the gradient of |
... |
Additional parameters to be passed to |
method |
The optimization method to be used. The default method is the AHR-ES (Adaptative Hierarchical Recombination Evolutionary Strategy, Oliveros-Ramos & Shin, 2016). See details for the methods available. |
lower |
Lower threshold value(s) for parameters. One value or a vector
of the same length as par. If one value is provided, it is used for all
parameters. |
upper |
Upper threshold value(s) for parameters. One value or a vector
of the same length as par. If one value is provided, it is used for all
parameters. |
active |
Boolean vector of the same length as par, indicating if the parameter is used in the optimization (TRUE) or hold at a fixed value (FALSE). |
control |
Parameter for the control of the algorithm itself, see details. |
hessian |
Logical. Should a numerically differentiated Hessian matrix be returned? Currently not implemented. |
parallel |
Logical. Use parallel computation numerical of gradient? |
Value
A list with components:
- par
The best set of parameters found.
- value
The value of fn corresponding to par.
- counts
A two-element integer vector giving the number of calls to fn and gr respectively. This excludes those calls needed to compute the Hessian, if requested, and any calls to fn to compute a finite-difference approximation to the gradient.
- convergence
An integer code. 0 indicates successful completion.
- message
A character string giving any additional information returned by the optimizer, or NULL.
- hessian
Only if argument hessian is true. A symmetric matrix giving an estimate of the Hessian at the solution found. Note that this is the Hessian of the unconstrained problem even if the box constraints are active.
Author(s)
Ricardo Oliveros-Ramos
See Also
Other optimisers:
ahres()
,
calibrate()
,
optimh()
Examples
optim2(par=rep(NA, 5), fn=sphereN)