2023-03-28 17:33:34 +01:00
|
|
|
# Crown Copyright (C) Dstl 2022. DEFCON 703. Shared in confidence.
|
2023-05-25 11:42:19 +01:00
|
|
|
"""The Transaction class."""
|
|
|
|
|
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
class Transaction(object):
|
2023-05-25 11:42:19 +01:00
|
|
|
"""Transaction class."""
|
|
|
|
|
|
2023-03-28 17:33:34 +01:00
|
|
|
def __init__(self, _timestamp, _agent_identifier, _episode_number, _step_number):
|
|
|
|
|
"""
|
2023-05-25 11:42:19 +01:00
|
|
|
Init.
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
_timestamp: The time this object was created
|
|
|
|
|
_agent_identifier: An identifier for the agent in use
|
|
|
|
|
_episode_number: The episode number
|
2023-05-25 11:42:19 +01:00
|
|
|
_step_number: The step number
|
2023-03-28 17:33:34 +01:00
|
|
|
"""
|
|
|
|
|
self.timestamp = _timestamp
|
|
|
|
|
self.agent_identifier = _agent_identifier
|
|
|
|
|
self.episode_number = _episode_number
|
2023-05-25 11:42:19 +01:00
|
|
|
self.step_number = _step_number
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
def set_obs_space_pre(self, _obs_space_pre):
|
|
|
|
|
"""
|
2023-05-25 11:42:19 +01:00
|
|
|
Sets the observation space (pre).
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
_obs_space_pre: The observation space before any actions are taken
|
|
|
|
|
"""
|
|
|
|
|
self.obs_space_pre = _obs_space_pre
|
|
|
|
|
|
|
|
|
|
def set_obs_space_post(self, _obs_space_post):
|
|
|
|
|
"""
|
2023-05-25 11:42:19 +01:00
|
|
|
Sets the observation space (post).
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
_obs_space_post: The observation space after any actions are taken
|
|
|
|
|
"""
|
|
|
|
|
self.obs_space_post = _obs_space_post
|
|
|
|
|
|
|
|
|
|
def set_reward(self, _reward):
|
|
|
|
|
"""
|
2023-05-25 11:42:19 +01:00
|
|
|
Sets the reward.
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
_reward: The reward value
|
|
|
|
|
"""
|
|
|
|
|
self.reward = _reward
|
|
|
|
|
|
|
|
|
|
def set_action_space(self, _action_space):
|
|
|
|
|
"""
|
2023-05-25 11:42:19 +01:00
|
|
|
Sets the action space.
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
_action_space: The action space invoked by the agent
|
|
|
|
|
"""
|
|
|
|
|
self.action_space = _action_space
|