pub struct CmsaEs<B: Backend> { /* private fields */ }Expand description
Covariance Matrix Self-Adaptation Evolution Strategy.
§Example
use burn::backend::Flex;
use rlevo_evolution::algorithms::cmsa_es::{CmsaEsConfig, CmsaEs};
let strategy = CmsaEs::<Flex>::new();
let params = CmsaEsConfig::default_for(10);
let _ = (strategy, params);Implementations§
Trait Implementations§
impl<B: Copy + Backend> Copy for CmsaEs<B>
Source§impl<B: Backend> Strategy<B> for CmsaEs<B>
impl<B: Backend> Strategy<B> for CmsaEs<B>
Source§fn init(
&self,
params: &CmsaEsConfig,
rng: &mut dyn Rng,
_device: &<B as BackendTypes>::Device,
) -> CmsaEsState<B>
fn init( &self, params: &CmsaEsConfig, rng: &mut dyn Rng, _device: &<B as BackendTypes>::Device, ) -> CmsaEsState<B>
Initializes m⁰ uniformly in params.bounds (host-RNG convention),
C = I, and σ̄ = initial_sigma.
Source§fn ask(
&self,
params: &CmsaEsConfig,
state: &CmsaEsState<B>,
rng: &mut dyn Rng,
device: &<B as BackendTypes>::Device,
) -> (Tensor<B, 2>, CmsaEsState<B>)
fn ask( &self, params: &CmsaEsConfig, state: &CmsaEsState<B>, rng: &mut dyn Rng, device: &<B as BackendTypes>::Device, ) -> (Tensor<B, 2>, CmsaEsState<B>)
Samples λ offspring with per-individual log-normal step sizes.
For each offspring: σᵢ = σ̄ · exp(τ · N(0,1)), sᵢ = A zᵢ
(A the Cholesky factor of C, zᵢ ~ N(0, I)), xᵢ = m + σᵢ · sᵢ.
All draws come from one deterministic SeedPurpose::CmaSampling
stream; the σᵢ are stashed in state for tell.
Source§fn tell(
&self,
params: &CmsaEsConfig,
population: Tensor<B, 2>,
fitness: Tensor<B, 1>,
state: CmsaEsState<B>,
_rng: &mut dyn Rng,
) -> (CmsaEsState<B>, StrategyMetrics)
fn tell( &self, params: &CmsaEsConfig, population: Tensor<B, 2>, fitness: Tensor<B, 1>, state: CmsaEsState<B>, _rng: &mut dyn Rng, ) -> (CmsaEsState<B>, StrategyMetrics)
Recombines the μ best offspring into the next mean, step size, and
rank-μ covariance blend.
Source§fn best(&self, state: &CmsaEsState<B>) -> Option<(Tensor<B, 2>, f32)>
fn best(&self, state: &CmsaEsState<B>) -> Option<(Tensor<B, 2>, f32)>
Returns the best-so-far genome and its fitness, or None before the
first tell call.
Source§type Params = CmsaEsConfig
type Params = CmsaEsConfig
Static parameters for a run.
Source§type State = CmsaEsState<B>
type State = CmsaEsState<B>
Generation-to-generation state.
Auto Trait Implementations§
impl<B> Freeze for CmsaEs<B>
impl<B> RefUnwindSafe for CmsaEs<B>
impl<B> Send for CmsaEs<B>
impl<B> Sync for CmsaEs<B>
impl<B> Unpin for CmsaEs<B>
impl<B> UnsafeUnpin for CmsaEs<B>
impl<B> UnwindSafe for CmsaEs<B>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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