Struct genetic_algorithm::crossover::CrossoverMultiPoint
source · pub struct CrossoverMultiPoint {
pub number_of_crossovers: usize,
pub allow_duplicates: bool,
}
Expand description
Crossover multiple gene positions from which on the rest of the genes are taken from the other parent. This goes back and forth. The gene positions are chosen with uniform probability. Choose between allowing duplicate crossovers on the same point or not (not much slower, as crossover itself is relatively expensive). The population is restored towards the target_population_size by keeping the best parents alive. Excess parents are dropped.
Not allowed for UniqueGenotype as it would not preserve the gene uniqueness in the children. Allowed for MultiUniqueGenotype as there are valid crossover points between each new set
Fields§
§number_of_crossovers: usize
§allow_duplicates: bool
Implementations§
Trait Implementations§
source§impl Clone for MultiPoint
impl Clone for MultiPoint
source§fn clone(&self) -> MultiPoint
fn clone(&self) -> MultiPoint
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Crossover for MultiPoint
impl Crossover for MultiPoint
fn call<G: Genotype, R: Rng, SR: EvolveReporter<Genotype = G>>( &mut self, genotype: &G, state: &mut EvolveState<G>, config: &EvolveConfig, _reporter: &mut SR, rng: &mut R, )
source§fn require_crossover_points(&self) -> bool
fn require_crossover_points(&self) -> bool
to guard against invalid Crossover strategies which break the internal consistency
of the genes, unique genotypes can’t simply exchange genes without gene duplication issues
source§fn prepare_population<G: Genotype>(
&mut self,
state: &mut EvolveState<G>,
config: &EvolveConfig,
) -> usize
fn prepare_population<G: Genotype>( &mut self, state: &mut EvolveState<G>, config: &EvolveConfig, ) -> usize
The population is restored towards the target_population_size by keeping the best parents
alive. Excess parents are dropped. The number of crossovers to execute from the front of
the population is returned
source§fn require_crossover_indexes(&self) -> bool
fn require_crossover_indexes(&self) -> bool
to guard against invalid Crossover strategies which break the internal consistency
of the genes, unique genotypes can’t simply exchange genes without gene duplication issues
source§impl Debug for MultiPoint
impl Debug for MultiPoint
source§impl From<MultiPoint> for Wrapper
impl From<MultiPoint> for Wrapper
source§fn from(crossover: CrossoverMultiPoint) -> Self
fn from(crossover: CrossoverMultiPoint) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for MultiPoint
impl RefUnwindSafe for MultiPoint
impl Send for MultiPoint
impl Sync for MultiPoint
impl Unpin for MultiPoint
impl UnwindSafe for MultiPoint
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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