Objectives are exponentiated by a positive weight and afterwards
multiplied.

@param solutionsList A list of solutions.
@param weights       Weights by objectives are exponentiated
496755
public static <S extends Solution<?>> void weightedProduct(List<S> solutionsList, double[] weights) {
    for (S solution : solutionsList) {
      double product = Math.pow(solution.getObjective(0), weights[0]);
      for (int i = 1; i < solution.getNumberOfObjectives(); i++) {
        product *= Math.pow(solution.getObjective(i), weights[i]);
      }
      setScalarizationValue(solution, product);
    }
  }
384468
@Override
  public void evaluate(DoubleSolution solution) {
    int numberOfVariables = solution.getNumberOfVariables();
    int numberOfObjectives = solution.getNumberOfObjectives();

    double[] x = new double[numberOfVariables];
    double[] f = new double[numberOfObjectives];

    for (int i = 0; i < numberOfVariables; i++) {
      x[i] = solution.getVariableValue(i);
    }

    // evaluate g,h
    double g = 0, h = 0, sub1;
    for (int i = numberOfObjectives - 1; i < numberOfVariables; i++) {
      g += x[i];
    }
    g = 1 + 9 * g / (numberOfVariables - numberOfObjectives + 1);
    sub1 = 1 + g;
    for (int i = 0; i < numberOfObjectives - 1; i++) {
      h += (x[i] * (1 + Math.sin(3 * Math.PI * x[i])) / sub1);
    }
    h = numberOfObjectives - h;
    // evaluate f1,...,m-1,m
    for (int i = 0; i < numberOfObjectives; i++) {
      f[i] = x[i];
    }
    f[numberOfObjectives - 1] = h * sub1;

    for (int i = 0; i < numberOfObjectives; i++) {
      solution.setObjective(i, f[i]);
    }

  }
139881
public void removeWorst(List<S> solutionSet) {

    // Find the worst;
    double worst = (double) solutionFitness.getAttribute(solutionSet.get(0));
    int worstIndex = 0;
    double kappa = 0.05;

    for (int i = 1; i < solutionSet.size(); i++) {
      if ((double) solutionFitness.getAttribute(solutionSet.get(i)) > worst) {
        worst = (double) solutionFitness.getAttribute(solutionSet.get(i));
        worstIndex = i;
      }
    }

    // Update the population
    for (int i = 0; i < solutionSet.size(); i++) {
      if (i != worstIndex) {
        double fitness = (double) solutionFitness.getAttribute(solutionSet.get(i));
        fitness -= Math.exp((-indicatorValues.get(worstIndex).get(i) / maxIndicatorValue) / kappa);
        solutionFitness.setAttribute(solutionSet.get(i), fitness);
      }
    }

    // remove worst from the indicatorValues list
    indicatorValues.remove(worstIndex);
    for (List<Double> anIndicatorValues_ : indicatorValues) {
      anIndicatorValues_.remove(worstIndex);
    }

    solutionSet.remove(worstIndex);
  }
651386
public static <S extends Solution<?>> void angleUtility(List<S> solutionsList, double[][] extremePoints) {
    for (S solution : solutionsList) {
      double fraction = 0.0;
      for (int i = 0; i < extremePoints.length; i++) {
        double numerator = 0.0;
        double denominator = 0.0;
        for (int j = 0; j < extremePoints.length; j++) {
          if (i == j) {
            denominator = Math.abs(extremePoints[i][j] - solution.getObjective(j));
          } else {
            numerator += Math.pow(extremePoints[i][j] - solution.getObjective(j), 2.0);
          }
        }
        // Avoid numeric instability and division by 0.
        if (denominator > 10e-6) {
          fraction = Math.max(fraction, Math.sqrt(numerator) / denominator);
        } else {
          fraction = Double.MAX_VALUE;
        }
      }
      setScalarizationValue(solution, Math.atan(fraction));
    }
  }
1283321
private static <S extends Solution<?>> double[][] getExtremePoints(List<S> solutionsList) {
    // One extreme point for each objective
    double[][] extremePoints = new double[solutionsList.get(0).getNumberOfObjectives()][];

    for (int i = 0; i < extremePoints.length; i++) {
      S extreme = Collections.min(solutionsList, new AchievementScalarizationComparator<S>(i));
      extremePoints[i] = new double[extreme.getNumberOfObjectives()];
      for (int j = 0; j < extremePoints.length; j++) {
        extremePoints[i][j] = extreme.getObjective(j);
      }
    }

    return extremePoints;
  }
363864
private static <S extends Solution<?>> double[] getNadirValues(List<S> solutionsList) {
    ArrayFront front = new ArrayFront(solutionsList);
    FrontExtremeValues extremeValues = new FrontExtremeValues();
    List<Double> list = extremeValues.findHighestValues(front);
    return toArray(list);
  }
293425
public void add(DoubleArrayList values) {
        ensureCapacity(size + values.size);
        for (int i=0; i<values.size; i++) {
            this.add(values.elements[i]);
        }
    }
