pub struct DNA {
pub pathways: HashMap<String, Pathway>,
pub tick_count: u64,
pub prune_threshold: f64,
}Expand description
Self-assembling pathway collection — used pathways grow, unused get pruned.
Fields§
§pathways: HashMap<String, Pathway>§tick_count: u64§prune_threshold: f64Implementations§
Source§impl DNA
impl DNA
pub fn new() -> Self
Sourcepub fn record_use(&mut self, pathway: &str)
pub fn record_use(&mut self, pathway: &str)
Record use of a pathway, creating it if it doesn’t exist.
Sourcepub fn strongest(&self, n: usize) -> Vec<(&String, &Pathway)>
pub fn strongest(&self, n: usize) -> Vec<(&String, &Pathway)>
Get the top N strongest pathways.
Sourcepub fn total_strength(&self) -> f64
pub fn total_strength(&self) -> f64
Sum of all pathway strengths.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DNA
impl<'de> Deserialize<'de> for DNA
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for DNA
Auto Trait Implementations§
impl Freeze for DNA
impl RefUnwindSafe for DNA
impl Send for DNA
impl Sync for DNA
impl Unpin for DNA
impl UnsafeUnpin for DNA
impl UnwindSafe for DNA
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