public void evolve() {
                // Create a buffer for the new generation
                Chromosome[] buffer = new Chromosome[popArr.length];
                
                // Copy over a portion of the population unchanged, based on 
                // the elitism ratio.
                int idx = Math.round(popArr.length * elitism);
                System.arraycopy(popArr, 0, buffer, 0, idx);

                // Iterate over the remainder of the population and evolve as 
                // appropriate.
                while (idx < buffer.length) {
                        // Check to see if we should perform a crossover. 
                        if (rand.nextFloat() <= crossover) {
                                
                                // Select the parents and mate to get their children
                                Chromosome[] parents = selectParents();
                                Chromosome[] children = parents[0].mate(parents[1]);
                                
                                // Check to see if the first child should be mutated.
                                if (rand.nextFloat() <= mutation) {
                                        buffer[idx++] = children[0].mutate();
                                } else {
                                        buffer[idx++] = children[0];
                                }
                                
                                // Repeat for the second child, if there is room.
                                if (idx < buffer.length) {
                                        if (rand.nextFloat() <= mutation) {
                                                buffer[idx] = children[1].mutate();
                                        } else {
                                                buffer[idx] = children[1];
                                        }
                                }
                        } else { // No crossover, so copy verbatium.
                                // Determine if mutation should occur.
                                if (rand.nextFloat() <= mutation) {
                                        buffer[idx] = popArr[idx].mutate();
                                } else {
                                        buffer[idx] = popArr[idx];
                                }
                        }
                        
                        // Increase our counter
                        ++idx;
                }

                // Sort the buffer based on fitness.
                Arrays.sort(buffer);
                
                // Reset the population
                popArr = buffer;
        }