Skip to main content

FitnessTracker

Struct FitnessTracker 

Source
pub struct FitnessTracker { /* private fields */ }
Expand description

Tracks fitness across all agents in a colony.

Implementations§

Source§

impl FitnessTracker

Source

pub fn new() -> FitnessTracker

Source

pub fn register(&mut self, agent_id: AgentId, generation: u32)

Register a new agent with its generation.

Source

pub fn record_concepts(&mut self, agent_id: &AgentId, count: u64)

Record that an agent added concepts to the graph.

Source

pub fn record_edges(&mut self, agent_id: &AgentId, count: u64)

Record that an agent contributed edges.

Source

pub fn record_novel_concepts(&mut self, agent_id: &AgentId, count: u64)

Record novel concepts (concepts that didn’t exist in the graph before).

Source

pub fn record_bridge_edges(&mut self, agent_id: &AgentId, count: u64)

Record bridge edges (edges connecting previously isolated clusters).

Source

pub fn record_strong_edges(&mut self, agent_id: &AgentId, count: u64)

Record strong edges (co_activations >= 2).

Source

pub fn tick_all(&mut self, alive_ids: &[AgentId])

Record a tick for all registered agents.

Source

pub fn fittest(&self, alive_ids: &[AgentId]) -> Option<&AgentFitness>

Get the fittest living agent.

Source

pub fn get(&self, agent_id: &AgentId) -> Option<&AgentFitness>

Get fitness data for an agent.

Source

pub fn all(&self) -> Vec<&AgentFitness>

Get all fitness data.

Source

pub fn mean_fitness(&self, alive_ids: &[AgentId]) -> f64

Mean fitness of living agents.

Source

pub fn next_generation(&mut self) -> u32

Next generation number.

Source

pub fn max_generation(&self) -> u32

Current max generation.

Trait Implementations§

Source§

impl Default for FitnessTracker

Source§

fn default() -> FitnessTracker

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.