You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"When an agent is terminated or truncated, it’s removed from agents, so when the environments done agents will be an empty list. This means not env.agents is a simple condition for the environment being done." - PettingZoo Doc
I tested this on connect_four_v3 and it does not work:
The env.agents will still have agents in the list even after all agents have terminated. This can be checked by conditioning a break point on all terminated agents.
Code example
import numpy as np
import pettingzoo
from pettingzoo.classic import connect_four_v3
def test_connect4():
obs: dict[str, np.ndarray]
termination: bool
truncation: bool
env: pettingzoo.AECEnv = connect_four_v3.env(render_mode="human")
env.reset(seed=42)
foragentinenv.agent_iter():
obs, _, termination, truncation, _ = env.last() # type: ignoreif termination or truncation:
if len(env.agents) > 0:
print(f"env.agents: {env.agents}")
raise ValueError("env.agents should be empty!")
mask = obs["action_mask"]
# this is where you would insert your policy
action = env.action_space(agent).sample(mask)
env.step(action)
env.close()
System info
Running on Intel based Macbook Pro 2019.
Additional context
No response
Checklist
I have checked that there is no similar issue in the repo
The text was updated successfully, but these errors were encountered:
Describe the bug
According to the documentation:
"When an agent is terminated or truncated, it’s removed from
agents
, so when the environments doneagents
will be an empty list. This means notenv.agents
is a simple condition for the environment being done." - PettingZoo DocI tested this on
connect_four_v3
and it does not work:The
env.agents
will still have agents in the list even after all agents have terminated. This can be checked by conditioning a break point on all terminated agents.Code example
System info
Running on Intel based Macbook Pro 2019.
Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: