Skip to content

Instantly share code, notes, and snippets.

@pyliaorachel
Created June 15, 2018 05:07
Show Gist options
  • Save pyliaorachel/6e992d18ecb3be249920ac709af1c6b1 to your computer and use it in GitHub Desktop.
Save pyliaorachel/6e992d18ecb3be249920ac709af1c6b1 to your computer and use it in GitHub Desktop.
OpenAI Gym CartPole - Deep Q-Learning (dqn store transition)
def store_transition(self, state, action, reward, next_state):
# 打包 experience
transition = np.hstack((state, [action, reward], next_state))
# 存進 memory;舊 memory 可能會被覆蓋
index = self.memory_counter % self.memory_capacity
self.memory[index, :] = transition
self.memory_counter += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment