Parameters

Struct Parameters 

Source
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,
}
Expand description

Parameters of a simulation.

Fields§

§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: f64§mutation_chance_percent: f64§emit_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.

Implementations§

Source§

impl<T> Parameters<T>

Source

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

Source

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

Source

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

Source

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

Source

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

Auto Trait Implementations§

§

impl<T> Freeze for Parameters<T>
where T: Freeze,

§

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§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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