Petting Zoo Vector Base Class¶
Base class for vectorized pettingzoo environments.
Parameters¶
- class agilerl.vector.pz_vec_env.PettingZooVecEnv(num_envs: int, observation_spaces: Dict[str, Space], action_spaces: List[Space], possible_agents: List[str])¶
An abstract asynchronous, vectorized environment
- References:
https://github.com/openai/baselines/tree/master/baselines/common/vec_env https://github.com/Farama-Foundation/Gymnasium/blob/main/gymnasium/vector/vector_env.py
- Parameters:
- close_extras(**kwargs: Any) None ¶
Clean up the extra resources e.g. beyond what’s in this base class.
- reset(seed: int | None = None, options: Dict[str, Any] | None = None) Dict[str, Any] ¶
Reset all the environments and return two dictionaries of batched observations and infos.
- step(actions: Dict[str, ndarray]) Dict[str, ndarray] | Dict[str, Any] ¶
Take an action for each parallel environment
- step_async(actions: List[List[int | float | ndarray | Tensor]]) None ¶
Tell all the environments to start taking a step with the given actions. Call step_wait() to get the results of the step. You should not call this if a step_async run is already pending.
- property unwrapped: PettingZooVecEnv¶
Return the base environment.