Trait ExecutorStateGlobal

Source
pub trait ExecutorStateGlobal<D: GlobalDomain> {
    // Required methods
    fn create_initial_state(&self) -> D::GlobalState;
    fn init_task_queue(&self, state: &D::GlobalState) -> ActiveTasks<D>;

    // Provided methods
    fn keep_agent(
        &self,
        _tick: u64,
        _state: &D::GlobalState,
        _agent: AgentId,
    ) -> bool { ... }
    fn keep_execution(
        &self,
        _tick: u64,
        _queue: &ActiveTasks<D>,
        _state: &D::GlobalState,
    ) -> bool { ... }
    fn post_step_hook(&self, _tick: u64, _state: &D::GlobalState) { ... }
}
Expand description

User-defined methods for the executor, where world and planner states are different.

This trait is typically used with the ThreadedExecutor. You must implement at least create_initial_state and init_task_queue, to create the initial state and build the initial list of tasks from it.

Required Methods§

Source

fn create_initial_state(&self) -> D::GlobalState

Creates the initial world state.

Source

fn init_task_queue(&self, state: &D::GlobalState) -> ActiveTasks<D>

Fills the initial queue of tasks.

Provided Methods§

Source

fn keep_agent( &self, _tick: u64, _state: &D::GlobalState, _agent: AgentId, ) -> bool

Returns whether an agent should be kept in a given state (to remove dead agents) (by default returns true).

Source

fn keep_execution( &self, _tick: u64, _queue: &ActiveTasks<D>, _state: &D::GlobalState, ) -> bool

Returns whether execution should continue in given state (by default returns true).

Source

fn post_step_hook(&self, _tick: u64, _state: &D::GlobalState)

Method called from ThreadedExecutor::step after all tasks have been executed at a given step (by default does nothing).

Implementors§