code: @Override
    public void evaluate(IntegerSolution solution) {
      int approximationToN;
      int approximationToM ;
  
      approximationToN = 0;
      approximationToM = 0;
  
      for (int i = 0; i < solution.getNumberOfVariables(); i++) {
        int value = solution.getVariableValue(i) ;
        approximationToN += Math.abs(valueN - value) ;
        approximationToM += Math.abs(valueM - value) ;
      }
  
      solution.setObjective(0, approximationToN);
      solution.setObjective(1, approximationToM);
    }
docs: Evaluate() method