Skip to main content

Parameters

Struct Parameters 

Source
pub struct Parameters {
Show 13 fields pub n: usize, pub lambda: usize, pub mu: usize, pub weights: Vec<f64>, pub mu_eff: f64, pub mu_eff_negative: f64, pub c_m: f64, pub c_sigma: f64, pub d_sigma: f64, pub c_c: f64, pub c_1: f64, pub c_mu: f64, pub chi_n: f64,
}
Expand description

The derived strategy parameters for dimension n and population size λ, computed exactly as in Table 1 of Hansen (2016), equations (48)–(58).

Fields§

§n: usize

The dimension n.

§lambda: usize

The population size λ (48): 4 + ⌊3 ln n⌋ by default.

§mu: usize

The number of positive weights μ = ⌊λ/2⌋.

§weights: Vec<f64>

The recombination weights w_1 ≥ … ≥ w_λ (53): the first μ are positive and sum to one, the rest are non-positive (“active” CMA).

§mu_eff: f64

The variance effective selection mass μ_eff = (Σ w_i)² / Σ w_i² over the positive weights.

§mu_eff_negative: f64

The variance effective selection mass of the negative weights, μ_eff^-.

§c_m: f64

The learning rate of the mean, c_m = 1 (54).

§c_sigma: f64

The cumulation constant of the step-size path, c_σ (55).

§d_sigma: f64

The step-size damping d_σ (55).

§c_c: f64

The cumulation constant of the rank-one path, c_c (56).

§c_1: f64

The rank-one learning rate c_1 (57).

§c_mu: f64

The rank-μ learning rate c_μ (58).

§chi_n: f64

E‖N(0, I)‖ ≈ √n (1 - 1/(4n) + 1/(21n²)).

Implementations§

Source§

impl Parameters

Source

pub fn default_lambda(n: usize) -> usize

The default population size 4 + ⌊3 ln n⌋ (48).

Source

pub fn new(n: usize, lambda: usize) -> Self

Computes every parameter for dimension n and population size lambda.

§Panics

Panics if n == 0 or lambda < 2.

Source

pub fn weight_sum(&self) -> f64

The sum of all weights Σ w_j, which enters the decay factor of (47).

Source

pub fn eigen_interval(&self) -> u64

The number of generations between eigendecompositions, max(1, ⌊1 / (10 n (c_1 + c_μ))⌋) (Appendix B.2).

Trait Implementations§

Source§

impl Clone for Parameters

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Parameters

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Parameters

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Parameters

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.