Skip to content
Snippets Groups Projects
Commit 1c0be02d authored by Erik Nygren's avatar Erik Nygren
Browse files

simple sequential agent

parent 82152051
No related branches found
No related tags found
No related merge requests found
...@@ -18,9 +18,9 @@ y_dim = env.height ...@@ -18,9 +18,9 @@ y_dim = env.height
""" """
x_dim = 10 # np.random.randint(8, 20) x_dim = 20 # np.random.randint(8, 20)
y_dim = 10 # np.random.randint(8, 20) y_dim = 20 # np.random.randint(8, 20)
n_agents = 5 # np.random.randint(3, 8) n_agents = 10 # np.random.randint(3, 8)
n_goals = n_agents + np.random.randint(0, 3) n_goals = n_agents + np.random.randint(0, 3)
min_dist = int(0.75 * min(x_dim, y_dim)) min_dist = int(0.75 * min(x_dim, y_dim))
...@@ -63,10 +63,10 @@ for trials in range(1, n_trials + 1): ...@@ -63,10 +63,10 @@ for trials in range(1, n_trials + 1):
for a in range(env.get_num_agents()): for a in range(env.get_num_agents()):
if done[a]: if done[a]:
acting_agent += 1 acting_agent += 1
if acting_agent == a: if a == acting_agent:
action = agent.act(obs[acting_agent], eps=0) action = agent.act(obs[a], eps=0)
else: else:
action = 0 action = 4
action_dict.update({a: action}) action_dict.update({a: action})
# Environment step # Environment step
......
...@@ -93,7 +93,7 @@ def main(argv): ...@@ -93,7 +93,7 @@ def main(argv):
# Here you can pre-load an agent # Here you can pre-load an agent
if True: if True:
with path(torch_training.Nets, "avoid_checkpoint53700.pth") as file_in: with path(torch_training.Nets, "avoid_checkpoint2400.pth") as file_in:
agent.qnetwork_local.load_state_dict(torch.load(file_in)) agent.qnetwork_local.load_state_dict(torch.load(file_in))
# Do training over n_episodes # Do training over n_episodes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment