Skip to content
Snippets Groups Projects
Commit 539b86c7 authored by Armin Co's avatar Armin Co
Browse files

Prevent conf.name to be : None

parent 89853126
No related branches found
No related tags found
No related merge requests found
...@@ -75,7 +75,7 @@ class DQAgent(QAgent): ...@@ -75,7 +75,7 @@ class DQAgent(QAgent):
def __init__(self, conf): def __init__(self, conf):
super().__init__(conf) super().__init__(conf)
self.q2 = QNet(conf) self.q2 = QNet(conf)
self.name = 'D_' + self.name self.name = 'D_' + str(self.name)
def get_action(self, state): def get_action(self, state):
if np.random.rand() <= self.epsilon: if np.random.rand() <= self.epsilon:
......
...@@ -31,7 +31,7 @@ class Config: ...@@ -31,7 +31,7 @@ class Config:
def conf_to_name(self): def conf_to_name(self):
self.name = self.env_type + '_' + self.name self.name = str(self.env_type) + '_' + str(self.name)
for layer in self.net_layout: for layer in self.net_layout:
self.name += '_' + str(layer) + '_' self.name += '_' + str(layer) + '_'
self.name += str(self.eps_decay) + '_' self.name += str(self.eps_decay) + '_'
...@@ -102,7 +102,7 @@ def learn_offline(agent, conf): ...@@ -102,7 +102,7 @@ def learn_offline(agent, conf):
def run(environment, agent, episodes, render=True, learn=True, conf=None): def run(environment, agent, episodes, render=True, learn=True, conf=None):
""" Run an agent """ """ Run an agent """
conf.name += 'on' conf.name = str(conf.name) + 'on'
# Set the exploring rate to its minimum. # Set the exploring rate to its minimum.
# (epsilon *greedy*) # (epsilon *greedy*)
if not learn: if not learn:
......
...@@ -123,8 +123,8 @@ configuration = c ...@@ -123,8 +123,8 @@ configuration = c
# configuration = lun # configuration = lun
# configuration = ThisHasToBeTooBig # configuration = ThisHasToBeTooBig
print(configuration.name) configuration.conf_to_name()
configuration.agent = DQAgent(configuration) configuration.agent = QAgent(configuration)
main.run(configuration) main.run(configuration)
# configurations = [smallNet, smallNetDeep, normalNet, normalSlowDecay, normalSlowLearn, largeNet, deepNet, verryLittleNet, littleNet, verryLittleNetDeep, smallNetDeepSlowLearn, deepNetSlowLearn] # configurations = [smallNet, smallNetDeep, normalNet, normalSlowDecay, normalSlowLearn, largeNet, deepNet, verryLittleNet, littleNet, verryLittleNetDeep, smallNetDeepSlowLearn, deepNetSlowLearn]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment