Petting Zoo Vector Base Class

Base class for vectorized pettingzoo environments.

Parameters

class agilerl.vector.pz_vec_env.PettingZooVecEnv(num_envs, possible_agents)

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:
  • num_envs (int) – Number of environments to vectorize

  • possible_agents (list[str]) – List of possible agents

close(**kwargs)

Clean up the environments’ resources.

close_extras(**kwargs: Any)

Clean up the extra resources e.g. beyond what’s in this base class.

render()

Returns the rendered frames from the parallel environments.

reset(seed=None, options=None)

Reset all the environments and return two dictionaries of batched observations and infos.

Parameters:
  • seed (None | int, optional) – Random seed, defaults to None

  • options (dict[str, Any]) – Options dictionary

step(actions)

Take an action for each parallel environment

Parameters:

actions (dict[str, np.ndarray]) – Dictionary of vectorized actions for each agent.

step_async(actions)

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.

Parameters:

actions (list[list[int | float | np.ndarray]]) – List of lists of length num_envs, each sub list contains actions for each agent in a given environment

step_wait()

Wait for the step taken with step_async().

property unwrapped

Return the base environment.