smarts.env.utils.action_conversion module
- class smarts.env.utils.action_conversion.ActionOptions(value)[source]
Defines the options for how the formatting matches the action space.
- default = 0
Defaults to
multi_agent
.
- full = 1
Action must map to full action space. Inactive and active agents are included.
- multi_agent = 0
Action must map to partial action space. Only active agents are included.
- unformatted = 2
Actions are not reformatted or constrained to action space. Actions must directly map to underlying SMARTS actions.
- class smarts.env.utils.action_conversion.ActionSpacesFormatter(agent_interfaces: Dict[str, AgentInterface], action_options: ActionOptions)[source]
Formats actions to adapt SMARTS to gym environment requirements.
- Parameters:
agent_interfaces (Dict[str, AgentInterface]) – The agent interfaces needed to determine the shape of the actions.
action_options (ActionOptions) – Options to configure the end formatting of the actions.
- format(actions: Dict[str, Any])[source]
Format the action to a form that SMARTS can use.
- Parameters:
actions (Dict[str, Any]) – The actions to format.
- Returns:
The formatted actions.
- Return type:
(Observation, Dict[str, Any])
- property space: gymnasium.spaces.Dict
The action space given the current configuration.
- Returns:
A description of the action space that this formatter requires.
- Return type:
gym.spaces.Dict
- static supported(action_type: ActionSpaceType)[source]
Test if the action is in the supported int
- Parameters:
action_type (ActionSpaceType) – The action type to check.
- Returns:
If the action type is supported by the formatter.
- Return type:
bool
- class smarts.env.utils.action_conversion.FormattingGroup(space: gymnasium.Space, formatting_func: ~typing.Callable[[~typing.Any], ~typing.Any] = <function _DEFAULT_PASSTHROUGH>)[source]
Describes the conversion necessary to generate the given space.
- formatting_func()
- space: gymnasium.Space
- smarts.env.utils.action_conversion.get_formatters() Dict[ActionSpaceType, FormattingGroup] [source]
Get the currently available formatting groups for converting actions from gym space standard to SMARTS accepted observations.
- Returns:
The currently available formatting groups.
- Return type:
Dict[ActionSpaceType, Any]