ribs.emitters.OptimizingEmitter¶
 class
ribs.emitters.
OptimizingEmitter
(archive, x0, sigma0, selection_rule='mu', restart_rule='basic', weight_rule='truncation', bounds=None, batch_size=None, seed=None)[source]¶ Adapts a covariance matrix towards the objective.
This emitter originates in Fontaine 2020. Initially, it starts at
x0
and uses CMAES to optimize for objective values. After CMAES converges, the emitter restarts the optimizer. It picks a random elite in the archive and begins optimizing from there. Parameters
archive (ribs.archives.ArchiveBase) – An archive to use when creating and inserting solutions. For instance, this can be
ribs.archives.GridArchive
.x0 (np.ndarray) – Initial solution.
sigma0 (float) – Initial step size.
selection_rule (“mu” or “filter”) – Method for selecting solutions in CMAES. With “mu” selection, the first half of the solutions will be selected, while in “filter”, any solutions that were added to the archive will be selected.
restart_rule (“no_improvement” or “basic”) – Method to use when checking for restart. With “basic”, only the default CMAES convergence rules will be used, while with “no_improvement”, the emitter will restart when none of the proposed solutions were added to the archive.
weight_rule (“truncation” or “active”) – Method for generating weights in CMAES. Either “truncation” (positive weights only) or “active” (include negative weights).
bounds (None or arraylike) – Bounds of the solution space. Solutions are clipped to these bounds. Pass None to indicate there are no bounds. Alternatively, pass an arraylike to specify the bounds for each dim. Each element in this arraylike 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.batch_size (int) – Number of solutions to return in
ask()
. If not passed in, a batch size will automatically be calculated.seed (int) – Value to seed the random number generator. Set to None to avoid a fixed seed.
 Raises
ValueError – If any of
selection_rule
,restart_rule
, orweight_rule
is invalid.
Methods
ask
()Samples new solutions from a multivariate Gaussian.
tell
(solutions, objective_values, …[, …])Gives the emitter results from evaluating solutions.
Attributes
The archive which stores solutions generated by this emitter.
Number of solutions to return in
ask()
.(solution_dim,)
array with lower bounds of solution space.Initial step size for the CMAES optimizer.
The dimension of solutions produced by this emitter.
(solution_dim,)
array with upper bounds of solution space.Initial solution for the optimizer.

ask
()[source]¶ Samples new solutions from a multivariate Gaussian.
The multivariate Gaussian is parameterized by the CMAES optimizer.
 Returns
(batch_size, solution_dim)
array – containsbatch_size
new solutions to evaluate.

tell
(solutions, objective_values, behavior_values, metadata=None)[source]¶ Gives the emitter results from evaluating solutions.
As solutions are inserted into the archive, we record their objective value as well as whether the solution was added to the archive. When using “filter” selection, we rank the solutions first by whether they were added, and second by the objective value, and when using “mu” selection, we rank solely by objective. We then pass the ranked solutions to the underlying CMAES optimizer to update the search parameters.
 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
 property
x0
¶ Initial solution for the optimizer.
 Type