Shimmy 兼容性封装器¶
Shimmy 软件包(pip install shimmy
)允许常用的外部强化学习环境与 PettingZoo 和 Gymnasium 一起使用。
支持的多智能体环境:¶
OpenSpiel¶
70+ 种各类棋盘游戏的实现
DeepMind Control 足球¶
多智能体机器人环境,智能体团队在其中进行足球比赛。
DeepMind Melting Pot¶
用于多智能体强化学习的测试场景套件
评估对新颖社交情境的泛化能力
熟悉和不熟悉的个体
社会互动:合作、竞争、欺骗、互惠、信任、固执
50+ 种基底和 250+ 个测试场景
用法¶
加载 DeepMind Control 多智能体足球游戏
from shimmy import DmControlMultiAgentCompatibilityV0
from dm_control.locomotion import soccer as dm_soccer
env = dm_soccer.load(team_size=2)
env = DmControlMultiAgentCompatibilityV0(env, render_mode="human")
observations, infos = env.reset()
while env.agents:
actions = {agent: env.action_space(agent).sample() for agent in env.agents} # this is where you would insert your policy
observations, rewards, terminations, truncations, infos = env.step(actions)
加载 OpenSpiel 的双陆棋游戏,使用 TerminateIllegalWrapper 封装
from shimmy import OpenSpielCompatibilityV0
from pettingzoo.utils import TerminateIllegalWrapper
env = OpenSpielCompatibilityV0(game_name="chess", render_mode=None)
env = TerminateIllegalWrapper(env, illegal_reward=-1)
env.reset()
for agent in env.agent_iter():
observation, reward, termination, truncation, info = env.last()
if termination or truncation:
action = None
else:
action = env.action_space(agent).sample(info["action_mask"]) # this is where you would insert your policy
env.step(action)
env.render()
加载 Melting Pot 中矩阵囚徒困境基底
from shimmy import MeltingPotCompatibilityV0
env = MeltingPotCompatibilityV0(substrate_name="prisoners_dilemma_in_the_matrix__arena", render_mode="human")
observations, infos = env.reset()
while env.agents:
actions = {agent: env.action_space(agent).sample() for agent in env.agents}
observations, rewards, terminations, truncations, infos = env.step(actions)
env.step(actions)
env.close()
更多信息,请参阅Shimmy 文档。
多智能体兼容性封装器:¶
引用¶
如果您在研究中使用此内容,请引用
@software{shimmy2022github,
author = {{Jun Jet Tai, Mark Towers, Elliot Tower} and Jordan Terry},
title = {Shimmy: Gymnasium and PettingZoo Wrappers for Commonly Used Environments},
url = {https://github.com/Farama-Foundation/Shimmy},
version = {1.0.0},
year = {2022},
}