# ribs.emitters.EmitterBase¶

class ribs.emitters.EmitterBase(archive, solution_dim, bounds)[source]

Base class for emitters.

Every emitter has an ask() method that generates a batch of solutions, and a tell() method that inserts solutions into the emitter’s archive. Child classes are only required to override ask().

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

• solution_dim (int) – The dimension of solutions produced by this emitter.

• bounds (None or array-like) – Bounds of the solution space. 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.

Unbounded upper bounds are set to +inf, and unbounded lower bounds are set to -inf.

Methods

 Generates an (n, solution_dim) array of solutions. tell(solutions, objective_values, …[, …]) Inserts entries into the archive.

Attributes

 archive The archive which stores solutions generated by this emitter. lower_bounds (solution_dim,) array with lower bounds of solution space. solution_dim The dimension of solutions produced by this emitter. upper_bounds (solution_dim,) array with upper bounds of solution space.
abstract ask()[source]

Generates an (n, solution_dim) array of solutions.

tell(solutions, objective_values, behavior_values, metadata=None)[source]

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 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 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