Evaluate an unconstrained cost function on a grid of points around a given initial point estimate.
fmin.gridsearch(fun = NULL, x0 = NULL, xmin = NULL,
xmax = NULL, npts = 3, alpha = 10)
An unconstrained cost function returning a numeric scalar, similar
to those used in the fminsearch
function.
The initial point estimate, provided as a numeric vector.
Optional: a vector of lower bounds.
Optional: a vector of upper bounds.
An integer scalar greater than 2, indicating the number of evaluation points will be used on each dimension to build the search grid.
A vector of numbers greater than 1, which give the factor(s) used
to calculate the evaluation range of each dimension of the search grid (see
Details). If alpha
length is lower than that of x0
, elements
of alpha
are recycled. If its length is higher than that of
x0
, alpha
is truncated.
Return a data.frame with the coordinates of the evaluation point, the value of the cost function and its feasibility. Because the cost function is unconstrained, it is always feasible. The data.frame is ordered by feasibility and increasing value of the cost function.
fmin.gridsearch
evaluates the cost function at each point
of a grid of npts^length(x0)
points. If lower (xmin
) and upper
(xmax
) bounds are provided, the range of evaluation points is limited
by those bounds and alpha
is not used. Otherwise, the range of
evaluation points is defined as [x0/alpha,x0*alpha]
.
The actual evaluation of the cost function is delegated to
optimbase.gridsearch
.