Commit 60bb9f39 authored by Eduard Pizur's avatar Eduard Pizur
Browse files

fixed deque

parent 91bebd22
......@@ -7,8 +7,8 @@ DISCOUNT_FACTOR = 0.99
EPSILON_START = 1
EPSILON_DECREMENT = 0.00001
EPSILON_MINIMUM = 0.05
NUM_OF_EPISODES = 1_000
TARGET_NET_UPDATE = 2_000
NUM_OF_EPISODES = 600
TARGET_NET_UPDATE = 1_000
BATCH_SIZE = 32
REPLAY_MEMORY_SIZE = 10_000
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
\ No newline at end of file
DEVICE = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
\ No newline at end of file
......@@ -10,7 +10,6 @@ class ReplayMemory:
def __init__(self):
self.size = REPLAY_MEMORY_SIZE
self.batch_size = BATCH_SIZE
self.index = 0
self.memory = deque(maxlen=self.size)
......@@ -21,13 +20,7 @@ class ReplayMemory:
'''
appends experience to the memory
'''
if len(self.memory) < self.size:
self.memory.append(experience)
return
self.memory[self.index] = experience
self.memory.insert(self.index, experience)
self.index = (self.index + 1) % self.size
self.memory.append(experience)
def sample(self):
'''
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment