pub struct MutationEngine { /* private fields */ }Implementations§
Source§impl MutationEngine
impl MutationEngine
pub fn new(specs: Vec<ParamSpec>, config: MutationConfig) -> Self
Sourcepub fn mutate(&self, params: &ParamMap, seed: u64) -> MutationResult
pub fn mutate(&self, params: &ParamMap, seed: u64) -> MutationResult
LCG-based deterministic mutation.
Sourcepub fn crossover(
&self,
parent_a: &ParamMap,
parent_b: &ParamMap,
seed: u64,
) -> ParamMap
pub fn crossover( &self, parent_a: &ParamMap, parent_b: &ParamMap, seed: u64, ) -> ParamMap
Uniform crossover: for each param, pick from parent_a or parent_b with 50/50 probability.
Sourcepub fn blend_crossover(
&self,
parent_a: &ParamMap,
parent_b: &ParamMap,
t: f32,
) -> ParamMap
pub fn blend_crossover( &self, parent_a: &ParamMap, parent_b: &ParamMap, t: f32, ) -> ParamMap
Blend crossover: interpolate each param as a + t*(b-a), clamp to range.
Sourcepub fn generate_random(&self, seed: u64) -> ParamMap
pub fn generate_random(&self, seed: u64) -> ParamMap
Generate random params uniformly in [min, max] per spec.
Auto Trait Implementations§
impl Freeze for MutationEngine
impl RefUnwindSafe for MutationEngine
impl Send for MutationEngine
impl Sync for MutationEngine
impl Unpin for MutationEngine
impl UnsafeUnpin for MutationEngine
impl UnwindSafe for MutationEngine
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<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