Skip to main content

Colony

Struct Colony 

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

The colony — manages agent lifecycle and simulation.

Implementations§

Source§

impl Colony

Source

pub fn new() -> Self

Source

pub fn with_semantic_wiring(self, config: SemanticWiringConfig) -> Self

Configure semantic wiring for embedding-based edge weights.

Source

pub fn semantic_wiring_config(&self) -> &SemanticWiringConfig

Get the current semantic wiring configuration.

Source

pub fn set_semantic_wiring(&mut self, config: SemanticWiringConfig)

Set the semantic wiring configuration.

Source

pub fn spawn( &mut self, agent: Box<dyn Agent<Input = String, Fragment = String, Presentation = Vec<String>>>, ) -> AgentId

Spawn an agent into the colony.

Source

pub fn ingest_document( &mut self, title: &str, content: &str, position: Position, ) -> DocumentId

Ingest a document into the substrate.

Places the document at the given position and emits an Input signal to attract nearby agents via chemotaxis.

Source

pub fn tick(&mut self) -> Vec<ColonyEvent>

Run a single simulation tick.

Source

pub fn run(&mut self, ticks: u64) -> Vec<Vec<ColonyEvent>>

Run the simulation for N ticks.

Source

pub fn stats(&self) -> ColonyStats

Get colony statistics.

Source

pub fn substrate(&self) -> &SubstrateImpl

Get a reference to the substrate.

Source

pub fn substrate_mut(&mut self) -> &mut SubstrateImpl

Get a mutable reference to the substrate.

Source

pub fn alive_count(&self) -> usize

Number of agents currently alive.

Source

pub fn death_signals(&self) -> &[DeathSignal]

All death signals collected during the simulation.

Source

pub fn feed_agent( &mut self, agent_idx: usize, input: String, ) -> Option<DigestionResult>

Feed text input to a specific agent by index.

Source

pub fn snapshot(&self) -> ColonySnapshot

Take a serializable snapshot of the colony’s current state.

Source

pub fn event_history(&self) -> &[(Tick, ColonyEvent)]

Get the full event history with tick numbers.

Source

pub fn agents( &self, ) -> &[Box<dyn Agent<Input = String, Fragment = String, Presentation = Vec<String>>>]

Get a reference to the agents.

Source

pub fn fitness_tracker(&self) -> &FitnessTracker

Get a reference to the fitness tracker.

Source

pub fn fitness_tracker_mut(&mut self) -> &mut FitnessTracker

Get a mutable reference to the fitness tracker.

Source

pub fn emit_input_signal(&mut self, position: Position, intensity: f64)

Emit an input signal at a position (to attract agents).

Trait Implementations§

Source§

impl Default for Colony

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Colony

§

impl !RefUnwindSafe for Colony

§

impl !Send for Colony

§

impl !Sync for Colony

§

impl Unpin for Colony

§

impl !UnwindSafe for Colony

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.