davidrmiller / biosim4

Biological evolution simulator
Other
3.21k stars 460 forks source link

Sexual Reproduction #100

Open mikemayer67 opened 6 months ago

mikemayer67 commented 6 months ago

I have not yet tried digging through your code, but I do have a question based on your excellent YouTube video. If I understand the video correctly, the reproduction is asexual. Have you considered what it would take to add sexual reproduction?

I realize that this would probably add a huge level of complexity.

These are just my knee-jerk reactions. I'm curious if you have contemplated any of this and what your thoughts might be.

Thanks much, mike

davidrmiller commented 6 months ago

Hi @mikemayer67, thanks for the interesting questions. The configuration file has a parameter that lets you choose the type of reproduction. The default is sexual, which uses a very rudimentary algorithm: By default, pairs of survivors are selected at random. The offspring inherits a random-length sequence of genes from one parent and the rest from the other parent. As you said, simulating more than that could get complicated.

With a small code modification, the parents could be chosen preferentially, for example, based on the spatial distance between individuals at the end of their generation. The creatures can sense the genetic similarity of an adjacent neighbor, so they could, in theory, evolve a preference for mates based on genetic compatibility. I tried a few brief experiments along those lines but never followed up with the statistical analyses to determine if those experiments had any effect.

P.s., I just discovered your website -- thoughtful and inspiring articles.

venzen commented 6 months ago

Indeed, it becomes complex if we try to model sexual preference.

For example, I recently saw a study whereby human females on chemical (hormonal) birth control select a mate randomly regardless of his pheromones, whereas the overwhelming "natural" tendency is for females to choose a mate based on pheromonal dissimilarity. The implication is that females naturally select a mate with a dissimilar immune system and, therefore, genetic variance from her own profile.

Just to add to the complexity, I saw another study that showed that "war brides" have, historically, displayed a capacity to quickly shift allegiance to their new tribe and, typically, enforce this new allegiance in their offspring.

Random mate selection in a simulation seems to be the best fit to reality (smile).

mikemayer67 commented 6 months ago

I apologize for using an issue as a chat medium, but I'm not finding an easy way to DM you.

I'm reading through the codebase now. I'm loving the excellent use of comments for documentation and the well thought out variable names. It makes understanding what's going on very easy.

I just got through looking at the code for random number generation. If I'm reading how you seeded rngy and rngz correctly, I'm guessing you and I have a bit in common in how we choose our seemingly arbitrary numbers. Then again... I might just be seeing patterns where there aren't any.

davidrmiller commented 6 months ago

Ha, I like the xkcd approach to random number generators.