Optimize a function returning a single numeric value subject to a boolean constraint Utilizes a naive recursive grid search.

Description

Optimize a function returning a single numeric value subject to a boolean constraint Utilizes a naive recursive grid search.

Usage

1
2
sequentialGridSearch(f, constraint, bounds, nEach = 40, shrink = 10,
  tol = .Machine$double.eps^0.5, verbose = FALSE, ...)

Arguments

f

Function to be minimized: takes a single numeric value and returns a single numeric value.

constraint

Function of a single variable returning a single boolean value (must be TRUE to be at the optimum).

bounds

A numeric vector of length two which are the upper and lower bounds of the input to try.

nEach

Number of points n each round of grid searching to use.

shrink

Factor indicating how much (1/shrink) to narrow the search width by each round; highly recommended that shrink is at least half the size of nEach.

tol

The tolerance (epsilon).

verbose

Whether to display verbose output.

...

Arguments to pass along to constraint.

Value

The optimized input value (numeric).