function mapper (key, value)
initialize the positions of all particles
evaluate the function values of positions then select thebest andbest
// update the particle
while the termination condition is not met
    calculate thebest and
    for each particle
      update thebest andbest
      for each dimension
        update position
    calculation + 1
emit a message (ID of best, string of best and fitness)
Algorithm 2: MRQPSO map.