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 atell()
method that inserts solutions into the emitter’s archive. Child classes are only required to overrideask()
.- 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)
, wherelower_bound
orupper_bound
may be None to indicate no bound.Unbounded upper bounds are set to +inf, and unbounded lower bounds are set to -inf.
Methods
ask
()Generates an
(n, solution_dim)
array of solutions.tell
(solutions, objective_values, …[, …])Inserts entries into the archive.
Attributes
The archive which stores solutions generated by this emitter.
(solution_dim,)
array with lower bounds of solution space.The dimension of solutions produced by this emitter.
(solution_dim,)
array with upper bounds of solution space.-
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 callingadd()
. It is enough for simple emitters likeGaussianEmitter
, 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.
- 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
- 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