cotengra.hyperoptimizers.hyper_es

Hyper optimization using a steady-state diagonal evolutionary strategy.

Attributes

Classes

SteadyStateES

A steady-state diagonal evolutionary strategy (SSES) operating in raw

ESOptLib

Hyper-optimization using a steady-state diagonal ES.

Functions

_reflect(x)

Reflect a scalar into [-1, 1].

Module Contents

cotengra.hyperoptimizers.hyper_es._CHI1
cotengra.hyperoptimizers.hyper_es._reflect(x)[source]

Reflect a scalar into [-1, 1].

class cotengra.hyperoptimizers.hyper_es.SteadyStateES(space, seed=None, population_size='auto', sigma=0.5, sigma_min=0.01, sigma_max=1.0, c_sigma='auto', d_sigma='auto', elite_ratio=0.5, use_mirror=True, inject_best_every='auto', restart_patience='auto', explore_prob=0.05, mean_lr=0.5, exponential_param_power=None)[source]

A steady-state diagonal evolutionary strategy (SSES) operating in raw [-1, 1] parameter space.

Unlike a generational ES, this sampler has no synchronization barrier. Every ask draws from the current distribution immediately, and every tell updates the distribution state from a sliding window of recent results. Trials can be in-flight in any number and can complete in any order.

Step sizes are adapted per dimension using a simplified cumulative step-size adaptation (CSA) rule, giving the optimizer the character of a separable (diagonal) CMA-ES without any matrix operations.

Parameters:
  • space (dict[str, dict]) – The search space for a single contraction method.

  • seed (None or int, optional) – Random seed.

  • population_size (int or "auto", optional) – Size of the sliding archive window. When "auto" it is chosen as max(8, 4 * ndim).

  • sigma (float, optional) – Initial per-dimension step size in raw [-1, 1] space.

  • sigma_min (float, optional) – Lower bound for per-dimension step sizes.

  • sigma_max (float, optional) – Upper bound for per-dimension step sizes (also the restart value).

  • c_sigma (float or "auto", optional) – Learning rate for the evolution path. When "auto" it is set to 1 / sqrt(ndim) (clamped to [0.05, 1.0]).

  • d_sigma (float or "auto", optional) – Damping factor for step-size updates. When "auto" it is set to 1 + sqrt(ndim).

  • elite_ratio (float, optional) – Fraction of the archive used as elites for weighted recombination.

  • use_mirror (bool, optional) – If True, every fresh perturbation is paired with its antipodal mirror, halving gradient variance.

  • inject_best_every (int or "auto", optional) – Inject the best-so-far point every this many asks. When "auto" it equals population_size.

  • restart_patience (int or "auto", optional) – Number of tells without improvement before resetting step sizes and re-centering on the best-so-far point. When "auto" it equals 5 * population_size.

  • explore_prob (float, optional) – Probability of issuing a uniform random point instead of the ES-directed point. Maintains global diversity throughout the search and helps escape local minima. Random points still feed into the archive normally.

  • mean_lr (float, optional) – Learning rate for the mean update in (0, 1]. Each tell blends the current mean toward the elite weighted mean by this factor: mean = (1 - mean_lr) * mean + mean_lr * elite_mean. Values below 1.0 smooth out noise-driven mean drift. Default is 1.0 (full update, original behaviour).

  • exponential_param_power (float, optional) – Passed through to the shared parameter mapping for FLOAT_EXP parameters.

rng
params = []
ndim
population_size = 'auto'
sigma0 = 0.5
sigma_min = 0.01
sigma_max = 1.0
c_sigma = 'auto'
d_sigma = 'auto'
elite_ratio = 0.5
use_mirror = True
explore_prob = 0.05
mean_lr = 0.5
inject_best_every = 'auto'
restart_patience = 'auto'
_weights
_mu
_mu_eff
_init_state()[source]

Initialize or reset the mutable optimizer state.

ask()[source]

Return the next candidate point.

Draws from the current distribution, optionally using mirrored sampling or best-so-far injection. No synchronization with outstanding trials is required.

tell(trial_number, score)[source]

Record a completed trial and update the distribution.

Updates the sliding archive, recomputes the weighted mean from elites, adapts per-dimension step sizes via evolution paths, and checks for stalls.

_restart()[source]

Reset step sizes and re-center.

Alternates between re-centering on the best-so-far point (exploitation restart) and a uniformly random point (exploration restart) to avoid repeated restarts converging to the same local minimum.

class cotengra.hyperoptimizers.hyper_es.ESOptLib[source]

Bases: cotengra.hyperoptimizers.hyper.HyperOptLib

Hyper-optimization using a steady-state diagonal ES.

setup(methods, space, optimizer=None, population_size='auto', sigma=0.5, sigma_min=0.01, sigma_max=1.0, c_sigma='auto', d_sigma='auto', elite_ratio=0.5, use_mirror=True, inject_best_every='auto', restart_patience='auto', explore_prob=0.05, mean_lr=1.0, method_exploration=1.0, method_temperature=1.0, exponential_param_power=None, seed=None, **kwargs)[source]

Initialize ES optimizers for each contraction method.

Parameters:
  • methods (list[str]) – The contraction methods to optimize over.

  • space (dict[str, dict[str, dict]]) – The per-method hyperparameter search space.

  • optimizer (HyperOptimizer, optional) – The parent optimizer.

  • population_size (int or "auto", optional) – Archive window size for each method-specific ES sampler.

  • sigma (float, optional) – Initial per-dimension step size.

  • sigma_min (float, optional) – Bounds for per-dimension step sizes.

  • sigma_max (float, optional) – Bounds for per-dimension step sizes.

  • c_sigma (float or "auto", optional) – Evolution path learning rate.

  • d_sigma (float or "auto", optional) – Step-size damping factor.

  • elite_ratio (float, optional) – Fraction of the archive used as elites.

  • use_mirror (bool, optional) – Enable mirrored sampling.

  • inject_best_every (int or "auto", optional) – Best-injection frequency.

  • restart_patience (int or "auto", optional) – Tells without improvement before restart.

  • explore_prob (float, optional) – Probability of issuing a uniform random point on each ask.

  • mean_lr (float, optional) – Learning rate for the mean update in (0, 1].

  • method_exploration (float, optional) – Exploration strength for the LCB-based method chooser.

  • method_temperature (float, optional) – Noise temperature for the LCB-based method chooser.

  • exponential_param_power (float, optional) – Passed to the shared parameter mapping for FLOAT_EXP.

  • seed (None or int, optional) – Random seed.

get_setting()[source]

Choose a contraction method, then request its next setting.

report_result(setting, trial, score)[source]

Report a completed trial back to the method chooser and ES.