Flocc
    Preparing search index...

    Interface Scheduler

    Interface for agent schedulers.

    A scheduler determines which agents should tick at any given time step. Different implementations allow for different scheduling patterns:

    • Interval-based (every N ticks)
    • Priority queue (discrete event simulation)
    • Custom patterns

    0.6.0

    interface Scheduler {
        getAgentsForTick(time: number): Agent[];
        nextScheduledTime(): number;
        onAgentAdded(agent: Agent, time: number): void;
        onAgentRemoved(agent: Agent): void;
        reset(): void;
        schedule(agent: Agent, time: number): void;
        unschedule(agent: Agent): void;
    }

    Implemented by

    Index

    Methods

    • Get all agents scheduled to tick at the given time.

      Parameters

      • time: number

        The current environment time

      Returns Agent[]

      Array of agents that should tick

    • Get the next time at which any agent is scheduled. Used for event-driven simulation to skip empty time steps.

      Returns number

      The next scheduled time, or null if nothing is scheduled

    • Called when an agent is added to the environment.

      Parameters

      • agent: Agent

        The newly added agent

      • time: number

        Current environment time

      Returns void

    • Called when an agent is removed from the environment.

      Parameters

      • agent: Agent

        The agent being removed

      Returns void

    • Schedule an agent to tick at a specific time.

      Parameters

      • agent: Agent

        The agent to schedule

      • time: number

        The time at which the agent should tick

      Returns void