Bases: optunity.solvers.util.Solver
Please refer to Random Search for more details about this algorithm.
Initializes the solver with bounds and a number of allowed evaluations. kwargs must be a dictionary of parameter-bound pairs representing the box constraints. Bounds are a 2-element list: [lower_bound, upper_bound].
>>> s = RandomSearch(x=[0, 1], y=[-1, 2], num_evals=50)
>>> s.bounds['x']
[0, 1]
>>> s.bounds['y']
[-1, 2]
>>> s.num_evals
50
Maximizes f.
Parameters: |
|
---|---|
Returns: |
|
Minimizes f.
Parameters: |
|
---|---|
Returns: |
|
Optimizes f.
Parameters: |
|
---|---|
Returns: |
|
Creates a GridSearch solver that uses num_evals evaluations within given bounds (lb, ub). The bounds are first tightened, resulting in new bounds covering 99% of the area.
>>> s = RandomSearch.suggest_from_box(30, x=[0, 1], y=[-1, 0], z=[-1, 1])
>>> s['x']
[0.005, 0.995]
>>> s['y']
[-0.995, -0.005]
>>> s['z']
[-0.99, 0.99]
>>> s['num_evals']
30