Skip to content

Commit

Permalink
"corrected bug with shared experience"
Browse files Browse the repository at this point in the history
  • Loading branch information
ferielamira1 committed May 13, 2024
1 parent 073662d commit bf8abf2
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,22 @@ def start_madqn(self):
# Add the experience to the replay memory and train the agent
for ag in self.agents:
if self.train:
for ag2 in self.agents:


if done == True:
ag.policy_network.replay_memory.push(
ag2.policy_network.state_tensor,
ag2.policy_network.action_tensor,
ag2.policy_network.next_state_tensor,
ag2.policy_network.reward_tensor
ag.policy_network.state_tensor,
ag.policy_network.action_tensor,
ag.policy_network.next_state_tensor,
ag.policy_network.reward_tensor
)
else:
for ag2 in self.agents:

ag.policy_network.replay_memory.push(
ag2.policy_network.state_tensor,
ag2.policy_network.action_tensor,
ag2.policy_network.next_state_tensor,
ag2.policy_network.reward_tensor
)
# if self.train and self.t % self.train_every == 0:
loss = ag.policy_network.optimize()

Expand Down

0 comments on commit bf8abf2

Please sign in to comment.