[−][src]Struct genome::DNA
Fields
pool_size: u16
gene_size: u16
genes: Vec<Gene>
Implementations
impl DNA
[src]
pub fn new(pool_size: u16, gene_size: u16) -> DNA
[src]
pub fn is_valid(dna_str: String) -> bool
[src]
Check if current DNA string is valid.
Examples
use genome::DNA; let dna = DNA::new(2, 2); let is_valid = DNA::is_valid(dna.to_string());
pub fn merge(left_dna: DNA, right_dna: DNA, mutate: bool) -> Option<DNA>
[src]
Merge two DNA
into one
Examples
use genome::DNA; let dna1 = DNA::new(2, 2); let dna2 = DNA::new(2, 2); let merged = DNA::merge(dna1, dna2, false);
pub fn compare(left_dna: DNA, right_dna: DNA) -> f64
[src]
Compare two DNA
similarity, return the percentage of same genes
Examples
use genome::DNA; let dna1 = DNA::new(256, 2); let dna_str = dna1.to_string(); let dna2 = DNA::new(256, 2); let merged = DNA::merge(dna1, dna2, false).unwrap(); let is_parent = DNA::compare(DNA::from(dna_str), merged) > 0.3;
pub fn to_latent_vec(&self) -> Vec<f32>
[src]
Convert DNA to GAN latent vector
Examples
use genome::DNA; let dna1 = DNA::new(2, 2); let latent = dna1.to_latent_vec();
pub fn to_string(&self) -> String
[src]
Convert DNA to string
Examples
use genome::DNA; let dna1 = DNA::new(2, 2); let dna1_str = dna1.to_string();
pub fn get_sum(&self) -> f32
[src]
Get checksum for the dna, return back f32 sum of all genes.
Examples
use genome::DNA; let dna1 = DNA::new(2, 2); let dna1_str = dna1.get_sum();
Trait Implementations
impl From<DNA> for String
[src]
Convert DNA to string
Examples
use genome::DNA; let dna1 = DNA::new(2, 2); let dna1_str = String::from(dna1);
impl From<String> for DNA
[src]
Convert DNA to string
Examples
use genome::DNA; let dna1 = DNA::new(2, 2); let dna1_str = dna1.to_string(); let dna_copy = DNA::from(dna1_str);
Auto Trait Implementations
impl RefUnwindSafe for DNA
impl Send for DNA
impl Sync for DNA
impl Unpin for DNA
impl UnwindSafe for DNA
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,