Skip to content

Commit

Permalink
get rid of unnecessary variables
Browse files Browse the repository at this point in the history
  • Loading branch information
philtabor committed Nov 3, 2020
1 parent 278a21a commit ba997f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
from networks import ActorNetwork, CriticNetwork

class Agent:
def __init__(self, alpha=0.001, beta=0.002, input_dims=[8], env=None,
def __init__(self, input_dims, alpha=0.001, beta=0.002, env=None,
gamma=0.99, n_actions=2, max_size=1000000, tau=0.005,
fc1=512, fc2=512, batch_size=64):
fc1=400, fc2=300, batch_size=64, noise=0.1):
self.gamma = gamma
self.tau = tau
self.memory = ReplayBuffer(max_size, input_dims, n_actions)
self.batch_size = batch_size
self.n_actions = n_actions
self.noise = noise
self.max_action = env.action_space.high[0]
self.min_action = env.action_space.low[0]

Expand Down Expand Up @@ -67,7 +68,7 @@ def choose_action(self, observation, evaluate=False):
actions = self.actor(state)
if not evaluate:
actions += tf.random.normal(shape=[self.n_actions],
mean=0.0, stddev=0.1)
mean=0.0, stddev=self.noise)
# note that if the environment has an action > 1, we have to multiply by
# max action at some point
actions = tf.clip_by_value(actions, self.min_action, self.max_action)
Expand Down Expand Up @@ -110,7 +111,3 @@ def learn(self):
actor_network_gradient, self.actor.trainable_variables))

self.update_network_parameters()




Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
from tensorflow.keras.layers import Dense

class CriticNetwork(keras.Model):
def __init__(self, n_actions, fc1_dims=512, fc2_dims=512,
def __init__(self, fc1_dims=512, fc2_dims=512,
name='critic', chkpt_dir='tmp/ddpg'):
super(CriticNetwork, self).__init__()
self.fc1_dims = fc1_dims
self.fc2_dims = fc2_dims
self.n_actions = n_actions

self.model_name = name
self.checkpoint_dir = chkpt_dir
Expand Down

0 comments on commit ba997f7

Please sign in to comment.