Remove redundant TODOs

This commit is contained in:
Marek Wolan
2024-03-13 09:17:29 +00:00
parent 045f467407
commit 6dedb91099
2 changed files with 6 additions and 20 deletions

View File

@@ -141,8 +141,6 @@ class AbstractAgent(ABC):
:param obs: Observation of the environment. :param obs: Observation of the environment.
:type obs: ObsType :type obs: ObsType
:param reward: Reward from the previous action, defaults to None TODO: should this parameter even be accepted?
:type reward: float, optional
:param timestep: The current timestep in the simulation, used for non-RL agents. Optional :param timestep: The current timestep in the simulation, used for non-RL agents. Optional
:type timestep: int :type timestep: int
:return: Action to be taken in the environment. :return: Action to be taken in the environment.

View File

@@ -43,9 +43,7 @@ class AbstractReward:
"""Base class for reward function components.""" """Base class for reward function components."""
@abstractmethod @abstractmethod
def calculate( def calculate(self, state: Dict, last_action_response: "AgentActionHistoryItem") -> float:
self, state: Dict, last_action_response: "AgentActionHistoryItem"
) -> float: # todo maybe make last_action_response optional?
"""Calculate the reward for the current state.""" """Calculate the reward for the current state."""
return 0.0 return 0.0
@@ -65,9 +63,7 @@ class AbstractReward:
class DummyReward(AbstractReward): class DummyReward(AbstractReward):
"""Dummy reward function component which always returns 0.""" """Dummy reward function component which always returns 0."""
def calculate( def calculate(self, state: Dict, last_action_response: "AgentActionHistoryItem") -> float:
self, state: Dict, last_action_response: "AgentActionHistoryItem"
) -> float: # todo maybe make last_action_response optional?
"""Calculate the reward for the current state.""" """Calculate the reward for the current state."""
return 0.0 return 0.0
@@ -107,9 +103,7 @@ class DatabaseFileIntegrity(AbstractReward):
file_name, file_name,
] ]
def calculate( def calculate(self, state: Dict, last_action_response: "AgentActionHistoryItem") -> float:
self, state: Dict, last_action_response: "AgentActionHistoryItem"
) -> float: # todo maybe make last_action_response optional?
"""Calculate the reward for the current state. """Calculate the reward for the current state.
:param state: The current state of the simulation. :param state: The current state of the simulation.
@@ -164,9 +158,7 @@ class WebServer404Penalty(AbstractReward):
""" """
self.location_in_state = ["network", "nodes", node_hostname, "services", service_name] self.location_in_state = ["network", "nodes", node_hostname, "services", service_name]
def calculate( def calculate(self, state: Dict, last_action_response: "AgentActionHistoryItem") -> float:
self, state: Dict, last_action_response: "AgentActionHistoryItem"
) -> float: # todo maybe make last_action_response optional?
"""Calculate the reward for the current state. """Calculate the reward for the current state.
:param state: The current state of the simulation. :param state: The current state of the simulation.
@@ -220,9 +212,7 @@ class WebpageUnavailablePenalty(AbstractReward):
self.location_in_state: List[str] = ["network", "nodes", node_hostname, "applications", "WebBrowser"] self.location_in_state: List[str] = ["network", "nodes", node_hostname, "applications", "WebBrowser"]
self._last_request_failed: bool = False self._last_request_failed: bool = False
def calculate( def calculate(self, state: Dict, last_action_response: "AgentActionHistoryItem") -> float:
self, state: Dict, last_action_response: "AgentActionHistoryItem"
) -> float: # todo maybe make last_action_response optional?
""" """
Calculate the reward based on current simulation state, and the recent agent action. Calculate the reward based on current simulation state, and the recent agent action.
@@ -397,9 +387,7 @@ class RewardFunction:
""" """
self.reward_components.append((component, weight)) self.reward_components.append((component, weight))
def update( def update(self, state: Dict, last_action_response: "AgentActionHistoryItem") -> float:
self, state: Dict, last_action_response: "AgentActionHistoryItem"
) -> float: # todo maybe make last_action_response optional?
"""Calculate the overall reward for the current state. """Calculate the overall reward for the current state.
:param state: The current state of the simulation. :param state: The current state of the simulation.