def _create_pedestrians(self): desired_velocities = [] for a in setup.generate_pedestrians(self.parameters, self.parameters['start_areas'], self.parameters['initial_count']): desired_velocities.append(a['initial_desired_velocity']) optimised.add_pedestrian(a) self.average_desired_velocity = np.average(desired_velocities)
def _spawn(self): spawn_rate = self.parameters['continuous_rate'] self.spawn_count += self.timestep * spawn_rate spawn = 0 while self.spawn_count > 1.0: spawn += 1 self.spawn_count -= 1.0 if spawn > 0: for a in setup.generate_pedestrians(self.parameters, self.parameters['continuous_start'], spawn): optimised.add_pedestrian(a)