benchmarl.environments.MAgentTask

class MAgentTask(value)[source]

Bases: Task

Enum for MAgent2 tasks.

ADVERSARIAL_PURSUIT = 1
static associated_class()[source]

The associated task class

classmethod env_name() str

The name of the environment in the benchmarl/conf/task folder

get_task(config: Dict[str, Any] | None = None) TaskClass

Get the TaskClass object associated with this enum element by passing it the task name and config.

If no config is given, it will be loaded from benchmarl/conf/task/self.env_name()/self.name using Task.get_from_yaml().

Parameters:
  • config (dict) – Optional configuration of the task.

  • provided (If not)

  • yaml. (the default configuration will be loaded from)

Returns:

The TaskClass object for the task.

get_from_yaml(path: str | None = None) TaskClass

Load the task configuration from yaml

Parameters:

path (str, optional) – The full path of the yaml file to load from. If None, it will default to benchmarl/conf/task/self.env_name()/self.name

Returns:

the TaskClass with the loaded config

property config
update_config(config: Dict[str, Any]) Task
supports_continuous_actions() bool
supports_discrete_actions() bool
max_steps(env: EnvBase) int
has_render(env: EnvBase) bool
group_map(env: EnvBase) Dict[str, List[str]]
observation_spec(env: EnvBase) Composite
info_spec(env: EnvBase) Composite | None
state_spec(env: EnvBase) Composite | None
action_spec(env: EnvBase) Composite
action_mask_spec(env: EnvBase) Composite | None
static log_info(batch: TensorDictBase) Dict[str, float]
get_reward_sum_transform(env: EnvBase) Transform
get_env_transforms(env: EnvBase) List[Transform]
get_replay_buffer_transforms(env: EnvBase, group: str) List[Transform]
static render_callback(experiment, env: EnvBase, data: TensorDictBase)