pub struct BitGene { /* private fields */ }
Expand description
A gene that represents a single bit. The allele
is a bool
that is randomly assigned.
The allele
is either true
or false
. This is the simplest form of a gene and
in traditional genetic algorithms is the gene that is used to represent the individuals.
§Example
use radiate_core::*;
// Craete a new BitGene from the allele `true`.
let gene: BitGene = true.into();
// Create a new BitGene with a random allele.
let gene = BitGene::new();
// Get the allele (bool) of the BitGene.
let allele = gene.allele();
// Create a new BitGene from the allele.
let gene = gene.with_allele(allele);
Implementations§
Trait Implementations§
Source§impl From<BitGene> for BitChromosome
impl From<BitGene> for BitChromosome
Source§fn from(gene: BitGene) -> BitChromosome
fn from(gene: BitGene) -> BitChromosome
Converts to this type from the input type.
Source§impl FromIterator<BitGene> for BitChromosome
impl FromIterator<BitGene> for BitChromosome
Source§fn from_iter<I>(iter: I) -> BitChromosomewhere
I: IntoIterator<Item = BitGene>,
fn from_iter<I>(iter: I) -> BitChromosomewhere
I: IntoIterator<Item = BitGene>,
Creates a value from an iterator. Read more
Source§impl Gene for BitGene
Implement the Gene
trait for the BitGene
.
This allows the BitGene
to be used in a Chromosome
- specifically the
BitChromosome
, thus allowing the BitGene
to be used in the GeneticEngine
.
impl Gene for BitGene
Implement the Gene
trait for the BitGene
.
This allows the BitGene
to be used in a Chromosome
- specifically the
BitChromosome
, thus allowing the BitGene
to be used in the GeneticEngine
.
impl StructuralPartialEq for BitGene
Auto Trait Implementations§
impl Freeze for BitGene
impl RefUnwindSafe for BitGene
impl Send for BitGene
impl Sync for BitGene
impl Unpin for BitGene
impl UnwindSafe for BitGene
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more