code: def updateParticle(part, best, phi1, phi2):
      u1 = (random.uniform(0, phi1) for _ in range(len(part)))
      u2 = (random.uniform(0, phi2) for _ in range(len(part)))
      v_u1 = map(operator.mul, u1, map(operator.sub, part.best, part))
      v_u2 = map(operator.mul, u2, map(operator.sub, best, part))
      part.speed = list(
          map(operator.add, part.speed, map(operator.add, v_u1, v_u2))
      )
      for i, speed in enumerate(part.speed):
          if abs(speed) < part.smin:
              part.speed[i] = math.copysign(part.smin, speed)
          elif abs(speed) > part.smax:
              part.speed[i] = math.copysign(part.smax, speed)
      part[:] = list(map(operator.add, part, part.speed))
  
file_path: deap/examples/pso/basic.py
imports: import operator
  import random
  import numpy
  import math
  from deap import base
  from deap import benchmarks
  from deap import creator
  from deap import tools
label_desc: Use image node_id 2 for calling a global function with example usage: updateParticle(part, best, phi1, phi2) without return types