Struct genetic_algorithm::strategy::evolve::EvolveBuilder

source ·
pub struct EvolveBuilder<G: Genotype, M: Mutate, F: Fitness<Allele = G::Allele>, S: Crossover, C: Compete, E: Extension, SR: EvolveReporter<Allele = G::Allele>> {
Show 16 fields pub genotype: Option<G>, pub target_population_size: usize, pub max_stale_generations: Option<usize>, pub max_chromosome_age: Option<usize>, pub target_fitness_score: Option<FitnessValue>, pub valid_fitness_score: Option<FitnessValue>, pub fitness_ordering: FitnessOrdering, pub par_fitness: bool, pub replace_on_equal_fitness: bool, pub mutate: Option<M>, pub fitness: Option<F>, pub crossover: Option<S>, pub compete: Option<C>, pub extension: E, pub reporter: SR, pub rng_seed: Option<u64>,
}
Expand description

The builder for an Evolve struct.

Fields§

§genotype: Option<G>§target_population_size: usize§max_stale_generations: Option<usize>§max_chromosome_age: Option<usize>§target_fitness_score: Option<FitnessValue>§valid_fitness_score: Option<FitnessValue>§fitness_ordering: FitnessOrdering§par_fitness: bool§replace_on_equal_fitness: bool§mutate: Option<M>§fitness: Option<F>§crossover: Option<S>§compete: Option<C>§extension: E§reporter: SR§rng_seed: Option<u64>

Implementations§

source§

impl<G: Genotype, M: Mutate, F: Fitness<Allele = G::Allele>, S: Crossover, C: Compete> Builder<G, M, F, S, C, ExtensionNoop, EvolveReporterNoop<G::Allele>>

source

pub fn new() -> Self

source§

impl<G: Genotype, M: Mutate, F: Fitness<Allele = G::Allele>, S: Crossover, C: Compete, E: Extension, SR: EvolveReporter<Allele = G::Allele>> Builder<G, M, F, S, C, E, SR>

source

pub fn build(self) -> Result<Evolve<G, M, F, S, C, E, SR>, TryFromBuilderError>

source

pub fn with_genotype(self, genotype: G) -> Self

source

pub fn with_target_population_size(self, target_population_size: usize) -> Self

source

pub fn with_max_stale_generations(self, max_stale_generations: usize) -> Self

source

pub fn with_max_stale_generations_option( self, max_stale_generations_option: Option<usize>, ) -> Self

source

pub fn with_max_chromosome_age(self, max_chromosome_age: usize) -> Self

source

pub fn with_max_chromosome_age_option( self, max_chromosome_age_option: Option<usize>, ) -> Self

source

pub fn with_target_fitness_score( self, target_fitness_score: FitnessValue, ) -> Self

source

pub fn with_target_fitness_score_option( self, target_fitness_score_option: Option<FitnessValue>, ) -> Self

source

pub fn with_valid_fitness_score(self, valid_fitness_score: FitnessValue) -> Self

source

pub fn with_valid_fitness_score_option( self, valid_fitness_score_option: Option<FitnessValue>, ) -> Self

source

pub fn with_fitness_ordering(self, fitness_ordering: FitnessOrdering) -> Self

source

pub fn with_par_fitness(self, par_fitness: bool) -> Self

source

pub fn with_replace_on_equal_fitness( self, replace_on_equal_fitness: bool, ) -> Self

source

pub fn with_mutate(self, mutate: M) -> Self

source

pub fn with_fitness(self, fitness: F) -> Self

source

pub fn with_crossover(self, crossover: S) -> Self

source

pub fn with_compete(self, compete: C) -> Self

source

pub fn with_extension<E2: Extension>( self, extension: E2, ) -> Builder<G, M, F, S, C, E2, SR>

source

pub fn with_reporter<SR2: EvolveReporter<Allele = G::Allele>>( self, reporter: SR2, ) -> Builder<G, M, F, S, C, E, SR2>

source

pub fn with_rng_seed_from_u64(self, rng_seed: u64) -> Self

source§

impl<G: Genotype, M: Mutate, F: Fitness<Allele = G::Allele>, S: Crossover, C: Compete, E: Extension, SR: EvolveReporter<Allele = G::Allele>> Builder<G, M, F, S, C, E, SR>

source

pub fn rng(&self) -> SmallRng

source

pub fn call(self) -> Result<Evolve<G, M, F, S, C, E, SR>, TryFromBuilderError>

source

pub fn call_repeatedly( self, max_repeats: usize, ) -> Result<Evolve<G, M, F, S, C, E, SR>, TryFromBuilderError>

source

pub fn call_par_repeatedly( self, max_repeats: usize, ) -> Result<Evolve<G, M, F, S, C, E, SR>, TryFromBuilderError>

source

pub fn call_speciated( self, number_of_species: usize, ) -> Result<Evolve<G, M, F, S, C, E, SR>, TryFromBuilderError>

source

pub fn call_par_speciated( self, number_of_species: usize, ) -> Result<Evolve<G, M, F, S, C, E, SR>, TryFromBuilderError>

Trait Implementations§

source§

impl<G: Clone + Genotype, M: Clone + Mutate, F: Clone + Fitness<Allele = G::Allele>, S: Clone + Crossover, C: Clone + Compete, E: Clone + Extension, SR: Clone + EvolveReporter<Allele = G::Allele>> Clone for Builder<G, M, F, S, C, E, SR>

source§

fn clone(&self) -> Builder<G, M, F, S, C, E, SR>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<G: Debug + Genotype, M: Debug + Mutate, F: Debug + Fitness<Allele = G::Allele>, S: Debug + Crossover, C: Debug + Compete, E: Debug + Extension, SR: Debug + EvolveReporter<Allele = G::Allele>> Debug for Builder<G, M, F, S, C, E, SR>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<G: Genotype, M: Mutate, F: Fitness<Allele = G::Allele>, S: Crossover, C: Compete> Default for Builder<G, M, F, S, C, ExtensionNoop, EvolveReporterNoop<G::Allele>>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<G: Genotype, M: Mutate, F: Fitness<Allele = G::Allele>, S: Crossover, C: Compete, E: Extension, SR: EvolveReporter<Allele = G::Allele>> TryFrom<Builder<G, M, F, S, C, E, SR>> for Evolve<G, M, F, S, C, E, SR>

§

type Error = TryFromBuilderError

The type returned in the event of a conversion error.
source§

fn try_from( builder: EvolveBuilder<G, M, F, S, C, E, SR>, ) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<G, M, F, S, C, E, SR> Freeze for Builder<G, M, F, S, C, E, SR>
where E: Freeze, SR: Freeze, G: Freeze, M: Freeze, F: Freeze, S: Freeze, C: Freeze,

§

impl<G, M, F, S, C, E, SR> RefUnwindSafe for Builder<G, M, F, S, C, E, SR>

§

impl<G, M, F, S, C, E, SR> Send for Builder<G, M, F, S, C, E, SR>

§

impl<G, M, F, S, C, E, SR> Sync for Builder<G, M, F, S, C, E, SR>

§

impl<G, M, F, S, C, E, SR> Unpin for Builder<G, M, F, S, C, E, SR>
where E: Unpin, SR: Unpin, G: Unpin, M: Unpin, F: Unpin, S: Unpin, C: Unpin,

§

impl<G, M, F, S, C, E, SR> UnwindSafe for Builder<G, M, F, S, C, E, SR>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V