Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. def step(self, state, action, reward, next_state, done):
  2. """Save experience in replay memory, and use random sample from buffer to learn."""
  3. # Save experience / reward
  4. self.memory.add(state, action, reward, next_state, done)
  5.  
  6. # Learn, if enough samples are available in memory
  7. if len(self.memory) > BATCH_SIZE:
  8. experiences = self.memory.sample()
  9. self.learn(experiences, GAMMA)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement