Commit ff354998 authored by u229589's avatar u229589
Browse files

reformulate if and only add target to computed_target whenever target was not computed before

parent 7c337938
Pipeline #2509 passed with stages
in 40 minutes and 8 seconds
......@@ -63,13 +63,13 @@ class DistanceMap:
computed_targets = []
for i, agent in enumerate(agents):
if not agent.target in computed_targets:
if agent.target not in computed_targets:
self._distance_map_walker(rail, agent.target, i)
computed_targets.append(agent.target)
else:
# just copy the distance map form other agent with same target (performance)
self.distance_map[i, :, :, :] = np.copy(
self.distance_map[computed_targets.index(agent.target), :, :, :])
computed_targets.append(agent.target)
def _distance_map_walker(self, rail: GridTransitionMap, position, target_nr: int):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment