fix dqn zero eps (#52)

Co-authored-by: liyan <liyan1@digisky.com>
This commit is contained in:
magicly 2020-05-21 11:35:41 +08:00 committed by GitHub
parent 57bca16f94
commit 6237cc0d52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,6 +150,7 @@ class DQNPolicy(BasePolicy):
# add eps to act
if eps is None:
eps = self.eps
if not np.isclose(eps, 0):
for i in range(len(q)):
if np.random.rand() < eps:
act[i] = np.random.randint(q.shape[1])