Skip to main content

Scheduler

Trait Scheduler 

Source
pub trait Scheduler<M> {
    // Required method
    fn schedule_into(&mut self, model: &M, buf: &mut Vec<AgentId>);
}
Expand description

Trait for agent activation schedulers.

Each step, the model calls schedule_into to populate a buffer with the agent IDs to activate, in the desired order. The buffer is cleared by the caller before being passed in.

Schedulers are stateless - the buffer is owned by the model and reused across steps to avoid per-step allocations.

Required Methods§

Source

fn schedule_into(&mut self, model: &M, buf: &mut Vec<AgentId>)

Fill buf with the agent IDs to activate this step, in the desired order.

The buffer is cleared by the caller before this method is invoked.

Implementors§

Source§

impl<M> Scheduler<M> for ById
where M: HasAgentIds,

Source§

impl<M> Scheduler<M> for Fastest
where M: HasAgentIds,

Source§

impl<M> Scheduler<M> for PartiallyRandom
where M: HasAgentIds + Model,

Source§

impl<M> Scheduler<M> for Randomly
where M: HasAgentIds + Model,

Source§

impl<M, F, K> Scheduler<M> for ByProperty<F>
where M: HasAgentIds + Model, F: Fn(&M::Agent) -> K, K: Ord,