ribs.emitters.opt.SeparableCMAEvolutionStrategy¶
- class ribs.emitters.opt.SeparableCMAEvolutionStrategy(sigma0, solution_dim, batch_size=None, seed=None, dtype=<class 'numpy.float64'>)[source]¶
sep-CMA-ES optimizer for use with emitters.
Refer to
EvolutionStrategyBase
for usage instruction.- Parameters
sigma0 (float) – Initial step size.
batch_size (int) – Number of solutions to evaluate at a time. If None, we calculate a default batch size based on solution_dim.
solution_dim (int) – Size of the solution space.
seed (int) – Seed for the random number generator.
dtype (str or data-type) – Data type of solutions.
weight_rule (str) – Method for generating weights. Either “truncation” (positive weights only) or “active” (include negative weights).
Methods
ask
(lower_bounds, upper_bounds[, batch_size])Samples new solutions from the Gaussian distribution.
check_stop
(ranking_values)Checks if the optimization should stop and be reset.
reset
(x0)Resets the optimizer to start at x0.
tell
(ranking_indices, num_parents)Passes the solutions back to the optimizer.
- ask(lower_bounds, upper_bounds, batch_size=None)[source]¶
Samples new solutions from the Gaussian distribution.
- Parameters
lower_bounds (float or np.ndarray) – scalar or (solution_dim,) array indicating lower bounds of the solution space. Scalars specify the same bound for the entire space, while arrays specify a bound for each dimension. Pass -np.inf in the array or scalar to indicated unbounded space.
upper_bounds (float or np.ndarray) – Same as above, but for upper bounds (and pass np.inf instead of -np.inf).
batch_size (int) – batch size of the sample. Defaults to
self.batch_size
.
- check_stop(ranking_values)[source]¶
Checks if the optimization should stop and be reset.
Tolerances come from CMA-ES.
- Parameters
ranking_values (np.ndarray) – Array of objective values of the solutions, sorted in the same order that the solutions were sorted when passed to
tell()
.- Returns
True if any of the stopping conditions are satisfied.