SplitActionsWrapper¶
- class maze.core.wrappers.split_actions_wrapper.SplitActionsWrapper(env: StructuredEnvSpacesMixin | StructuredEnv, split_config: Dict[str, Dict[str, Dict[str, Tuple | List]]])¶
Splits an actions into separate ones.
An example is given by the LunarLanderContinuous-v3 env. Here we have a box action spaces with shape (2,) such that dimension 0 is the up/down action and dimension 1 is the left/right action. Now if we would like to split this action correspondingly we can wrap the env with the following config:
- split_config:
- action:
- action_up:
indices: [0]
- action_side:
indices: [1]
Now the actions as well as the action space is consists of two actions (action_up/action_side).
- Parameters:
env – Environment/wrapper to wrap.
split_config – The action splitting configuration.
- action(action: Dict[str, numpy.ndarray]) Dict[str, numpy.ndarray]¶
(overrides
ActionWrapper)Implementation of
ActionWrapperinterface.
- property action_space: gymnasium.spaces.Dict¶
(overrides
StructuredEnvSpacesMixin)The currently active gym action space.
- property action_spaces_dict: Dict[int | str, gymnasium.spaces.Dict]¶
(overrides
StructuredEnvSpacesMixin)A dictionary of gym action spaces, with policy IDs as keys.
- clone_from(env: SplitActionsWrapper) None¶
(overrides
SimulatedEnvMixin)implementation of
SimulatedEnvMixin.
- reverse_action(action: Dict[str, numpy.ndarray]) Dict[str, numpy.ndarray]¶
(overrides
ActionWrapper)Implementation of
ActionWrapperinterface.