pub struct TournamentSelection { /* private fields */ }Expand description
Represents the tournament selection algorithm.
§Note
The tournament selection method involves selecting a fixed number of random candidates from the population (determined by tournament’s size) and choosing the candidate with the highest fitness.
Implementations§
Trait Implementations§
Source§impl Clone for TournamentSelection
impl Clone for TournamentSelection
Source§fn clone(&self) -> TournamentSelection
fn clone(&self) -> TournamentSelection
Returns a duplicate 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 PartialEq for TournamentSelection
impl PartialEq for TournamentSelection
Source§impl<I, R> SelectionMechanism<I, R> for TournamentSelectionwhere
I: Individual,
R: Rng,
impl<I, R> SelectionMechanism<I, R> for TournamentSelectionwhere
I: Individual,
R: Rng,
Source§fn prepare(&mut self, _population: &Population<I>)
fn prepare(&mut self, _population: &Population<I>)
Prepares the mechanism for a new population. Read more
Source§fn select<'a>(
&self,
population: &'a Population<I>,
rng: &mut R,
) -> (usize, &'a I)
fn select<'a>( &self, population: &'a Population<I>, rng: &mut R, ) -> (usize, &'a I)
Selects an individual from the population. Read more
Source§fn select_distinct<'a>(
&self,
population: &'a Population<I>,
rng: &mut R,
max_tries: usize,
excluded: &I,
) -> Option<(usize, &'a I)>where
I: Individual,
R: Rng,
fn select_distinct<'a>(
&self,
population: &'a Population<I>,
rng: &mut R,
max_tries: usize,
excluded: &I,
) -> Option<(usize, &'a I)>where
I: Individual,
R: Rng,
Selects an individual from the population, excluding a specific individual.
The selection attempt will be repeated for a specified number of tries (
max_tries),
or until a different individual is found. Read moreimpl Copy for TournamentSelection
impl Eq for TournamentSelection
impl StructuralPartialEq for TournamentSelection
Auto Trait Implementations§
impl Freeze for TournamentSelection
impl RefUnwindSafe for TournamentSelection
impl Send for TournamentSelection
impl Sync for TournamentSelection
impl Unpin for TournamentSelection
impl UnwindSafe for TournamentSelection
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§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