1155330
public void evaluate(DoubleSolution solution) {
    float[] variables = new float[getNumberOfVariables()];
    double[] x = new double[getNumberOfVariables()];

    for (int i = 0; i < getNumberOfVariables(); i++) {
      x[i] = solution.getVariableValue(i);
    }

    for (int i = 0; i < getNumberOfVariables(); i++) {
      variables[i] = (float) x[i] ;
    }

    float[] sol2 = evaluate(variables);

    for (int i = 0; i < sol2.length; i++) {
      solution.setObjective(i, sol2[i]);
    }
  }
1094848
public static <S extends Solution<?>> void nash(List<S> solutionsList, double[] nadirValues) {
    for (S solution : solutionsList) {
      double nash = nadirValues[0] - solution.getObjective(0);
      for (int i = 1; i < nadirValues.length; i++) {
        nash *= (nadirValues[i] - solution.getObjective(i));
      }
      // The Nash bargaining solution is originally maximized. To conform
      // with minimization the bargaining value is negated.
      setScalarizationValue(solution, -nash);
    }
  }
1348015
public static <S extends Solution<?>> void tradeoffUtility(List<S> solutionsList) {
    // Reset scalarization values from previous iterations
    for (S solution : solutionsList) {
      setScalarizationValue(solution, 0.0);
    }

    for (int cur = 0; cur < solutionsList.size() - 1; cur++) {
      S current = solutionsList.get(cur);
      for (int oth = cur + 1; oth < solutionsList.size(); oth++) {
        S other = solutionsList.get(oth);
        double numerator = 0.0;
        double denominator = 0.0;
        for (int i = 0; i < current.getNumberOfObjectives(); i++) {
          if (current.getObjective(i) > other.getObjective(i)) {
            numerator = Math.max(numerator, current.getObjective(i) - other.getObjective(i));
          } else if (current.getObjective(i) < other.getObjective(i)) {
            denominator = Math.max(denominator, other.getObjective(i) - current.getObjective(i));
          }
        }
        // Neither solution Pareto dominates the other
        if (numerator != 0.0 && denominator != 0.0) {
          setScalarizationValue(current, Math.max(getScalarizationValue(current), numerator / denominator));
          // Tradeoff utility is symmetric
          setScalarizationValue(other, Math.max(getScalarizationValue(other), denominator / numerator));
        }
      }
    }
  }
429636
public static int ParetoObjectiveCompare(Solution solution1, Solution solution2)
   {
      boolean dominate1 = false;
      boolean dominate2 = false;

      int objective_count = solution1.getCosts().size();
      for (int i = 0; i < objective_count; i++)
      {
         if (solution1.getCost(i) < solution2.getCost(i))
         {
            dominate1 = true; // solution 2 is dominated

            if (dominate2)
            {
               return 0;
            }
         }
         else if (solution1.getCost(i) > solution2.getCost(i))
         {
            dominate2 = true; // solution 1 is dominated

            if (dominate1)
            {
               return 0;
            }
         }
      }

      if (dominate1 == dominate2)
      {
         return 0;
      }
      else if (dominate1)
      {
         return -1;
      }
      else
      {
         return 1;
      }
   }
132192
public LMAlgoFactoryDecorator setWeightingsAsStrings(List<String> weightingList) {
        if (weightingList.isEmpty())
            throw new IllegalArgumentException("It is not allowed to pass an emtpy weightingList");

        weightingsAsStrings.clear();
        for (String strWeighting : weightingList) {
            strWeighting = toLowerCase(strWeighting);
            strWeighting = strWeighting.trim();
            addWeighting(strWeighting);
        }
        return this;
    }
902709
public static <S extends Solution<?>> void angleUtility(List<S> solutionsList) {
    angleUtility(solutionsList, getExtremePoints(solutionsList));
  }
614886
@Override
  public void evaluate(DoubleSolution solution) {

    int numberOfVariables_ = solution.getNumberOfVariables();
    int numberOfObjectives_ = solution.getNumberOfObjectives();

    double[] x = new double[numberOfVariables_];
    double[] f = new double[numberOfObjectives_];

    for (int i = 0; i < numberOfVariables_; i++) {
      x[i] = solution.getVariableValue(i);
    }

    // evaluate J,y,sub1,sub2,sub3,sub4
    double[] y = new double[numberOfVariables_];
    for (int i = 0; i < numberOfVariables_; i++) {
      y[i] =
          x[i] - 2 * x[1] * Math.sin(2 * Math.PI * x[0] + (i + 1) * Math.PI / numberOfVariables_);
    }
    ArrayList<Integer> J1 = new ArrayList<Integer>();
    ArrayList<Integer> J2 = new ArrayList<Integer>();
    ArrayList<Integer> J3 = new ArrayList<Integer>();
    ArrayList<Integer> J4 = new ArrayList<Integer>();
    double sub1 = 0, sub2 = 0, sub3 = 0, sub4 = 0;
    for (int i = 4; i <= numberOfVariables_; i = i + 3) {
      J1.add(i);
      sub1 += Math.pow(y[i - 1], 2);
    }
    sub1 = 2 * sub1 / J1.size();
    for (int i = 5; i <= numberOfVariables_; i = i + 3) {
      J2.add(i);
      sub2 += Math.pow(y[i - 1], 2);
    }
    sub2 = 2 * sub2 / J2.size();
    for (int i = 3; i <= numberOfVariables_; i = i + 3) {
      J3.add(i);
      sub3 += Math.pow(y[i - 1], 2);
    }
    sub3 = 2 * sub3 / J3.size();
    for (int i = 4; i <= numberOfVariables_; i++) {
      J4.add(i);
      sub4 += Math.pow(y[i - 1], 2);
    }
    sub4 = 2 * sub4 / J4.size();
    // evaluate f1,f2,f3,f4,...m
    f[0] = Math.sin(Math.PI * x[0] / 2) + sub1;
    f[1] = Math.cos(Math.PI * x[0] / 2) * Math.sin(Math.PI * x[1] / 2) + sub2;
    f[2] = Math.cos(Math.PI * x[0] / 2) * Math.cos(Math.PI * x[1] / 2) + sub3;
    for (int i = 3; i < numberOfObjectives_; i++) {
      f[i] = Math.pow(f[0], 2) + Math.pow(f[1], 10) + Math.pow(f[2], 10) + sub4;
    }

    for (int i = 0; i < numberOfObjectives_; i++) {
      solution.setObjective(i, f[i]);
    }
  }
