Skip to main content

Valid

Trait Valid 

Source
pub trait Valid {
    // Provided method
    fn is_valid(&self) -> bool { ... }
}
Expand description

A Valid type is a type that can be checked for validity. This is used for checking if a gene or a chromosome is valid. For example, a gene that represents a number between 0 and 1 can be checked for validity by ensuring that the allele is between 0 and 1.

The GeneticEngine will check the validity of the Chromosome and Phenotype and remove any invalid individuals from the population, replacing them with new individuals at the given generation.

Provided Methods§

Source

fn is_valid(&self) -> bool

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Valid for &str

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for String

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for bool

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for char

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for f32

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for f64

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for i8

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for i16

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for i32

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for i64

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for i128

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for isize

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for u8

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for u16

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for u32

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for u64

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for u128

Source§

fn is_valid(&self) -> bool

Source§

impl Valid for usize

Source§

fn is_valid(&self) -> bool

Implementors§

Source§

impl Valid for BitChromosome

Every BitGene is valid, so the BitChromosome is also valid.

Source§

impl Valid for BitGene

Because a BitGene is either true or false it is always valid.

Source§

impl Valid for CharChromosome

Source§

impl Valid for CharGene

Source§

impl Valid for Rate

Source§

impl<A> Valid for PermutationChromosome<A>
where A: PartialEq + Clone,

Source§

impl<A> Valid for PermutationGene<A>
where A: PartialEq + Clone,

Source§

impl<C> Valid for Genotype<C>
where C: Chromosome,

Source§

impl<C> Valid for Phenotype<C>
where C: Chromosome,

Implement the Valid trait for the Phenotype. This allows the Phenotype to be checked for validity. A Phenotype is valid if the Genotype is valid. The GeneticEngine checks the validity of the Phenotype and will remove any invalid individuals from the population, replacing them with new individuals at the given generation.

Source§

impl<F> Valid for FloatChromosome<F>
where F: Float,

Source§

impl<F> Valid for FloatGene<F>
where F: Float,

Implement the Valid trait for the FloatGene.

The is_valid method checks if the allele of the FloatGene is between the min and max values. The GeneticEngine will check the validity of the Chromosome and Phenotype and remove any invalid individuals from the population, replacing them with new individuals at the given generation.

Source§

impl<T> Valid for IntChromosome<T>
where T: Integer,

Source§

impl<T> Valid for IntGene<T>
where T: Integer,

Implement the Valid trait for IntGene. This allows the IntGene to be checked for validity. An IntGene is valid if the allele is between the min and max values.

Note: the bounds are used for crossover and mutation.