grid(func,
args=( ) ,
num_incs=None,
lower=None,
upper=None,
incs=None,
A=None,
b=None,
l=None,
u=None,
c=None,
sparseness=None,
verbosity=0,
print_prefix='
' )
| source code
|
The grid search algorithm.
- Parameters:
func (function) - The target function. This should take the parameter vector as
the first argument and return a single float.
args (tuple) - A tuple of arguments to pass to the function, if needed.
num_incs (list of int) - The number of linear increments to be used in the grid search.
The length should be equal to the number of parameters and each
element corresponds to the number of increments for the
respective parameter. This is overridden if the incs argument is
supplied.
lower (list of float) - The list of lower bounds for the linear grid search. This must
be supplied if incs is not.
upper (list of float) - The list of upper bounds for the linear grid search. This must
be supplied if incs is not.
incs (list of lists) - The parameter increment values. This overrides the num_incs,
lower, and upper arguments used in generating a linear grid.
A (numpy rank-2 array) - The linear constraint matrix A, such that A.x >= b.
b (numpy rank-1 array) - The linear constraint scalar vectors, such that A.x >= b.
l (list of float) - The lower bound constraint vector, such that l <= x <= u.
u (list of float) - The upper bound constraint vector, such that l <= x <= u.
c (function) - A user supplied constraint function.
sparseness (list of list of int) - An optional argument for defining sparsity, or regions of the
grid to not search over. This is a list whereby each element is
a list of two parameters indices. These two parameters will then
be assumed to be decoupled and the grid search space between them
will be skipped. Symmetry is not observed, so if [0, 1] is sent
in, then maybe [1, 0] should be as well.
verbosity (int) - The verbosity level. 0 corresponds to no output, 1 is standard,
and higher values cause greater and greater amount of output.
print_prefix (str) - The text to place before the printed output.
- Returns: tuple of numpy rank-1 array, float, int, str
- The optimisation information including the parameter vector at
the best grid point, the function value at this grid point, the
number of iterations (equal to the number of function calls), and
a warning.
|