pub struct ActorManager<A, E, R, P>where
A: Agent<E, R> + Configurable + SyncModel,
E: Env,
P: StepProcessor<E>,
R: ExperienceBufferBase<Item = P::Output> + ReplayBufferBase,{ /* private fields */ }
Expand description
Manages Actor
s.
This struct handles the following requests:
- From the
AsyncTrainer
for updating the latest model info, stored in this struct. - From the
Actor
s for getting the latest model info. - From the
Actor
s for pushing sample batch to theLearnerManager
.
Implementations§
Source§impl<A, E, R, P> ActorManager<A, E, R, P>where
A: Agent<E, R> + Configurable + SyncModel + 'static,
E: Env,
P: StepProcessor<E>,
R: ExperienceBufferBase<Item = P::Output> + Send + 'static + ReplayBufferBase,
A::Config: Send + 'static,
E::Config: Send + 'static,
P::Config: Send + 'static,
R::Item: Send + 'static,
A::ModelInfo: Send + 'static,
impl<A, E, R, P> ActorManager<A, E, R, P>where
A: Agent<E, R> + Configurable + SyncModel + 'static,
E: Env,
P: StepProcessor<E>,
R: ExperienceBufferBase<Item = P::Output> + Send + 'static + ReplayBufferBase,
A::Config: Send + 'static,
E::Config: Send + 'static,
P::Config: Send + 'static,
R::Item: Send + 'static,
A::ModelInfo: Send + 'static,
Sourcepub fn build(
config: &ActorManagerConfig,
agent_configs: &Vec<A::Config>,
env_config: &E::Config,
step_proc_config: &P::Config,
pushed_item_message_sender: Sender<PushedItemMessage<R::Item>>,
model_info_receiver: Receiver<(usize, A::ModelInfo)>,
stop: Arc<Mutex<bool>>,
) -> Self
pub fn build( config: &ActorManagerConfig, agent_configs: &Vec<A::Config>, env_config: &E::Config, step_proc_config: &P::Config, pushed_item_message_sender: Sender<PushedItemMessage<R::Item>>, model_info_receiver: Receiver<(usize, A::ModelInfo)>, stop: Arc<Mutex<bool>>, ) -> Self
Builds a ActorManager
.
Sourcepub fn run(&mut self, guard_init_env: Arc<Mutex<bool>>)
pub fn run(&mut self, guard_init_env: Arc<Mutex<bool>>)
Runs threads for Actor
s and a thread for sending samples into the replay buffer.
Each thread is blocked until receiving the initial SyncModel::ModelInfo
from AsyncTrainer
.
Sourcepub fn stop_and_join(self) -> Vec<ActorStat>
pub fn stop_and_join(self) -> Vec<ActorStat>
Stops and joins actors.
Auto Trait Implementations§
impl<A, E, R, P> Freeze for ActorManager<A, E, R, P>
impl<A, E, R, P> !RefUnwindSafe for ActorManager<A, E, R, P>
impl<A, E, R, P> Send for ActorManager<A, E, R, P>
impl<A, E, R, P> Sync for ActorManager<A, E, R, P>
impl<A, E, R, P> Unpin for ActorManager<A, E, R, P>
impl<A, E, R, P> !UnwindSafe for ActorManager<A, E, R, P>
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
Mutably borrows from an owned value. Read more