diff --git a/examples/flatland_2_0_example.py b/examples/flatland_2_0_example.py index d6e9545d2fd8ca3cbde95e9bd5390dba10a08edb..cf8f635db8c91cb7cf6578a9ade5b2ad14c4874b 100644 --- a/examples/flatland_2_0_example.py +++ b/examples/flatland_2_0_example.py @@ -28,16 +28,16 @@ speed_ration_map = {1.: 0.25, # Fast passenger train 1. / 3.: 0.25, # Slow commuter train 1. / 4.: 0.25} # Slow freight train -env = RailEnv(width=50, - height=50, - rail_generator=sparse_rail_generator(num_cities=10, # Number of cities in map (where train stations are) - seed=10, # Random seed +env = RailEnv(width=75, + height=75, + rail_generator=sparse_rail_generator(num_cities=15, # Number of cities in map (where train stations are) + seed=1, # Random seed grid_mode=False, max_inter_city_rails=2, - max_tracks_in_city=4, + max_tracks_in_city=8, ), schedule_generator=sparse_schedule_generator(speed_ration_map), - number_of_agents=50, + number_of_agents=200, stochastic_data=stochastic_data, # Malfunction data generator obs_builder_object=GlobalObsForRailEnv(), remove_agents_at_target=True diff --git a/flatland/envs/schedule_generators.py b/flatland/envs/schedule_generators.py index b4d60713d0d4481f0e625e97bc9869b2d1927679..c7be5f575d2c9de7c56cbeceb46208a93ba6af04 100644 --- a/flatland/envs/schedule_generators.py +++ b/flatland/envs/schedule_generators.py @@ -80,7 +80,7 @@ def sparse_schedule_generator(speed_ratio_map: Mapping[float, float] = None) -> while start[1] % 2 != 0: start = random.choice(train_stations[start_city]) while target[1] % 2 != 1: - target = random.choice(train_stations[start_city]) + target = random.choice(train_stations[target_city]) agent_orientation = (agent_start_targets_nodes[agent_idx][2] + 2 * start[1]) % 4 if not rail.check_path_exists(start[0], agent_orientation, target[0]):