physbo.search.optimize.random module

class physbo.search.optimize.random.Optimizer(min_X, max_X, nsamples, rng=None, constraint=None, max_trials_per_point=None)[source]

Bases: object

Random search for the maximum of a function within bounds.

Parameters:
  • min_X (array_like) – Lower and upper bounds of each dimension.

  • max_X (array_like) – Lower and upper bounds of each dimension.

  • nsamples (int) – The number of points sampled uniformly within the bounds, divided among the processes in a parallel run.

  • rng (int, numpy.random.SeedSequence, numpy.random.Generator or None, optional) – Random number generator for the samples; None (default) uses the global numpy.random state. In a parallel run every process draws its own samples from its own generator.

  • constraint (callable, optional) – A function from an array of shape (N, d) to a boolean array of N elements (True for feasible points). If given, the samples are feasible points drawn by rejection sampling (on every process for its own share of the samples).

  • max_trials_per_point (int, optional) – The rejection sampling of N feasible points is given up after max_trials_per_point * N draws. Default is the class attribute of the same name (10000).

max_trials_per_point = 10000

Rejection sampling of N feasible points is given up after max_trials_per_point * N samples.