Struct genevo::selection::proportionate::RouletteWheelSelector
source · [−]pub struct RouletteWheelSelector { /* private fields */ }
Expand description
The RouletteWheelSelector
implements stochastic fitness proportionate
selection. Each candidate is picked randomly with a probability of being
picked that is proportional to its fitness value.
Characteristics: no bias, does not guarantee minimal spread.
Implementations
sourceimpl RouletteWheelSelector
impl RouletteWheelSelector
sourcepub fn new(selection_ratio: f64, num_individuals_per_parents: usize) -> Self
pub fn new(selection_ratio: f64, num_individuals_per_parents: usize) -> Self
Constructs a new instance of RouletteWheelSelector
.
sourcepub fn selection_ratio(&self) -> f64
pub fn selection_ratio(&self) -> f64
Returns the selection ratio.
The selection ratio is the fraction of number of parents that are
selected on every call of the select_from
function and the number
of individuals in the population.
sourcepub fn set_selection_ratio(&mut self, value: f64)
pub fn set_selection_ratio(&mut self, value: f64)
Sets the selection ratio to a new value.
The selection ratio is the fraction of number of parents that are
selected on every call of the select_from
function and the number
of individuals in the population.
sourcepub fn num_individuals_per_parents(&self) -> usize
pub fn num_individuals_per_parents(&self) -> usize
Returns the number of individuals per parents use by this selector.
sourcepub fn set_num_individuals_per_parents(&mut self, value: usize)
pub fn set_num_individuals_per_parents(&mut self, value: usize)
Sets the number of individuals per parents to the given value.
Trait Implementations
sourceimpl Clone for RouletteWheelSelector
impl Clone for RouletteWheelSelector
sourcefn clone(&self) -> RouletteWheelSelector
fn clone(&self) -> RouletteWheelSelector
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RouletteWheelSelector
impl Debug for RouletteWheelSelector
sourceimpl PartialEq<RouletteWheelSelector> for RouletteWheelSelector
impl PartialEq<RouletteWheelSelector> for RouletteWheelSelector
sourcefn eq(&self, other: &RouletteWheelSelector) -> bool
fn eq(&self, other: &RouletteWheelSelector) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RouletteWheelSelector) -> bool
fn ne(&self, other: &RouletteWheelSelector) -> bool
This method tests for !=
.
sourceimpl<G, F> SelectionOp<G, F> for RouletteWheelSelector where
G: Genotype,
F: Fitness + AsScalar,
impl<G, F> SelectionOp<G, F> for RouletteWheelSelector where
G: Genotype,
F: Fitness + AsScalar,
sourcefn select_from<R>(
&self,
evaluated: &EvaluatedPopulation<G, F>,
rng: &mut R
) -> Vec<Parents<G>> where
R: Rng + Sized,
fn select_from<R>(
&self,
evaluated: &EvaluatedPopulation<G, F>,
rng: &mut R
) -> Vec<Parents<G>> where
R: Rng + Sized,
Selects individuals from the given population according to the implemented selection strategy. Read more
impl SingleObjective for RouletteWheelSelector
impl StructuralPartialEq for RouletteWheelSelector
Auto Trait Implementations
impl RefUnwindSafe for RouletteWheelSelector
impl Send for RouletteWheelSelector
impl Sync for RouletteWheelSelector
impl Unpin for RouletteWheelSelector
impl UnwindSafe for RouletteWheelSelector
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more