use crate::core::{context::Context, offspring::Offspring, state::State};
pub(crate) mod common;
#[cfg(feature = "parallel")]
pub mod parallel;
pub mod sequential;
pub trait GeneticOperator<G, F, Fe, R, C> {
fn apply(&self, state: &State<G, F>, ctx: &mut Context<Fe, R, C>) -> Offspring<G, F>;
}
impl<G, F, Fe, R, C, O> GeneticOperator<G, F, Fe, R, C> for &O
where
O: GeneticOperator<G, F, Fe, R, C>,
{
fn apply(&self, state: &State<G, F>, ctx: &mut Context<Fe, R, C>) -> Offspring<G, F> {
(*self).apply(state, ctx)
}
}
impl<G, F, Fe, R, C, O> GeneticOperator<G, F, Fe, R, C> for &mut O
where
O: GeneticOperator<G, F, Fe, R, C>,
{
fn apply(&self, state: &State<G, F>, ctx: &mut Context<Fe, R, C>) -> Offspring<G, F> {
(**self).apply(state, ctx)
}
}