vmas_envs#

Vectorized Multi-Agent Simulator (VMAS) Environment Wrapper

Classes#

VmasMultiGroupWrapper

Vectorized Multi-Agent Simulator (VMAS) Multi-Group Environment Wrapper

VmasWrapper

Vectorized Multi-Agent Simulator (VMAS)

class prt_rl.env.wrappers.vmas_envs.VmasMultiGroupWrapper(scenario: str, render_mode: str | None = None, **kwargs)[source]#

Vectorized Multi-Agent Simulator (VMAS) Multi-Group Environment Wrapper

The VMAS Multi-Group wrapper provides an interface to VMAS multi-agent environments where agents belong to multiple groups. This wrapper implements the MultiGroupEnvironmentInterface.

Examples

Parameters:
  • scenario (str) – Name of the VMAS environment

  • render_mode (str) – Render mode for the environment. Options are None or ‘rgb_array’.

References

[1] proroklab/VectorizedMultiAgentSimulator

close() None[source]#

Closes the environment and cleans up any resources.

get_num_envs() int#

Returns the number of environments in the interface.

Returns:

Number of environments

Return type:

int

get_parameters() MultiGroupEnvParams[source]#

Returns the EnvParams object which contains information about the sizes of observations and actions needed for setting up RL agents.

Returns:

environment parameters object

Return type:

EnvParams

reset(seed: int | None = None) Tuple[Dict[str, Tensor], Dict[str, Any]][source]#

Resets the environment to the initial state and returns the initial observation.

Parameters:

seed (int | None) – Sets the random seed.

Returns:

Tuple of tensors containing the initial observation and info dictionary

Return type:

Tuple

step(action: Dict[str, Tensor]) Tuple[Tensor, Tensor, Tensor, Dict[str, Any]][source]#

Steps the simulation using the action tensor and returns the new trajectory.

Parameters:

action (torch.Tensor) – Tensor with “action” key that is a tensor with shape (# env, # agents, # actions)

Returns:

Tuple of tensors containing the next state, reward, done, and info dictionary

Return type:

Tuple

class prt_rl.env.wrappers.vmas_envs.VmasWrapper(scenario: str, render_mode: str | None = None, **kwargs)[source]#

Vectorized Multi-Agent Simulator (VMAS)

The VMAS wrapper provides an interface to VMAS multi-agent environments where all agents belong to a single group. VmasMultiGroupWrapper should be used for environments with multiple agent groups.

Examples

Parameters:
  • scenario (str) – Name of the VMAS environment

  • render_mode (str) – Render mode for the environment. Options are None or ‘rgb_array’.

References

[1] proroklab/VectorizedMultiAgentSimulator

close() None[source]#

Closes the environment and cleans up any resources.

get_num_envs() int#

Returns the number of environments in the interface.

Returns:

Number of environments

Return type:

int

get_parameters() MultiAgentEnvParams[source]#

Returns the EnvParams object which contains information about the sizes of observations and actions needed for setting up RL agents.

Returns:

environment parameters object

Return type:

EnvParams

reset(seed: int | None = None) Tuple[Tensor, Dict[str, Any]][source]#

Resets the environment to the initial state and returns the initial observation.

Parameters:

seed (int | None) – Sets the random seed.

Returns:

Tuple of tensors containing the initial observation and info dictionary

Return type:

Tuple

step(action: Tensor) Tuple[Tensor, Tensor, Tensor, Dict[str, Any]][source]#

Steps the simulation using the action tensor and returns the new trajectory.

Parameters:

action (torch.Tensor) – Tensor with “action” key that is a tensor with shape (# env, # agents, # actions)

Returns:

Tuple of tensors containing the next state, reward, done, and info dictionary

Return type:

Tuple