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

updated the way connected directions are chosen.

parent 38f73b69
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,7 @@ env = RailEnv(width=50, ...@@ -39,7 +39,7 @@ env = RailEnv(width=50,
seed=15, # Random seed seed=15, # Random seed
grid_mode=False, grid_mode=False,
max_connection_points_per_side=2, max_connection_points_per_side=2,
max_nr_connection_directions=4, max_nr_connection_directions=2,
), ),
schedule_generator=sparse_schedule_generator(), schedule_generator=sparse_schedule_generator(),
number_of_agents=50, number_of_agents=50,
......
...@@ -701,13 +701,11 @@ def sparse_rail_generator(num_cities=5, num_trainstations=2, min_node_dist=20, n ...@@ -701,13 +701,11 @@ def sparse_rail_generator(num_cities=5, num_trainstations=2, min_node_dist=20, n
# TODO: Change the way this code works! Check that we get sufficient direction. # TODO: Change the way this code works! Check that we get sufficient direction.
# TODO: Check if this works as expected # TODO: Check if this works as expected
while len(connection_sides_idx) < max_nr_connection_directions and idx < len(neighb_dist): while len(connection_sides_idx) < max_nr_connection_directions and idx < len(neighb_dist):
if closest_direction(node_position, current_closest_direction = closest_direction(node_position, node_positions[closest_neighb_idx[idx]])
node_positions[closest_neighb_idx[idx]]) not in connection_sides_idx: if current_closest_direction not in connection_sides_idx:
connection_sides_idx.append( connection_sides_idx.append(current_closest_direction)
closest_direction(node_position, node_positions[closest_neighb_idx[idx]])) idx += 1
idx += 1
else:
idx += 1
# set the number of connection points for each direction # set the number of connection points for each direction
connections_per_direction = np.zeros(4, dtype=int) connections_per_direction = np.zeros(4, dtype=int)
......
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