private double[] getCumulativeWeights(List<Chromosome> fittestIndividuals){
        double weightSum = 0;
        for(Chromosome c: fittestIndividuals){
            if(minimize){
                weightSum += 1/c.getFitnessValue();
            }else {
                weightSum += c.getFitnessValue();
            }
        }
        double[] normalisedWeights = new double[numberOfIndividualsForReproduction];
        for(int i = 0; i<numberOfIndividualsForReproduction;i++){
            if(minimize) {
                normalisedWeights[i] =  (1.0/fittestIndividuals.get(i).getFitnessValue())/weightSum;
            }else {
                normalisedWeights[i] = fittestIndividuals.get(i).getFitnessValue() / weightSum;
            }
        }
        double[] cumulativeWeights = new double[numberOfIndividualsForReproduction];
        cumulativeWeights[0] = normalisedWeights[0];
        for(int i = 1; i<numberOfIndividualsForReproduction;i++){
            cumulativeWeights[i] = cumulativeWeights[i-1] + normalisedWeights[i];
        }
        return cumulativeWeights;
    }