ValueError: Could not find policy for agent: agent policy id `<SumoMultiEnv.SUMOAgent object at 0x7fe32e53d1f0>` not in policy map keys dict_keys

why the policy_id here is the Agent object in my environment? how can i replace it with the name in my agent_init? i’m confused about this, hoping guys to answer to me.

(pid=531688) Loading configuration ... done.
(pid=531688) Exception in thread Thread-1:
(pid=531688) Traceback (most recent call last):
(pid=531688)   File "/home/cy/anaconda3/envs/rl/lib/python3.8/threading.py", line 932, in _bootstrap_inner
(pid=531688)     self.run()
(pid=531688)   File "/home/cy/anaconda3/envs/rl/lib/python3.8/site-packages/ray/rllib/evaluation/sampler.py", line 376, in run
(pid=531688)     raise e
(pid=531688)   File "/home/cy/anaconda3/envs/rl/lib/python3.8/site-packages/ray/rllib/evaluation/sampler.py", line 373, in run
(pid=531688)     self._run()
(pid=531688)   File "/home/cy/anaconda3/envs/rl/lib/python3.8/site-packages/ray/rllib/evaluation/sampler.py", line 398, in _run
(pid=531688)     item = next(rollout_provider)
(pid=531688)   File "/home/cy/anaconda3/envs/rl/lib/python3.8/site-packages/ray/rllib/evaluation/sampler.py", line 599, in _env_runner
(pid=531688)     _process_observations(
(pid=531688)   File "/home/cy/anaconda3/envs/rl/lib/python3.8/site-packages/ray/rllib/evaluation/sampler.py", line 810, in _process_observations
(pid=531688)     prep_obs: EnvObsType = _get_or_raise(preprocessors,
(pid=531688)   File "/home/cy/anaconda3/envs/rl/lib/python3.8/site-packages/ray/rllib/evaluation/sampler.py", line 1159, in _get_or_raise
(pid=531688)     raise ValueError(
(pid=531688) ValueError: Could not find policy for agent: agent policy id `<SumoMultiEnv.SUMOAgent object at 0x7fe32e53d1f0>` not in policy map keys dict_keys(['agent_0', 'agent_1', 'agent_10', 'agent_11', 'agent_12', 'agent_13', 'agent_14', 'agent_15', 'agent_16', 'agent_17', 'agent_18', 'agent_19', 'agent_2', 'agent_20', 'agent_21', 'agent_22', 'agent_23', 'agent_24', 'agent_3', 'agent_4', 'agent_5', 'agent_6', 'agent_7', 'agent_8', 'agent_9']).

Hi @albertcruze,

Welcome to the forum. Have a look at the policy_mapping_fn in this link:

https://docs.ray.io/en/master/rllib-env.html#multi-agent-and-hierarchical