diff --git a/examples/flatland_2_0_example.py b/examples/flatland_2_0_example.py index 1d3c5191d6984428bbbeaf0840926576f69549f4..c14600b392a2f52e913ca3963fa3114836e0809c 100644 --- a/examples/flatland_2_0_example.py +++ b/examples/flatland_2_0_example.py @@ -37,7 +37,7 @@ env = RailEnv(width=50, max_tracks_in_city=4, ), schedule_generator=sparse_schedule_generator(), - number_of_agents=10, + number_of_agents=100, 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 0a4e7e3b56b89eac520b4f923e2451e307fc3dbd..bb29e07e0e09bed3cd5fd722368e90257391375c 100644 --- a/flatland/envs/schedule_generators.py +++ b/flatland/envs/schedule_generators.py @@ -82,7 +82,8 @@ def sparse_schedule_generator(speed_ratio_map: Mapping[float, float] = None) -> 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]): agent_orientation = (agent_orientation + 2) % 4 - print(rail.check_path_exists(start[0], agent_orientation, target[0])) + if not (rail.check_path_exists(start[0], agent_orientation, target[0])): + print("Infeasible") agents_position.append((start[0][0], start[0][1])) agents_target.append((target[0][0], target[0][1]))