code: public void evaluate(DoubleSolution solution) {
      int numberOfVariables = getNumberOfVariables();
      int numberOfObjectives = getNumberOfObjectives();
      double[] f = new double[numberOfObjectives];
      double[] x = new double[numberOfVariables] ;
  
      for (int i = 0; i < numberOfVariables; i++) {
        x[i] = solution.getVariableValue(i) ;
      }
  
      int k = getNumberOfVariables() - getNumberOfObjectives() + 1;
  
      double g = 0.0;
      for (int i = numberOfVariables - k; i < numberOfVariables; i++) {
        g += (x[i] - 0.5) * (x[i] - 0.5);
      }
  
      for (int i = 0; i < numberOfObjectives; i++) {
        f[i] = 1.0 + g;
      }
  
      for (int i = 0; i < numberOfObjectives; i++) {
        for (int j = 0; j < numberOfObjectives - (i + 1); j++) {
          f[i] *= Math.cos(x[j] * 0.5 * Math.PI);
        }
        if (i != 0) {
          int aux = numberOfObjectives - (i + 1);
          f[i] *= Math.sin(x[aux] * 0.5 * Math.PI);
        }
      }
  
      for (int i = 0; i < numberOfObjectives; i++) {
        solution.setObjective(i, f[i]);
      }
    }
docs: Evaluate() method