Skip to content

Commit abf17fb

Browse files
simonsays1980abrarsheikh
authored andcommitted
[RLlib] Add 'single_action_space' and 'single_observation_space' to 'VectorMultiAgentEnv`. (#51096)
Signed-off-by: Abrar Sheikh <abrar@anyscale.com>
1 parent 62fe33d commit abf17fb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

rllib/env/vector/sync_vector_multi_agent_env.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ def __init__(
3737
self.single_action_spaces = self.envs[0].unwrapped.action_spaces or dict(
3838
self.envs[0].unwrapped.action_space
3939
)
40+
self.single_action_space = gym.spaces.Dict(self.single_action_spaces)
4041
self.single_observation_spaces = self.envs[
4142
0
4243
].unwrapped.observation_spaces or dict(self.envs[0].unwrapped.observation_space)
43-
44+
self.single_observation_space = gym.spaces.Dict(self.single_observation_spaces)
4445
# TODO (simon): Decide if we want to include a spaces check here.
4546

4647
# Note, if `single_observation_spaces` are not defined, this will

rllib/env/vector/vector_multi_agent_env.py

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ class VectorMultiAgentEnv:
2525
# single on that holds for all sub-envs.
2626
single_observation_spaces: Optional[Dict[str, gym.Space]] = None
2727
single_action_spaces: Optional[Dict[str, gym.Space]] = None
28+
# Note, the proper `gym` spaces are needed for the connector pipeline.
29+
single_observation_space: Optional[gym.spaces.Dict] = None
30+
single_action_space: Optional[gym.spaces.Dict] = None
2831

2932
num_envs: int
3033

0 commit comments

Comments
 (0)