ochre_gym.spaces.act_spaces
get_action_space_from_ochre
ochre_gym.spaces.act_spaces.get_action_space_from_ochre(equipment_by_end_use: Dict, user_config: Dict, vectorize_actions: bool) -> Tuple[Union[spaces.Dict, spaces.Box], OrderedDict]
Obtain the action space for an OCHRE dwelling simulation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
equipment_by_end_use |
Dict
|
A dictionary of equipment by end use for the OCHRE Dwelling |
required |
user_config |
Dict
|
A dictionary specifying which control types to use for each device in a Dwelling |
required |
vectorize_actions |
bool
|
Whether to vectorize the actions |
required |
Returns:
Name | Type | Description |
---|---|---|
action_space |
Union[spaces.Dict, spaces.Box]
|
The action space for an OCHRE Dwelling. |
action_keys |
OrderedDict
|
The keys of the action dict, keys are equipment category and values are control types. |
vector_action_to_ochre_control
ochre_gym.spaces.act_spaces.vector_action_to_ochre_control(action: np.ndarray, action_keys: OrderedDict) -> OrderedDict
Unflatten a numpy array into a dict of actions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action |
np.ndarray
|
The flattened action array. |
required |
action_keys |
OrderedDict
|
The keys of the action dict. |
required |
Returns:
Name | Type | Description |
---|---|---|
action_dict |
OrderedDict
|
The action dict. |
ClipActionComposite
ochre_gym.spaces.act_spaces.ClipActionComposite
Bases: gym.ActionWrapper
, gym.utils.RecordConstructorArgs
Clip the spaces.Box action spaces of a composite action space to their bounds.
__init__(env: gym.Env)
A wrapper for clipping continuous actions in a composite action space.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env |
Env
|
The environment to wrap. |
required |
action(action_: Dict) -> Dict
Recursively clip the flattened, continuous actions in a composite action space.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action_ |
Dict
|
The action to clip. |
required |
Returns:
Name | Type | Description |
---|---|---|
action_ |
Dict
|
The clipped composite action. |