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§
Sourcetype Diff: Debug + Default + Clone + Hash + Eq
type Diff: Debug + Default + Clone + Hash + Eq
A compact set of changes towards a State that are accumulated throughout planning.
Sourcetype DisplayAction: Debug + Default
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§
Sourcefn list_behaviors() -> &'static [&'static dyn Behavior<Self>]
fn list_behaviors() -> &'static [&'static dyn Behavior<Self>]
Returns all behaviors available for this domain.
Sourcefn get_current_value(
tick: u64,
state_diff: StateDiffRef<'_, Self>,
agent: AgentId,
) -> AgentValue
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.
Sourcefn update_visible_agents(
start_tick: u64,
tick: u64,
state_diff: StateDiffRef<'_, Self>,
agent: AgentId,
agents: &mut BTreeSet<AgentId>,
)
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§
Sourcefn get_tasks(
tick: u64,
state_diff: StateDiffRef<'_, Self>,
agent: AgentId,
) -> Vec<Box<dyn Task<Self>>>
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.
Sourcefn get_state_description(_state_diff: StateDiffRef<'_, Self>) -> String
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.
Sourcefn get_new_agents(_state_diff: StateDiffRef<'_, Self>) -> Vec<AgentId>
fn get_new_agents(_state_diff: StateDiffRef<'_, Self>) -> Vec<AgentId>
Gets the new agents present in a diff but not in a state.
Sourcefn display_action_task_idle() -> Self::DisplayAction
fn display_action_task_idle() -> Self::DisplayAction
Gets the display actions for idle task.
Sourcefn display_action_task_planning() -> Self::DisplayAction
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".