cleversearch {svcm}R Documentation

Optimization over a parameter grid

Description

This function allows greedy/full grid search in any dimension.

Usage

cleversearch(fn, lower, upper, ngrid, startvalue, logscale = TRUE,
             clever = TRUE, verbose = FALSE) 

Arguments

fn a function to be minimized (or maximized), with the only argument being the parameter over which minimization is to take place. The return value must be scalar.
lower numeric vector containing the lower bounds on the parameter grid
upper numeric vector containing the upper bounds on the parameter grid
ngrid integer number determining the grid length in every dimension
startvalue optional initial value for the parameter to be optimized over
logscale logical, whether to construct the grid on logarithmic scale
clever logical, whether to perform a greedy grid search with lookup-table or a full grid evaluation. The latter is only available up to 3d.
verbose logical. Should the search process be monitored?

Details

Unless startvalue is specified, the search starts at the lower bound of the 1d parameter space or at the middle of the 2d/3d grid.

Value

A list with components

par optimal parameter value that was found.
value fn value corresponding to par.
counts number of calls to 'fn'.

See Also

optim

Examples

simplefun <- function(vec) { return(sum(vec^2)) }
opt <- cleversearch(simplefun, c(-1, -1), c(1, 1), 51, logscale=FALSE)

[Package svcm version 0.1.1 Index]