Learn R Programming

dfoptim (version 2011.7-2)

nmkb: Box-Constrained Nelder-Mead optimziation algorithm for derivative-free optimization

Description

An implementation of the Nelder-Mead algorithm for derivative-free optimization. This allows bounds to be placed on parameters. Bounds are enforced by means of a parameter transformation.

Usage

nmkb(par, fn, lower, upper, control = list(), ...)

Arguments

Value

A list with the following components:parBest estimate of the parameter vector found by the algorithm.valueThe value of the objective function at termination.fevalThe number of times the objective fn was evaluated.restartsThe number of times the algorithm had to be restarted when it stagnated.convergenceAn integer code indicating type of convergence. 0 indicates successful convergence. Positive integer codes indicate failure to converge.messageText message indicating the type of convergence or failure.itransAn integer {1,2,3,4 } indicating which parameter mapping was used to transform from constrained to unconstrained parameter space.

Details

Argument control is a list specifing any changes to default values of algorithm control parameters for the outer loop. Note that the names of these must be specified completely. Partial matching will not work. The list items are as follows: tol Convergence tolerance. Iteration is terminated when the absolute difference in function value between successive iteration is below tol. Default is 1.e-06. maxfeval: Maximum number of objective function evaluations allowed. Default is min(5000, max(2500, 20*length(par)^2)). regsimp A logical variable indicating whether the starting parameter configuration is a regular simplex. Default is TRUE. maximize A logical variable indicating whether the objective function should be maximized. Default is FALSE. restarts.max Maximum number of times the algorithm should be restarted before declaring failure. Default is 3. trace A logical variable indicating whether the starting parameter configuration is a regular simplex. Default is FALSE. itrans An integer {1,2,3,4 } indicating which parameter mapping should be used to transform from constrained to unconstrained parameter space. Four types of transformations are implemented. Default is 1.

References

C.T. Kelley (1999), Iterative Methods for Optimization, SIAM.

See Also

optim, nmk, hjk

Examples

Run this code
rosbkext <- function(x){
# Extended Rosenbrock function
 n <- length(x)
 sum (100*(x[1:(n-1)]^2 - x[2:n])^2 + (x[1:(n-1)] - 1)^2)
 }

np <- 10
set.seed(123)

p0 <- rnorm(np)
xm1 <- nmk(fn=rosbkext, par=p0) # maximum `fevals' is not sufficient to find correct minimum
xm1b <- nmkb(fn=rosbkext, par=p0, lower=-2, upper=2)

### A non-smooth problem
hald <- function(x) {
#Hald J & Madsen K (1981), Combined LP and quasi-Newton methods for minimax optimization, Mathematical Programming, 20, p.42-62.
	i <- 1:21
	t <- -1 + (i - 1)/10
	f <- (x[1] + x[2] * t) / ( 1 + x[3]*t + x[4]*t^2 + x[5]*t^3) - exp(t)
	max(abs(f))
	}

p0 <- runif(5)
xm2 <- nmk(fn=hald, par=p0)
xm2b <- nmkb(fn=hald, par=p0, lower=c(0,0,0,0,-2), upper=4)

Run the code above in your browser using DataLab