pub struct IslandModel<G, Fit, Sel, Cross, Mut, F = f64>where
G: EvolutionaryGenome,
F: FitnessValue,{
pub config: IslandModelConfig,
pub islands: Vec<Island<G, F>>,
pub fitness: Arc<Fit>,
pub selection: Sel,
pub crossover: Cross,
pub mutation: Mut,
pub global_best: Option<Individual<G, F>>,
pub generation: usize,
pub total_evaluations: usize,
}Expand description
Island Model Evolutionary Algorithm
Fields§
§config: IslandModelConfigConfiguration
islands: Vec<Island<G, F>>Islands
fitness: Arc<Fit>Fitness function (shared)
selection: SelSelection operator
crossover: CrossCrossover operator
mutation: MutMutation operator
global_best: Option<Individual<G, F>>Global best individual
generation: usizeTotal generations (global)
total_evaluations: usizeTotal evaluations across all islands
Implementations§
Source§impl<G, Fit, Sel, Cross, Mut, F> IslandModel<G, Fit, Sel, Cross, Mut, F>where
G: EvolutionaryGenome,
F: FitnessValue,
Fit: Fitness<Genome = G, Value = F> + Send + Sync,
Sel: SelectionOperator<G> + Clone + Send + Sync,
Cross: CrossoverOperator<G> + Clone + Send + Sync,
Mut: MutationOperator<G> + Clone + Send + Sync,
impl<G, Fit, Sel, Cross, Mut, F> IslandModel<G, Fit, Sel, Cross, Mut, F>where
G: EvolutionaryGenome,
F: FitnessValue,
Fit: Fitness<Genome = G, Value = F> + Send + Sync,
Sel: SelectionOperator<G> + Clone + Send + Sync,
Cross: CrossoverOperator<G> + Clone + Send + Sync,
Mut: MutationOperator<G> + Clone + Send + Sync,
Sourcepub fn new<R: Rng>(
config: IslandModelConfig,
fitness: Fit,
selection: Sel,
crossover: Cross,
mutation: Mut,
rng: &mut R,
) -> Self
pub fn new<R: Rng>( config: IslandModelConfig, fitness: Fit, selection: Sel, crossover: Cross, mutation: Mut, rng: &mut R, ) -> Self
Create a new island model
Sourcepub fn run<R: Rng>(
&mut self,
max_generations: usize,
rng: &mut R,
) -> EvoResult<&Individual<G, F>>
pub fn run<R: Rng>( &mut self, max_generations: usize, rng: &mut R, ) -> EvoResult<&Individual<G, F>>
Run evolution for a specified number of generations
Sourcepub fn step<R: Rng>(&mut self, rng: &mut R) -> EvoResult<()>
pub fn step<R: Rng>(&mut self, rng: &mut R) -> EvoResult<()>
Perform one generation step on all islands
Sourcepub fn combined_population(&self) -> Population<G, F>
pub fn combined_population(&self) -> Population<G, F>
Get a combined population from all islands
Sourcepub fn island_statistics(&self) -> Vec<IslandStats<F>>
pub fn island_statistics(&self) -> Vec<IslandStats<F>>
Get statistics about each island
Auto Trait Implementations§
impl<G, Fit, Sel, Cross, Mut, F> Freeze for IslandModel<G, Fit, Sel, Cross, Mut, F>
impl<G, Fit, Sel, Cross, Mut, F> RefUnwindSafe for IslandModel<G, Fit, Sel, Cross, Mut, F>where
Sel: RefUnwindSafe,
Cross: RefUnwindSafe,
Mut: RefUnwindSafe,
G: RefUnwindSafe,
Fit: RefUnwindSafe,
F: RefUnwindSafe,
impl<G, Fit, Sel, Cross, Mut, F> Send for IslandModel<G, Fit, Sel, Cross, Mut, F>
impl<G, Fit, Sel, Cross, Mut, F> Sync for IslandModel<G, Fit, Sel, Cross, Mut, F>
impl<G, Fit, Sel, Cross, Mut, F> Unpin for IslandModel<G, Fit, Sel, Cross, Mut, F>
impl<G, Fit, Sel, Cross, Mut, F> UnsafeUnpin for IslandModel<G, Fit, Sel, Cross, Mut, F>
impl<G, Fit, Sel, Cross, Mut, F> UnwindSafe for IslandModel<G, Fit, Sel, Cross, Mut, F>where
Sel: UnwindSafe,
Cross: UnwindSafe,
Mut: UnwindSafe,
Fit: RefUnwindSafe,
G: UnwindSafe,
F: 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
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.