Bug: sparse_rail_generator might not generate an agent/target pair : Results in number of agents == 0.
The sparse_rail_generator might not find a spot to place an agent nor a target. Thus the env doesn't have any agents. This can cause a major issue in training, ... .
[https://discourse.aicrowd.com/t/baseline-num-trainstations-question/1883]
see also: #169 (closed)
First code review:
---------------- 1 -----------------------
while (station_x, station_y) in train_stations
or (station_x, station_y) == node_positions[trainstation_node]
or rail_array[(station_x, station_y)] != 0: # noqa: E125
(station_x, station_y) in train_stations ==> FALSE? What must be checked? (station_x, station_y) in train_stations[ for all lists ] or (station_x, station_y) in train_stations[trainstation_node] ?? -> first mean only once x,y can appear in global scene, or x,y can only appear once for one trainstation_node [num_trainstations] / city? For me not clear.
---------------- 2 -----------------------
if found_agent_pair:
node_available_start[start_node] -= 1
node_available_target[target_node] -= 1
agent_start_targets_nodes.append((start_node, target_node))
else:
num_agents -= 1
if num_agents <= 1 --> ISSUE -> Bug?