| subplex {subplex} | R Documentation |
subplex minimizes a function.
subplex(par, fn, tol = .Machine$double.eps, maxnfe = 10000, scale = 1,
hessian = FALSE, ...)
par |
Initial guess of the parameters to be optimized over. |
fn |
The function to be minimized. Its first argument must be the vector of parameters to be optimized over. It should return a scalar result. |
tol |
The relative optimization tolerance. This must be a positive number. |
maxnfe |
Maximum number of function evaluations to perform before giving up. |
scale |
The scale and initial stepsizes for the components of
par. This must either be a single scalar, in which case the
same scale is used for all parameters, or a vector of length equal
to the length of par. |
hessian |
If hessian=TRUE, the Hessian of the objective at
the estimated optimum will be numerically computed. |
... |
Additional arguments to be passed to the function
fn. |
The convergence codes are as follows:
maxnfetol satisfiedpar |
Estimated parameters that minimize the function. |
value |
Minimized value of the function. |
count |
Number of function evaluations required. |
convergence |
Convergence code (see Details). |
message |
A character string giving a diagnostic message from the optimizer, or 'NULL'. |
hessian |
Hessian matrix. |
Aaron A. King kingaa@umich.edu
T. Rowan, "Functional Stability Analysis of Numerical Algorithms", Ph.D. thesis, Department of Computer Sciences, University of Texas at Austin, 1990.
rosen <- function (x) { ## Rosenbrock Banana function
x1 <- x[1]
x2 <- x[2]
100*(x2-x1*x1)^2+(1-x1)^2
}
subplex(par=c(11,-33),fn=rosen)
rosen2 <- function (x) {
X <- matrix(x,ncol=2)
sum(apply(X,1,rosen))
}
subplex(par=c(-33,11,14,9,0,12),fn=rosen2,maxnfe=30000)
ripple <- function (x) {
r <- sqrt(sum(x^2))
1-exp(-r^2)*cos(10*r)^2
}
subplex(par=c(1),fn=ripple,hessian=TRUE)
subplex(par=c(0.1,3),fn=ripple,hessian=TRUE)
subplex(par=c(0.1,3,2),fn=ripple,hessian=TRUE)
rosen <- function (x, g = 0, h = 0) { ## Rosenbrock Banana function (using names)
x1 <- x['a']
x2 <- x['b']-h
100*(x2-x1*x1)^2+(1-x1)^2+g
}
subplex(par=c(b=11,a=-33),fn=rosen,h=22,tol=1e-9,scale=5,hessian=TRUE)