@Override
  public void evaluate(IntegerDoubleSolution solution) {
    int approximationToN;
    int approximationToM ;

    approximationToN = 0;
    approximationToM = 0;

    for (int i = 0; i < solution.getNumberOfIntegerVariables(); i++) {
      int value = solution.getVariableValue(i).intValue() ;
      approximationToN += Math.abs(valueN - value) ;
      approximationToM += Math.abs(valueM - value) ;
    }

    for (int i = solution.getNumberOfIntegerVariables(); i < (solution.getNumberOfIntegerVariables()+solution.getNumberOfDoubleVariables()); i++) {
      double value = solution.getVariableValue(i).doubleValue() ;
      approximationToN += Math.abs(valueN - value) ;
      approximationToM += Math.abs(valueM - value) ;
    }

    solution.setObjective(0, approximationToN);
    solution.setObjective(1, approximationToM);
  }
@ Override public void evaluate ( IntegerDoubleSolution solution ) { int approximationToN ; int approximationToM ; approximationToN = 0 ; approximationToM = 0 ; for ( int i = 0 ; i < solution . getNumberOfIntegerVariables ( ) ; i ++ ) { int value = solution . getVariableValue ( i ) . intValue ( ) ; approximationToN += Math . abs ( valueN - value ) ; approximationToM += Math . abs ( valueM - value ) ; } for ( int i = solution . getNumberOfIntegerVariables ( ) ; i < ( solution . getNumberOfIntegerVariables ( ) + solution . getNumberOfDoubleVariables ( ) ) ; i ++ ) { double value = solution . getVariableValue ( i ) . doubleValue ( ) ; approximationToN += Math . abs ( valueN - value ) ; approximationToM += Math . abs ( valueM - value ) ; } solution . setObjective ( 0 , approximationToN ) ; solution . setObjective ( 1 , approximationToM ) ; }
Evaluate() method