pub struct CmaEsConfig {}Expand description
Static configuration for a CMA-ES run.
Construct with CmaEsConfig::default_for (derives λ from the dimension
per Hansen 2016) or CmaEsConfig::with_pop_size (explicit λ, e.g. a
larger population for multimodal landscapes). The recombination weights and
learning rates are all derived from (λ, D) and cached as fields so
Strategy::tell reads them without recomputing.
Fields§
§pop_size: usizeOffspring population size λ.
genome_dim: usizeGenome dimensionality D.
bounds: BoundsSearch-space bounds; used only to sample the initial mean m⁰.
Offspring are not clamped (CMA-ES samples in unbounded ℝᴰ).
initial_sigma: f32Initial global step size σ.
mu: usizeNumber of selected parents μ = ⌊λ/2⌋.
weights: Vec<f32>Recombination weights wᵢ (length μ, positive, summing to 1).
mu_eff: f32Variance-effective selection mass μ_eff = 1 / Σ wᵢ².
c_sigma: f32CSA learning rate c_σ.
d_sigma: f32CSA damping d_σ.
c_c: f32Anisotropic-path learning rate c_c.
c_1: f32Rank-1 covariance learning rate c_1.
c_mu: f32Rank-μ covariance learning rate c_μ.
chi_n: f32Expected length of N(0, I), χ_n ≈ √D (1 − 1/4D + 1/21D²).
Implementations§
Source§impl CmaEsConfig
impl CmaEsConfig
Sourcepub fn default_for(genome_dim: usize) -> Self
pub fn default_for(genome_dim: usize) -> Self
Default configuration for dimensionality D, with the Hansen-2016
population λ = 4 + ⌊3 ln D⌋.
Sets bounds = (-5.12, 5.12) (the standard Sphere/Rastrigin domain) and
initial_sigma = 1.0.
Sourcepub fn with_pop_size(pop_size: usize, genome_dim: usize) -> Self
pub fn with_pop_size(pop_size: usize, genome_dim: usize) -> Self
Configuration with an explicit population size λ.
Larger λ improves basin-finding on multimodal landscapes (Hansen 2016,
§A); all derived weights and learning rates follow from (λ, D).
The pop_size ≥ 2 invariant is enforced by Validate::validate at the
harness chokepoint, not by this infallible producer.
Trait Implementations§
Source§impl Clone for CmaEsConfig
impl Clone for CmaEsConfig
Source§fn clone(&self) -> CmaEsConfig
fn clone(&self) -> CmaEsConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CmaEsConfig
impl Debug for CmaEsConfig
Source§impl Validate for CmaEsConfig
impl Validate for CmaEsConfig
Source§fn validate(&self) -> Result<(), ConfigError>
fn validate(&self) -> Result<(), ConfigError>
Fail-fast: reports the first violation, derived from validate_all so
the two never disagree.
Source§fn validate_all(&self) -> Result<(), Vec<ConfigError>>
fn validate_all(&self) -> Result<(), Vec<ConfigError>>
Accumulate-all: reports every violated invariant in one pass.
Unlike most configs, CmaEsConfig exposes its derived fields —
recombination weights, mu_eff, and the five learning rates — as
public struct fields (so callers can construct one by hand). The
default_for / with_pop_size producers keep them mutually
consistent, but a hand-built literal can desync several at once; listing
all violations then beats fixing them one recompile at a time.
Auto Trait Implementations§
impl Freeze for CmaEsConfig
impl RefUnwindSafe for CmaEsConfig
impl Send for CmaEsConfig
impl Sync for CmaEsConfig
impl Unpin for CmaEsConfig
impl UnsafeUnpin for CmaEsConfig
impl UnwindSafe for CmaEsConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more