private void initializeNeighborhoods(){
  List<Individual> sortedPopulation=new ArrayList<Individual>(population);
  for (  Individual individual : population) {
    Collections.sort(sortedPopulation,new WeightSorter(individual));
    for (int i=0; i < neighborhoodSize; i++) {
      individual.addNeighbor(sortedPopulation.get(i));
    }
  }
}

private void initializeNeighborhoods ( ) { List < Individual > sortedPopulation = new ArrayList < Individual > ( population ) ; for ( Individual individual : population ) { Collections . sort ( sortedPopulation , new WeightSorter ( individual ) ) ; for ( int i = 0 ; i < neighborhoodSize ; i ++ ) { individual . addNeighbor ( sortedPopulation . get ( i ) ) ; } } }
constructs the neighborhoods for all individuals in the population based on the distances between weights .
