dds: Dynamically dimensioned search

Description Usage Arguments Value Author(s) References Examples

Description

An inplementation of the dynamically dimensioned search (DDS) algorithm for stochastic optimization of computationally expensive objective functions. The algorithm gradually shifts from global to local search.

Usage

1
dds(fn, p, m = 10, r = 0.2, plot = FALSE, ...)

Arguments

fn

Objective function. This function must accept as its first argument a named numeric vector of parameters. It must return a named numeric vector (which can be of length 1). The algorithm attempts to minimize fn with respect to the first element of its return vector, i.e. additional elements are fro diagnostic purposes only.

p

Data frame with initial values and bounds for all parameters. The expected column names are 'name', 'initial', 'min', and 'max'.

m

Requested number of function evaluations (integer). This is the only stopping criterion of the algorithm.

r

Numeric algorithm parameter (default 0.2). It controls the jump length during generation of new parameters sets.

plot

Logical. It TRUE the value of fn (first element only) is plotted after each evaluation.

...

Additional arguments passed to function fn.

Value

A list with the following elements

Author(s)

David Kneis david.kneis@tu-dresden.de

References

The original algorithm is described in Tolson, B. A. and Shoemaker, C. A. (2007): Dynamically dimensioned search algorithm for computationally efficient watershed model calibration, Water Resources Research, 43, W01413, doi:10.1029/2005WR004723.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Fitting coefficients of an ordinary linear model
nobs= 100
obs= data.frame(x=1:nobs, y=1:nobs + (1:nobs)*(runif(nobs)-0.5))
model= function(p, x) { p["slope"] * x + p["intercept"] }
objfun= function(p, obs) { c(sse= sum((obs$y - model(p, obs$x))^2)) }
p= data.frame(
  name=c("slope","intercept"),
  min= c(-1, -50),
  max= c(4, 50),
  initial= 0, 20
)
opt= dds(fn=objfun, p=p, m=250, r=0.2, obs=obs)
layout(matrix(c(1,2,3,4), ncol=2, byrow=TRUE))
plot(obs)
lines(range(obs$x), model(p=opt$p_best, x=range(obs$x)))
# trace of function
plot(0:(nrow(opt$f_trace)-1), opt$f_trace$sse, type="l",
  xlab="iter",ylab="sse")
# trace of pars
plot(0:(nrow(opt$p_trace)-1), opt$p_trace$slope, type="l",
  xlab="iter",ylab="slope")
plot(0:(nrow(opt$p_trace)-1), opt$p_trace$intercept, type="l",
  xlab="iter",ylab="intercept")
layout(matrix(1))

dkneis/mcu documentation built on May 15, 2019, 9:12 a.m.

Related to dds in dkneis/mcu...