check_marl_grouping¶
- torchrl.envs.check_marl_grouping(group_map: dict[str, list[str]], agent_names: list[str])[source]¶
检查 MARL 组映射。
对 marl 环境的组映射执行检查,以评估其有效性。在 group_map 无效的情况下引发错误。
- 参数:
group_map (Dict[str, List[str]]) – 将组名映射到组中代理名称列表的组映射
agent_names (List[str]) – 环境中所有代理名称的列表4
示例
>>> from torchrl.envs.utils import MarlGroupMapType, check_marl_grouping >>> agent_names = ["agent_0", "agent_1", "agent_2"] >>> check_marl_grouping(MarlGroupMapType.ALL_IN_ONE_GROUP.get_group_map(agent_names), agent_names)