Created
June 15, 2018 05:07
-
-
Save pyliaorachel/6e992d18ecb3be249920ac709af1c6b1 to your computer and use it in GitHub Desktop.
OpenAI Gym CartPole - Deep Q-Learning (dqn store transition)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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