简单参考

../../../_images/mpe_simple_reference.gif

警告

环境 pettingzoo.mpe.simple_reference_v3 已移至新的 MPE2 包,并将在未来版本中从 PettingZoo 中移除。请更新您的导入到 mpe2.simple_reference_v3

此环境是 MPE 环境的一部分。请先阅读该页面以获取一般信息。

导入

from pettingzoo.mpe import simple_reference_v3

动作

离散/连续

Parallel API

手动控制

智能体

agents= [agent_0, agent_1]

智能体

3

动作空间形状

(5)

动作值

Discrete(5)/Box(0.0, 1.0, (5))

观测空间形状

(8),(10)

观测值

(-inf,inf)

状态空间形状

(28,)

状态值

(-inf,inf)

此环境包含 2 个智能体和 3 个不同颜色的地标。每个智能体都希望靠近其目标地标,但目标地标只由其他智能体知道。两个智能体同时是说话者和听众。

在局部层面,智能体因其到目标地标的距离而获得奖励。在全局层面,所有智能体因所有智能体到各自地标的平均距离而获得奖励。这些奖励的相对权重由 local_ratio 参数控制。

智能体观测空间:[self_vel, all_landmark_rel_positions, landmark_ids, goal_id, communication]

智能体离散动作空间:[say_0, say_1, say_2, say_3, say_4, say_5, say_6, say_7, say_8, say_9] X [no_action, move_left, move_right, move_down, move_up]

其中 X 是笛卡尔积(总动作空间为 50)。

智能体连续动作空间:[no_action, move_left, move_right, move_down, move_up, say_0, say_1, say_2, say_3, say_4, say_5, say_6, say_7, say_8, say_9]

参数

simple_reference_v3.env(local_ratio=0.5, max_cycles=25, continuous_actions=False, dynamic_rescaling=False)

local_ratio:应用于局部奖励和全局奖励的权重。全局奖励权重始终为 1 - 局部奖励权重。

max_cycles:游戏终止前的帧数(每个智能体的一个步长)

continuous_actions:智能体动作空间是离散的(默认)还是连续的

dynamic_rescaling:是否根据屏幕尺寸重新缩放智能体和地标的大小

用法

AEC

from pettingzoo.mpe import simple_reference_v3

env = simple_reference_v3.env(render_mode="human")
env.reset(seed=42)

for agent in env.agent_iter():
    observation, reward, termination, truncation, info = env.last()

    if termination or truncation:
        action = None
    else:
        # this is where you would insert your policy
        action = env.action_space(agent).sample()

    env.step(action)
env.close()

Parallel

from pettingzoo.mpe import simple_reference_v3

env = simple_reference_v3.parallel_env(render_mode="human")
observations, infos = env.reset()

while env.agents:
    # this is where you would insert your policy
    actions = {agent: env.action_space(agent).sample() for agent in env.agents}

    observations, rewards, terminations, truncations, infos = env.step(actions)
env.close()

API

class pettingzoo.mpe.simple_reference.simple_reference.raw_env(local_ratio=0.5, max_cycles=25, continuous_actions=False, render_mode=None, dynamic_rescaling=False)[source]