/**
   * Update the speed of each particle
   *
   * @throws JMException
   */
  private void computeSpeed(int iter, int miter) throws JMException, IOException {
    double r1, r2, W, C1, C2;
    double wmax, wmin, deltaMax, deltaMin;
    XReal bestGlobal;

    for (int i = 0; i < swarmSize_; i++) {
      XReal particle = new XReal(particles_.get(i));
      XReal bestParticle = new XReal(best_[i]);

      // Select a global best_ for calculate the speed of particle i, bestGlobal
      Solution one, two;
      int pos1 = PseudoRandom.randInt(0, leaders_.size() - 1);
      int pos2 = PseudoRandom.randInt(0, leaders_.size() - 1);
      one = leaders_.get(pos1);
      two = leaders_.get(pos2);

      if (crowdingDistanceComparator_.compare(one, two) < 1) {
        bestGlobal = new XReal(one);
      } else {
        bestGlobal = new XReal(two);
        // Params for velocity equation
      }
      r1 = PseudoRandom.randDouble(r1Min_, r1Max_);
      r2 = PseudoRandom.randDouble(r2Min_, r2Max_);
      C1 = PseudoRandom.randDouble(C1Min_, C1Max_);
      C2 = PseudoRandom.randDouble(C2Min_, C2Max_);
      W = PseudoRandom.randDouble(WMin_, WMax_);
      //
      wmax = WMax_;
      wmin = WMin_;

      for (int var = 0; var < particle.getNumberOfDecisionVariables(); var++) {
        // Computing the velocity of this particle
        speed_[i][var] =
            velocityConstriction(
                constrictionCoefficient(C1, C2)
                    * (inertiaWeight(iter, miter, wmax, wmin) * speed_[i][var]
                        + C1 * r1 * (bestParticle.getValue(var) - particle.getValue(var))
                        + C2 * r2 * (bestGlobal.getValue(var) - particle.getValue(var))),
                deltaMax_, // [var],
                deltaMin_, // [var],
                var,
                i);
      }
    }
  } // computeSpeed