pub struct MultiContinuousGenotype {
    pub allele_ranges: Vec<Range<ContinuousAllele>>,
    pub allele_neighbour_ranges: Option<Vec<Range<ContinuousAllele>>>,
    pub seed_genes: Option<Vec<ContinuousAllele>>,
    /* private fields */
}
Expand description

Genes are a list of f32, each individually taken from its own allele_range. The genes_size is derived to be the allele_ranges length. On random initialization, each gene gets a value from its own allele_range with a uniform probability. Each gene has a weighted probability of mutating, depending on its allele_range size. If a gene mutates, a new values is taken from its own allele_range with a uniform probability. Duplicate allele values are allowed. Defaults to usize as item.

Optionally an allele_neighbour_ranges can be provided. When this is done the mutation is restricted to modify the existing value by a difference taken from allele_neighbour_range with a uniform probability.

Example:

use genetic_algorithm::genotype::{Genotype, MultiContinuousGenotype};

let genotype = MultiContinuousGenotype::builder()
    .with_allele_ranges(vec![
       (0.0..10.0),
       (5.0..20.0),
       (0.0..5.0),
       (10.0..30.0),
    ])
    .with_allele_neighbour_ranges(vec![
       (-1.0..1.0),
       (-2.0..2.0),
       (-0.5..0.5),
       (-3.0..3.0),
    ]) // optional
    .build()
    .unwrap();

Fields

allele_ranges: Vec<Range<ContinuousAllele>>allele_neighbour_ranges: Option<Vec<Range<ContinuousAllele>>>seed_genes: Option<Vec<ContinuousAllele>>

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

a random chromosome factory to seed the initial population for Evolve

a random mutation of the chromosome

to guard against invalid crossover strategies which break the internal consistency of the genes, unique genotypes can’t simply exchange genes without gene duplication issues Read more

to guard against invalid crossover strategies which break the internal consistency of the genes, unique genotypes can’t simply exchange genes without gene duplication issues Read more

a neighbouring mutation of the chromosome

all neighbouring mutations of the chromosome

chromosome neighbours size for the all possible neighbouring mutation combinations

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

The resulting type after obtaining ownership.

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

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.