pub struct Mix<A, B> {
pub a: A,
pub b: B,
pub probability_a: f64,
}Expand description
Applies a with probability weight_a / (weight_a + weight_b), otherwise b; the
building block of GLEAM-style operator mixes. Nest it for more than two operators, or
use mix.
use evolutionary_planning::operators::{mix, permutation::{Inversion, Swap}};
// Inversions twice as often as swaps.
let _mutation = mix(Inversion, 2.0, Swap, 1.0);Fields§
§a: AThe first operator.
b: BThe second operator.
probability_a: f64The probability of choosing a, in [0, 1].
Trait Implementations§
impl<A: Copy, B: Copy> Copy for Mix<A, B>
impl<A: PartialEq, B: PartialEq> StructuralPartialEq for Mix<A, B>
Auto Trait Implementations§
impl<A, B> Forget for Mix<A, B>
impl<A, B> Freeze for Mix<A, B>
impl<A, B> Move for Mix<A, B>
impl<A, B> RefUnwindSafe for Mix<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Mix<A, B>
impl<A, B> Sync for Mix<A, B>
impl<A, B> Unpin for Mix<A, B>
impl<A, B> UnsafeUnpin for Mix<A, B>where
A: UnsafeUnpin,
B: UnsafeUnpin,
impl<A, B> UnwindSafe for Mix<A, B>where
A: UnwindSafe,
B: UnwindSafe,
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