Skip to main content

RealValuedGenome

Trait RealValuedGenome 

Source
pub trait RealValuedGenome: EvolutionaryGenome<Allele = f64> {
    // Required methods
    fn genes(&self) -> &[f64];
    fn genes_mut(&mut self) -> &mut [f64];
    fn from_genes(genes: Vec<f64>) -> Result<Self, GenomeError>;

    // Provided method
    fn apply_bounds(&mut self, bounds: &MultiBounds) { ... }
}
Expand description

Trait for genomes that can be represented as real vectors

Required Methods§

Source

fn genes(&self) -> &[f64]

Get the genes as a slice of f64 values

Source

fn genes_mut(&mut self) -> &mut [f64]

Get the genes as a mutable slice of f64 values

Source

fn from_genes(genes: Vec<f64>) -> Result<Self, GenomeError>

Create from a vector of genes

Provided Methods§

Source

fn apply_bounds(&mut self, bounds: &MultiBounds)

Apply bounds to all genes

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§