binsearchtol: binary search with arbitrary resolution

Description Usage Arguments See Also Examples

View source: R/feasibility_check.R

Description

The binsearch function in the gtools package searches only over integers. This is a wrapper for binsearch that also allows searching over the grid of points with distance tol between them. A target must also be entered (see binsearch)

Usage

1
binsearchtol(fun, tol = 1, range, ...)

Arguments

fun

a function that determines the output over which we search (passed to binsearch)

tol

resolution of the grid over which to search for target (see binsearch)

range

a range over which to search for the input to fun

...

passed to binsearch

See Also

binsearch

Examples

1
2
3
4
5
6
 # best solution here is at x0,
 # which we can find with increasing precision
 x0 <- 10.241
 binsearchtol( function(x) x-x0, target=0, range=c(0,2*x0) , tol=1.00)
 binsearchtol( function(x) x-x0, target=0, range=c(0,2*x0) , tol=0.10)
 binsearchtol( function(x) x-x0, target=0, range=c(0,2*x0) , tol=0.05)

aaronjfisher/designOptim documentation built on April 3, 2018, 8:25 p.m.