简单说话者听者

../../../_images/mpe_simple_speaker_listener.gif

警告

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

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

导入

from pettingzoo.mpe import simple_speaker_listener_v4

动作

离散/连续

并行 API

手动控制

智能体

agents=[speaker_0, listener_0]

智能体

2

动作空间形状

(3),(5)

动作值

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

观察空间形状

(3),(11)

观察值

(-inf,inf)

状态空间形状

(14,)

状态值

(-inf,inf)

此环境与 simple_reference 类似,但一个智能体是‘说话者’(灰色),可以说话但不能移动,而另一个智能体是‘听者’(不能说话,但必须导航到正确地标)。

说话者的观察空间: [goal_id]

听者的观察空间: [self_vel, all_landmark_rel_positions, communication]

说话者的动作空间: [say_0, say_1, say_2, say_3, say_4, say_5, say_6, say_7, say_8, say_9]

听者的动作空间: [no_action, move_left, move_right, move_down, move_up]

参数

simple_speaker_listener_v4.env(max_cycles=25, continuous_actions=False, dynamic_rescaling=False)

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

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

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

用法

AEC

from pettingzoo.mpe import simple_speaker_listener_v4

env = simple_speaker_listener_v4.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()

并行

from pettingzoo.mpe import simple_speaker_listener_v4

env = simple_speaker_listener_v4.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_speaker_listener.simple_speaker_listener.raw_env(max_cycles=25, continuous_actions=False, render_mode=None, dynamic_rescaling=False)[source]