pub struct Cell {
pub value: TernaryValue,
pub fitness: f64,
pub history: Vec<TernaryValue>,
pub generation: u64,
}Expand description
A single ternary cell with value, fitness, and history.
Fields§
§value: TernaryValue§fitness: f64§history: Vec<TernaryValue>§generation: u64Implementations§
Source§impl Cell
impl Cell
Sourcepub fn new(value: TernaryValue) -> Self
pub fn new(value: TernaryValue) -> Self
Create a new cell with the given value and zero fitness.
Sourcepub fn set_value(&mut self, value: TernaryValue)
pub fn set_value(&mut self, value: TernaryValue)
Set the value, recording the previous value in history.
Sourcepub fn set_fitness(&mut self, fitness: f64)
pub fn set_fitness(&mut self, fitness: f64)
Set the fitness score.
Sourcepub fn compute_default_fitness(&self) -> f64
pub fn compute_default_fitness(&self) -> f64
Compute a simple fitness: value magnitude scaled by generation diversity.
Sourcepub fn mutation_count(&self) -> usize
pub fn mutation_count(&self) -> usize
How many times has this cell changed value?
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cell
impl RefUnwindSafe for Cell
impl Send for Cell
impl Sync for Cell
impl Unpin for Cell
impl UnsafeUnpin for Cell
impl UnwindSafe for Cell
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