# Genetic Algorithm: Need some clarification on selection and what to do when crossover doesn't happen

I'm writing a genetic algorithm to minimize a function. I have two questions, one in regards to selection and the other with regards to crossover and what to do when it doesn't happen.

Here's an outline of what I'm doing:

while (number of new population < current population)
# Evaluate all fitnesses and give them a rank. Choose individual based on rank (wheel roulette) to get first parent.
# Do it again to get second parent, ensuring parent1 =/= parent2

# Elitism (do only once): choose the fittest individual and immediately copy to new generation

Multi-point crossover: 50% chance
if (crossover happened)
do single point mutation on child (0.75%)
else
pick random individual to be copied into new population.
end


And all of this is under another while loop which tracks fitness progression and number of iterations, which I didn't include. So, my questions:

1. As you can see, two parents are chosen randomly in each iteration until the new population is filled up. So, the two same parents may mate more than once and surely several fit parents will mate many more times than once. Is this in any way bad?
2. In the obitko tutorial, it says if crossover doesn't happen, then child is exact copy of parents. I don't even understand what that means, so, as you can see, I just picked a random parent (uniformly; no fitness considered) and copied to new population. This seems weird to me. Whether I actually do this or not, my results really don't change that much. What's the proper way to handle the case when crossover doesn't happen?
• 1. Members having children from multiple crossovers are simply more dominant than others, it seems to be natural. 2. I think it does not play too much role. What matters is how you choose candidates and how you perform crossover. – BalazsToth Mar 18 '18 at 22:47
• Yep, I can confirm both of your answers. Wasted a chunk of time ensuring unique parents and unique clones only to get marginal improvement. – fiziks Mar 18 '18 at 23:01
• @BalazsToth it would be great if you convert your valuable comment into an answer! – Anton Menshov May 7 '18 at 3:20