@Override
  public void evaluate(DoubleSolution solution) {
    int numberOfVariables = getNumberOfVariables() ;

    double[] f = new double[getNumberOfObjectives()];
    double[] x = new double[numberOfVariables] ;

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

    double sum1 = 0.0;
    for (int i = 0; i < numberOfVariables; i++) {
      sum1 += StrictMath.pow(x[i] - (1.0 / StrictMath.sqrt((double) numberOfVariables)), 2.0);
    }
    double exp1 = StrictMath.exp((-1.0) * sum1);
    f[0] = 1 - exp1;

    double sum2 = 0.0;
    for (int i = 0; i < numberOfVariables; i++) {
      sum2 += StrictMath.pow(x[i] + (1.0 / StrictMath.sqrt((double) numberOfVariables)), 2.0);
    }
    double exp2 = StrictMath.exp((-1.0) * sum2);
    f[1] = 1 - exp2;

    solution.setObjective(0, f[0]);
    solution.setObjective(1, f[1]);
  }
@ Override public void evaluate ( DoubleSolution solution ) { int numberOfVariables = getNumberOfVariables ( ) ; double [ ] f = new double [ getNumberOfObjectives ( ) ] ; double [ ] x = new double [ numberOfVariables ] ; for ( int i = 0 ; i < numberOfVariables ; i ++ ) { x [ i ] = solution . getVariableValue ( i ) ; } double sum1 = 0.0 ; for ( int i = 0 ; i < numberOfVariables ; i ++ ) { sum1 += StrictMath . pow ( x [ i ] - ( 1.0 / StrictMath . sqrt ( ( double ) numberOfVariables ) ) , 2.0 ) ; } double exp1 = StrictMath . exp ( ( - 1.0 ) * sum1 ) ; f [ 0 ] = 1 - exp1 ; double sum2 = 0.0 ; for ( int i = 0 ; i < numberOfVariables ; i ++ ) { sum2 += StrictMath . pow ( x [ i ] + ( 1.0 / StrictMath . sqrt ( ( double ) numberOfVariables ) ) , 2.0 ) ; } double exp2 = StrictMath . exp ( ( - 1.0 ) * sum2 ) ; f [ 1 ] = 1 - exp2 ; solution . setObjective ( 0 , f [ 0 ] ) ; solution . setObjective ( 1 , f [ 1 ] ) ; }
Evaluate() method