ribs.emitters.GaussianEmitter

class ribs.emitters.GaussianEmitter(archive, x0, sigma0, bounds=None, batch_size=64, seed=None)[source]

Emits solutions by adding Gaussian noise to existing archive solutions.

If the archive is empty, calls to ask() will generate solutions from a user-specified Gaussian distribution with mean x0 and standard deviation sigma0. Otherwise, this emitter selects solutions from the archive and generates solutions from a Gaussian distribution centered around each solution with standard deviation sigma0.

This is the classic variation operator presented in Mouret 2015.

Parameters
  • archive (ribs.archives.ArchiveBase) – An archive to use when creating and inserting solutions. For instance, this can be ribs.archives.GridArchive.

  • x0 (array-like) – Center of the Gaussian distribution from which to sample solutions when the archive is empty.

  • sigma0 (float or array-like) – Standard deviation of the Gaussian distribution, both when the archive is empty and afterwards. Note we assume the Gaussian is diagonal, so if this argument is an array, it must be 1D.

  • bounds (None or array-like) – Bounds of the solution space. Solutions are clipped to these bounds. Pass None to indicate there are no bounds. Alternatively, pass an array-like to specify the bounds for each dim. Each element in this array-like can be None to indicate no bound, or a tuple of (lower_bound, upper_bound), where lower_bound or upper_bound may be None to indicate no bound.

  • batch_size (int) – Number of solutions to return in ask().

  • seed (int) – Value to seed the random number generator. Set to None to avoid a fixed seed.

Raises

ValueError – There is an error in the bounds configuration.

Methods

ask()

Creates solutions by adding Gaussian noise to elites in the archive.

tell(solutions, objective_values, …[, …])

Inserts entries into the archive.

Attributes

archive

The archive which stores solutions generated by this emitter.

batch_size

Number of solutions to return in ask().

lower_bounds

(solution_dim,) array with lower bounds of solution space.

sigma0

Standard deviation of the (diagonal) Gaussian distribution.

solution_dim

The dimension of solutions produced by this emitter.

upper_bounds

(solution_dim,) array with upper bounds of solution space.

x0

Center of the Gaussian distribution from which to sample solutions when the archive is empty.

ask()[source]

Creates solutions by adding Gaussian noise to elites in the archive.

If the archive is empty, solutions are drawn from a (diagonal) Gaussian distribution centered at self.x0. Otherwise, each solution is drawn from a distribution centered at a randomly chosen elite. In either case, the standard deviation is self.sigma0.

Returns

(batch_size, solution_dim) array – contains batch_size new solutions to evaluate.

tell(solutions, objective_values, behavior_values, metadata=None)

Inserts entries into the archive.

This base class implementation (in EmitterBase) simply inserts entries into the archive by calling add(). It is enough for simple emitters like GaussianEmitter, but more complex emitters will almost certainly need to override it.

Parameters
  • solutions (numpy.ndarray) – Array of solutions generated by this emitter’s ask() method.

  • objective_values (numpy.ndarray) – 1D array containing the objective function value of each solution.

  • behavior_values (numpy.ndarray) – (n, <behavior space dimension>) array with the behavior space coordinates of each solution.

  • metadata (numpy.ndarray) – 1D object array containing a metadata object for each solution.

property archive

The archive which stores solutions generated by this emitter.

Type

ribs.archives.ArchiveBase

property batch_size

Number of solutions to return in ask().

Type

int

property lower_bounds

(solution_dim,) array with lower bounds of solution space.

For instance, [-1, -1, -1] indicates that every dimension of the solution space has a lower bound of -1.

Type

numpy.ndarray

property sigma0

Standard deviation of the (diagonal) Gaussian distribution.

Type

float or numpy.ndarray

property solution_dim

The dimension of solutions produced by this emitter.

Type

int

property upper_bounds

(solution_dim,) array with upper bounds of solution space.

For instance, [1, 1, 1] indicates that every dimension of the solution space has an upper bound of 1.

Type

numpy.ndarray

property x0

Center of the Gaussian distribution from which to sample solutions when the archive is empty.

Type

numpy.ndarray