Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark2000 committed Dec 26, 2024
1 parent b122bcc commit 394000a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/bsk_rl/data/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def update_with_communicated_data(self) -> None:
class ComposedReward(GlobalReward):
datastore_type = ComposedDataStore

def pass_data(self) -> Data:
for rewarder, data in zip(self.rewarders, self.data.data):
rewarder.data = data

def __init__(self, *rewarders: GlobalReward) -> None:
"""Construct composed reward.
Expand Down Expand Up @@ -169,3 +173,8 @@ def calculate_reward(
for sat_id, sat_reward in reward_i.items():
reward[sat_id] = reward.get(sat_id, 0.0) + sat_reward
return reward

def reward(self, new_data_dict: dict[str, ComposedData]) -> dict[str, float]:
reward = super().reward(new_data_dict)
self.pass_data()
return reward

0 comments on commit 394000a

Please sign in to comment.