Skip to content
Snippets Groups Projects
Commit 44d3ca9d authored by Erik Nygren's avatar Erik Nygren :bullettrain_front:
Browse files

updated training file

parent 73919673
No related branches found
No related tags found
No related merge requests found
...@@ -146,6 +146,9 @@ for trials in range(1, n_trials + 1): ...@@ -146,6 +146,9 @@ for trials in range(1, n_trials + 1):
distance = norm_obs_clip(distance) distance = norm_obs_clip(distance)
agent_data = np.clip(agent_data, -1, 1) agent_data = np.clip(agent_data, -1, 1)
obs[a] = np.concatenate((np.concatenate((data, distance)), agent_data)) obs[a] = np.concatenate((np.concatenate((data, distance)), agent_data))
agent_data = env.agents[a]
speed = 1 #np.random.randint(1,5)
agent_data.speed_data['speed'] = 1. / speed
for i in range(2): for i in range(2):
time_obs.append(obs) time_obs.append(obs)
...@@ -153,6 +156,7 @@ for trials in range(1, n_trials + 1): ...@@ -153,6 +156,7 @@ for trials in range(1, n_trials + 1):
for a in range(env.get_num_agents()): for a in range(env.get_num_agents()):
agent_obs[a] = np.concatenate((time_obs[0][a], time_obs[1][a])) agent_obs[a] = np.concatenate((time_obs[0][a], time_obs[1][a]))
score = 0 score = 0
env_done = 0 env_done = 0
# Run episode # Run episode
...@@ -167,7 +171,7 @@ for trials in range(1, n_trials + 1): ...@@ -167,7 +171,7 @@ for trials in range(1, n_trials + 1):
if demo: if demo:
eps = 0 eps = 0
# action = agent.act(np.array(obs[a]), eps=eps) # action = agent.act(np.array(obs[a]), eps=eps)
action = 2 #agent.act(agent_obs[a], eps=eps) action = agent.act(agent_obs[a], eps=eps)
action_prob[action] += 1 action_prob[action] += 1
action_dict.update({a: action}) action_dict.update({a: action})
# Environment step # Environment step
......
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