def createSwarm(self): print("Creating swarm..") for i in range(self.nb_particles): p = Particle(i + 1, self.run_id, self.rng, self.simulation, self.phi_1, self.phi_2, self.inertia) print( f"{self.run_id} Particle {i+1} evaluation: {p.getPbestEvaluation()}" ) self.swarm.append(p) if (self.global_best_sol.getEval() > p.getPbestEvaluation()): self.updateGlobalBest(p.getPbestPosition(), p.getPbestEvaluation()) self.best_particle = p self.createGbestTopology() print( self.run_id, " Best initial solution quality: {}".format( self.global_best_sol.getEval()))