920574
@Override
  public void evaluate(DoubleSolution solution)  {
    double [] fx = new double[getNumberOfObjectives()];
    
    double x1,x2,x3,x4,x5,x6;
    x1 = solution.getVariableValue(0);
    x2 = solution.getVariableValue(1);
    x3 = solution.getVariableValue(2);
    x4 = solution.getVariableValue(3);
    x5 = solution.getVariableValue(4);
    x6 = solution.getVariableValue(5);

    fx[0] = - (25.0*(x1-2.0)*(x1-2.0) +
                  (x2-2.0)*(x2-2.0) + 
                  (x3-1.0)*(x3-1.0) + 
                  (x4-4.0)*(x4-4.0)+
                  (x5-1.0)*(x5-1.0));
                
    fx[1] = x1*x1 + x2*x2 + x3*x3 + x4*x4 + x5*x5 + x6*x6;
    
    solution.setObjective(0,fx[0]);
    solution.setObjective(1,fx[1]);

    this.evaluateConstraints(solution);
  }
608900
@Override
  public void computeDensityEstimator(List<S> solutionList) {
    int size = solutionList.size();

    if (size == 0) {
      return;
    }

    if (size == 1) {
      solutionList.get(0).setAttribute(getAttributeIdentifier(), Double.POSITIVE_INFINITY);
      return;
    }

    if (size == 2) {
      solutionList.get(0).setAttribute(getAttributeIdentifier(), Double.POSITIVE_INFINITY);
      solutionList.get(1).setAttribute(getAttributeIdentifier(), Double.POSITIVE_INFINITY);

      return;
    }

    // Use a new SolutionSet to avoid altering the original solutionSet
    List<S> front = new ArrayList<>(size);
    for (S solution : solutionList) {
      front.add(solution);
    }

    for (int i = 0; i < size; i++) {
      front.get(i).setAttribute(getAttributeIdentifier(), 0.0);
    }

    double objetiveMaxn;
    double objetiveMinn;
    double distance;

    int numberOfObjectives = solutionList.get(0).getNumberOfObjectives() ;

    for (int i = 0; i < numberOfObjectives; i++) {
      // Sort the population by Obj n
      Collections.sort(front, new ObjectiveComparator<S>(i)) ;
      objetiveMinn = front.get(0).getObjective(i);
      objetiveMaxn = front.get(front.size() - 1).getObjective(i);

      // Set de crowding distance
      front.get(0).setAttribute(getAttributeIdentifier(), Double.POSITIVE_INFINITY);
      front.get(size - 1).setAttribute(getAttributeIdentifier(), Double.POSITIVE_INFINITY);

      for (int j = 1; j < size - 1; j++) {
        distance = front.get(j + 1).getObjective(i) - front.get(j - 1).getObjective(i);
        distance = distance / (objetiveMaxn - objetiveMinn);
        distance += (double)front.get(j).getAttribute(getAttributeIdentifier());
        front.get(j).setAttribute(getAttributeIdentifier(), distance);
      }
    }
  }
352443
private void updateLimits(List<S> solutionList) {
    for (int obj = 0; obj < numberOfObjectives; obj++) {
      gridLowerLimits[obj] = Double.MAX_VALUE;
      gridUpperLimits[obj] = Double.MIN_VALUE;
    }

    //Find the max and min limits of objetives into the population
    for (int ind = 0; ind < solutionList.size(); ind++) {
      Solution<?> tmpIndividual = solutionList.get(ind);
      for (int obj = 0; obj < numberOfObjectives; obj++) {
        if (tmpIndividual.getObjective(obj) < gridLowerLimits[obj]) {
          gridLowerLimits[obj] = tmpIndividual.getObjective(obj);
        }
        if (tmpIndividual.getObjective(obj) > gridUpperLimits[obj]) {
          gridUpperLimits[obj] = tmpIndividual.getObjective(obj);
        }
      }
    }
  }