davidrmiller / biosim4

Biological evolution simulator
Other
3.1k stars 435 forks source link

understanding generateChildGenome #52

Closed rodriguez-facundo closed 2 years ago

rodriguez-facundo commented 2 years ago

Hi, really nice project. Thanks for sharing it.

I was looking at the function in the title and I'm curious what it does. I thought there would be a crossover approach where a child is born with half the genes from one parent and half the genes from the other parent. But looking at that function, it seems we take only 1 parent and then we randomly insert or delete 1 connection. I don't know c++ so I might be reading the code incorrectly.

Thanks again

davidrmiller commented 2 years ago

Hi @rodriguez-facundo , From memory, I believe the existing code works something like this: We start by copying one parent's genome, then we overwrite a random-length, random-location segment of those genes with genes from the other parent. It's a standard distribution so that on average, a child inherits equally from both parents, although at the tails of the curve, a few children inherit mostly from one of the parents.

rodriguez-facundo commented 2 years ago

thanks