Trait Domain

Source
pub trait Domain: Sized + 'static {
    type State: Debug + Sized;
    type Diff: Debug + Default + Clone + Hash + Eq;
    type DisplayAction: Debug + Default;

    // Required methods
    fn list_behaviors() -> &'static [&'static dyn Behavior<Self>];
    fn get_current_value(
        tick: u64,
        state_diff: StateDiffRef<'_, Self>,
        agent: AgentId,
    ) -> AgentValue;
    fn update_visible_agents(
        start_tick: u64,
        tick: u64,
        state_diff: StateDiffRef<'_, Self>,
        agent: AgentId,
        agents: &mut BTreeSet<AgentId>,
    );

    // Provided methods
    fn get_tasks(
        tick: u64,
        state_diff: StateDiffRef<'_, Self>,
        agent: AgentId,
    ) -> Vec<Box<dyn Task<Self>>> { ... }
    fn get_state_description(_state_diff: StateDiffRef<'_, Self>) -> String { ... }
    fn get_new_agents(_state_diff: StateDiffRef<'_, Self>) -> Vec<AgentId> { ... }
    fn display_action_task_idle() -> Self::DisplayAction { ... }
    fn display_action_task_planning() -> Self::DisplayAction { ... }
}
Expand description

A domain on which the MCTS planner can plan.

Required Associated Types§

Source

type State: Debug + Sized

The state the MCTS plans on.

Source

type Diff: Debug + Default + Clone + Hash + Eq

A compact set of changes towards a State that are accumulated throughout planning.

Source

type DisplayAction: Debug + Default

A representation of a display action that can be fetched from a task. We need Default trait for creating the DisplayAction for the idle placeholder task.

Required Methods§

Source

fn list_behaviors() -> &'static [&'static dyn Behavior<Self>]

Returns all behaviors available for this domain.

Source

fn get_current_value( tick: u64, state_diff: StateDiffRef<'_, Self>, agent: AgentId, ) -> AgentValue

Gets the current value of the given agent in the given tick and world state.

Source

fn update_visible_agents( start_tick: u64, tick: u64, state_diff: StateDiffRef<'_, Self>, agent: AgentId, agents: &mut BTreeSet<AgentId>, )

Updates the list of agents which are in the horizon of the given agent in the given tick and world state.

Provided Methods§

Source

fn get_tasks( tick: u64, state_diff: StateDiffRef<'_, Self>, agent: AgentId, ) -> Vec<Box<dyn Task<Self>>>

Gets all possible valid tasks for a given agent in a given tick and world state.

Source

fn get_state_description(_state_diff: StateDiffRef<'_, Self>) -> String

Gets a textual description of the given world state. This will be used by the graph tool to show in each node, and the log tool to dump the state.

Source

fn get_new_agents(_state_diff: StateDiffRef<'_, Self>) -> Vec<AgentId>

Gets the new agents present in a diff but not in a state.

Source

fn display_action_task_idle() -> Self::DisplayAction

Gets the display actions for idle task.

Source

fn display_action_task_planning() -> Self::DisplayAction

Gets the display actions for planning task.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§