Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override unused state collection #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CybORG/Shared/BlueRewardMachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ def get_phase_rewards(self, cur_mission_phase):

return phase_rewards[cur_mission_phase]

def calculate_simulation_reward(self, env_controller):
# Current state is not used by the calculate_reward function
current_state = {}
action = env_controller.action
agent_observations = env_controller.observation
done = env_controller.done
return self.calculate_reward(current_state, action, agent_observations, done, env_controller.state)

def calculate_reward(self, current_state: dict, action_dict: dict, agent_observations: dict, done: bool, state: State):
"""Calculate the cumulative reward based on the phase mapping.
Expand Down
3 changes: 3 additions & 0 deletions CybORG/Shared/RewardCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,8 @@ def reset(self):


class EmptyRewardCalculator(RewardCalculator):
def calculate_simulation_reward(self, env_controller):
return self.calculate_reward(None, None, None, None, None)

def calculate_reward(self, current_state: dict, action: Action, agent_observations: dict, done: bool, state: object):
return 0.