code: public void evaluate(PermutationSolution<Integer> solution){
      double fitness1   ;
      double fitness2   ;
  
      fitness1 = 0.0 ;
      fitness2 = 0.0 ;
  
      for (int i = 0; i < (numberOfCities - 1); i++) {
        int x ;
        int y ;
  
        x = solution.getVariableValue(i) ;
        y = solution.getVariableValue(i+1) ;
  
        fitness1 += distanceMatrix[x][y] ;
        fitness2 += costMatrix[x][y];
      }
      int firstCity ;
      int lastCity  ;
  
      firstCity = solution.getVariableValue(0) ;
      lastCity = solution.getVariableValue(numberOfCities - 1) ;
  
      fitness1 += distanceMatrix[firstCity][lastCity] ;
      fitness2 += costMatrix[firstCity][lastCity];
  
      solution.setObjective(0, fitness1);
      solution.setObjective(1, fitness2);
    }
docs: Evaluate() method