[][src]Struct heredity::Parameters

pub struct Parameters<T: FitnessEvaluator> {
    pub population_size: usize,
    pub genetic_code_length: usize,
    pub keep_threshold: f64,
    pub mutation_chance_percent: f64,
    pub emit_result_every: usize,
    pub fitness_evaluator: T,

Parameters of a simulation.


population_size: usize

Size of the population for every generation. (default = 100)

Increasing this value might improve results (because of a larger gene pool), but will drastically increase time to convergence.

genetic_code_length: usize

The length of the genetic code for all cells (default = 10)

This value will most likely need to be changed in accordance with the problem you're trying to solve.

keep_threshold: f64mutation_chance_percent: f64emit_result_every: usize

How many generations between result samples (default = 1000)

Since observing results are expensive (a result contains a copy of the genetic code of the current best cell), this parameter allows fine-grained control on exactly when progress is observed. Lower values will decrease performance but increase observability, and vice-versa.

fitness_evaluator: T

The fitness evaluator to use for this simulation.


impl<T> Parameters<T> where
    T: FitnessEvaluator

pub fn new(evaluator: T) -> Parameters<T>[src]

pub fn with_population_size(self, population_size: usize) -> Self[src]

pub fn with_genetic_code_length(self, length: usize) -> Self[src]

pub fn with_keep_threshold(self, threshold: f64) -> Self[src]

pub fn with_mutation_chance_percent(self, mutation_chance: f64) -> Self[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Parameters<T> where
    T: RefUnwindSafe

impl<T> Send for Parameters<T> where
    T: Send

impl<T> Sync for Parameters<T> where
    T: Sync

impl<T> Unpin for Parameters<T> where
    T: Unpin

impl<T> UnwindSafe for Parameters<T> where
    T: UnwindSafe

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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.

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