public ArrayList<Chromosome> generateNewPopulation(ArrayList<Chromosome> currentPopulation){
        ArrayList<Chromosome> newPopulation = new ArrayList<Chromosome>();
        if(minimize){
            Collections.sort(currentPopulation);
        }else {
            Collections.sort(currentPopulation, Collections.reverseOrder());
        }
        System.out.println("Best fitness value: " + currentPopulation.get(0).getFitnessValue());
        List<Chromosome> fittestIndividuals = new ArrayList<Chromosome>();
        int uniqueIndividualsFound = 0;
        double lastFitnessValue = 0.0;
        while(uniqueIndividualsFound<numberOfIndividualsForReproduction){
            if(lastFitnessValue != currentPopulation.get(0).getFitnessValue()){
                fittestIndividuals.add(currentPopulation.get(0));
                lastFitnessValue = currentPopulation.get(0).getFitnessValue();
                uniqueIndividualsFound++;
            }
            currentPopulation.remove(0);
        }
        double[] cumulativeWeights = getCumulativeWeights(fittestIndividuals);
        Chromosome individualA;
        Chromosome individualB;
        for(int i = 0; i<generationSize;i++){
            individualA = fittestIndividuals.get(indexOfSelectedIndividual(cumulativeWeights, Math.random()));
            individualB = fittestIndividuals.get(indexOfSelectedIndividual(cumulativeWeights, Math.random()));
            while(individualA.equals(individualB)){
                individualB = fittestIndividuals.get(indexOfSelectedIndividual(cumulativeWeights, Math.random()));
            }
            Chromosome beforeMutation = crossoverChromosomes(individualA,individualB);
            Chromosome afterMutation = mutate(beforeMutation);
            newPopulation.add(afterMutation);
        }
        return newPopulation;
    }