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

agents randomly facing any outgoing direciton of city

parent afa93e0b
No related branches found
No related tags found
No related merge requests found
...@@ -74,13 +74,14 @@ def sparse_schedule_generator(speed_ratio_map: Mapping[float, float] = None) -> ...@@ -74,13 +74,14 @@ def sparse_schedule_generator(speed_ratio_map: Mapping[float, float] = None) ->
# Set target for agent # Set target for agent
start_city = agent_start_targets_nodes[agent_idx][0] start_city = agent_start_targets_nodes[agent_idx][0]
target_city = agent_start_targets_nodes[agent_idx][0] target_city = agent_start_targets_nodes[agent_idx][0]
agent_orientation = agent_start_targets_nodes[agent_idx][2] agent_orientation = (agent_start_targets_nodes[agent_idx][2] + np.random.choice([0, 2])) % 4
start_city_idx = np.random.randint(len(train_stations[start_city])) start_city_idx = np.random.randint(len(train_stations[start_city]))
start = train_stations[start_city][start_city_idx] start = train_stations[start_city][start_city_idx]
target_station_idx = np.random.randint(len(train_stations[target_city])) target_station_idx = np.random.randint(len(train_stations[target_city]))
target = train_stations[target_city][target_station_idx] target = train_stations[target_city][target_station_idx]
agents_position.append((start[0][0], start[0][1])) agents_position.append((start[0][0], start[0][1]))
agents_target.append((target[0][0], target[0][1])) agents_target.append((target[0][0], target[0][1]))
agents_direction.append(agent_orientation) agents_direction.append(agent_orientation)
# Orient the agent correctly # Orient the agent correctly
......
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