pub struct ThreadedExecutor<'a, D, S>where
D: DomainWithPlanningTask + GlobalDomain,
D::State: Clone + Send,
D::Diff: Send + Sync,
S: ExecutorState<D> + ExecutorStateGlobal<D>,{ /* private fields */ }
Expand description
A multi-threaded generic executor.
It maintains a D::GlobalState out of which a D::State is derived for planning. This allows to simulate a large world with many agents, each of them planning on a small subset of that world. The helper function run_threaded_executor can create and run it for you.
Implementations§
Source§impl<'a, D, S> ThreadedExecutor<'a, D, S>where
D: DomainWithPlanningTask + GlobalDomain,
D::State: Clone + Send,
D::Diff: Send + Sync,
S: ExecutorState<D> + ExecutorStateGlobal<D>,
impl<'a, D, S> ThreadedExecutor<'a, D, S>where
D: DomainWithPlanningTask + GlobalDomain,
D::State: Clone + Send,
D::Diff: Send + Sync,
S: ExecutorState<D> + ExecutorStateGlobal<D>,
Sourcepub fn new(mcts_config: MCTSConfiguration, executor_state: &'a mut S) -> Self
pub fn new(mcts_config: MCTSConfiguration, executor_state: &'a mut S) -> Self
Creates a new executor, initializes state and task queue from the S trait.
Sourcepub fn step(&mut self) -> bool
pub fn step(&mut self) -> bool
Executes all tasks finishing at the current tick and then increments it.
Returns whether execution should continue.
Sourcepub fn state(&self) -> &D::GlobalState
pub fn state(&self) -> &D::GlobalState
Gets the global state, read-only.
Sourcepub fn agents_count(&self) -> usize
pub fn agents_count(&self) -> usize
Gets the number of active agents in the execution queue.
Auto Trait Implementations§
impl<'a, D, S> Freeze for ThreadedExecutor<'a, D, S>
impl<'a, D, S> !RefUnwindSafe for ThreadedExecutor<'a, D, S>
impl<'a, D, S> Send for ThreadedExecutor<'a, D, S>
impl<'a, D, S> Sync for ThreadedExecutor<'a, D, S>
impl<'a, D, S> Unpin for ThreadedExecutor<'a, D, S>
impl<'a, D, S> !UnwindSafe for ThreadedExecutor<'a, D, S>
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified
method
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford
method by default
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
Mutably borrows from an owned value. Read more
Source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
Source§fn convert_into(self) -> U
fn convert_into(self) -> U
Convert into T with values clamped to the color defined bounds Read more
Source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
Source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined range,
otherwise an
OutOfBounds
error is returned which contains the unclamped color. Read moreSource§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.