private Chromosome getChromosomeByRoulette() {
        double totalFit = 0;
        int count = 0;
        for(Chromosome chromosome : chromosomes) {
            if (this.eliteChromosomes > 0 && ++count > this.eliteChromosomes) break;
            totalFit += chromosome.fitness;
        }
        double slice = random.nextDouble() * totalFit;
        for(Chromosome chromosome : chromosomes) {
            slice -= chromosome.fitness;
            if (slice <= 0.0) {
                return new Chromosome(chromosome);
            }
        }
        return chromosomes.get(0); // to avoid warnings
    }