multiprocess_env¶
Module multiprocess_env. Specifies a vectorized environment where each instance of the environment is run independently. The implementation of the environment is taken from the book Grokking Deep Reinforcement Learning Algorithms by Manning publications
- class multiprocess_env.MultiprocessEnv(env_builder: Callable, env_args: dict, n_workers: int)¶
MultiprocessEnv class
- __init__(env_builder: Callable, env_args: dict, n_workers: int)¶
- __len__() int ¶
The number of workers handled by this instance
- _broadcast_msg(msg)¶
Broadcast the message to all workers
- Parameters
msg –
- _send_msg(msg: Any, rank: int)¶
Send the message to the process with the given rank
- Parameters
msg (The message to send) –
rank (The rank of the proces to send the message) –
- make(agent: Agent)¶
Create the workers
- work(rank, env_builder: Callable, env_args: dict, agent: Agent, pipe_end) None ¶
The worker function
- Parameters
rank (The rank of the worker) –
env_builder (The callable that builds the worker environment) –
env_args (The callable arguments) –
worker_end –
- Return type
None