pub struct MCTS<D: Domain> { /* private fields */ }
Expand description
The state of a running planner instance.
Implementations§
Source§impl<D: Domain> MCTS<D>
impl<D: Domain> MCTS<D>
Sourcepub fn new(
initial_state: D::State,
root_agent: AgentId,
config: MCTSConfiguration,
) -> Self
pub fn new( initial_state: D::State, root_agent: AgentId, config: MCTSConfiguration, ) -> Self
Instantiates a new search tree for the given state, with idle tasks for all agents and starting at tick 0.
Sourcepub fn new_with_tasks(
initial_state: D::State,
root_agent: AgentId,
start_tick: u64,
tasks: ActiveTasks<D>,
config: MCTSConfiguration,
state_value_estimator: Box<dyn StateValueEstimator<D> + Send>,
early_stop_condition: Option<Box<EarlyStopCondition>>,
) -> Self
pub fn new_with_tasks( initial_state: D::State, root_agent: AgentId, start_tick: u64, tasks: ActiveTasks<D>, config: MCTSConfiguration, state_value_estimator: Box<dyn StateValueEstimator<D> + Send>, early_stop_condition: Option<Box<EarlyStopCondition>>, ) -> Self
Instantiates a new search tree for the given state, with active tasks for all agents and starting at a given tick.
Sourcepub fn best_task_at_root(&mut self) -> Option<Box<dyn Task<D>>>
pub fn best_task_at_root(&mut self) -> Option<Box<dyn Task<D>>>
Returns the best task, using exploration value of 0.
Sourcepub fn best_task_with_history(
&self,
task_history: &HashMap<AgentId, ActiveTask<D>>,
) -> Box<dyn Task<D>>where
D: DomainWithPlanningTask,
pub fn best_task_with_history(
&self,
task_history: &HashMap<AgentId, ActiveTask<D>>,
) -> Box<dyn Task<D>>where
D: DomainWithPlanningTask,
Returns the best task, following a given recent task history, in case planning tasks are used.
Sourcepub fn q_value_at_root(&self, agent: AgentId) -> f32
pub fn q_value_at_root(&self, agent: AgentId) -> f32
Returns the q-value at root.
Sourcepub fn run(&mut self) -> Option<Box<dyn Task<D>>>
pub fn run(&mut self) -> Option<Box<dyn Task<D>>>
Executes the MCTS search.
Returns the current best task, if there is at least one task for the root node.
Sourcepub fn initial_state(&self) -> &D::State
pub fn initial_state(&self) -> &D::State
Returns the initial state at the root of the planning tree.
Sourcepub fn start_tick(&self) -> u64
pub fn start_tick(&self) -> u64
Returns the tick at the root of the planning tree.
Sourcepub fn min_max_range(&self, agent: AgentId) -> Range<AgentValue>
pub fn min_max_range(&self, agent: AgentId) -> Range<AgentValue>
Returns the range of minimum and maximum global values.
Sourcepub fn nodes(&self) -> impl Iterator<Item = (&Node<D>, &Edges<D>)>
pub fn nodes(&self) -> impl Iterator<Item = (&Node<D>, &Edges<D>)>
Returns an iterator over all nodes and edges in the tree.
Sourcepub fn get_edges(&self, node: &Node<D>) -> Option<&Edges<D>>
pub fn get_edges(&self, node: &Node<D>) -> Option<&Edges<D>>
Returns the edges associated to a given node.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the number of nodes.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Returns the number of nodes.
Auto Trait Implementations§
impl<D> Freeze for MCTS<D>
impl<D> !RefUnwindSafe for MCTS<D>
impl<D> Send for MCTS<D>
impl<D> !Sync for MCTS<D>
impl<D> Unpin for MCTS<D>
impl<D> !UnwindSafe for MCTS<D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.