Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update parallel_test.py to support Ray RLLib MultiAgentEnv #1096

Merged
merged 4 commits into from
Sep 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions pettingzoo/test/parallel_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,8 @@ def parallel_api_test(par_env: ParallelEnv, num_cycles=1000):

has_finished |= {
agent
for agent, d in [
(x[0], x[1] or y[1])
jjshoots marked this conversation as resolved.
Show resolved Hide resolved
for x, y in zip(terminated.items(), truncated.items())
]
if d
for agent in live_agents
if terminated[agent] or truncated[agent]
}
if not par_env.agents and has_finished != set(par_env.possible_agents):
warnings.warn(
Expand All @@ -117,11 +114,8 @@ def parallel_api_test(par_env: ParallelEnv, num_cycles=1000):
agent
), "action_space should return the exact same space object (not a copy) for an agent (ensures that action space seeding works as expected). Consider decorating your action_space(self, agent) method with @functools.lru_cache(maxsize=None)"

for agent, d in [
(x[0], x[1] or y[1])
for x, y in zip(terminated.items(), truncated.items())
]:
if d:
for agent in live_agents:
if terminated[agent] or truncated[agent]:
live_agents.remove(agent)

assert (
Expand Down