code: @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);
      }
  
      double g = 0, subf1 = 1, subf3;
      for (int j = numberOfObjectives - 1; j < numberOfVariables; j++) {
        g += (Math.pow(x[j] - 0.5, 2));
      }
      subf3 = 1 + g;
  
      f[numberOfObjectives - 1] = x[0] * subf3;
      for (int i = numberOfObjectives - 2; i > 0; i--) {
        subf1 *= x[numberOfObjectives - i - 2];
        f[i] = subf3 * (1 - subf1 * (1 - x[numberOfObjectives - i - 1]));
      }
      f[0] = (1 - subf1 * x[numberOfObjectives - 2]) * subf3;
  
      for (int i = 0; i < numberOfObjectives; i++) {
        solution.setObjective(i, f[i]);
      }
    }
docs: Evaluates a solution
  
  @param solution The solution to evaluate