School of Computing. Dublin City University.
Online coding site: Ancient Brain
coders JavaScript worlds
But it is fascinating to see the "algorithms" that have evolved in nature to solve these problems.
Basic problem:
"DNA" is instructions for how to build phenotype:
How to build arms | How to build legsWe want child to take the instructions from both parents:
Father's How to build arms | Father's How to build legs Mother's How to build arms | Mother's How to build legs
Possibilities:
How does nature do it? This was not understood until the mid-late 20th century.
Father's part (the "sperm") can't have only 1/2 copy of instructions when it leaves his body because it may not synchronise with the mother's 1/2 copy (the "egg"). Sperm would have to contain father's full DNA and then, when it got to egg, synchronise at that point with egg DNA to ensure full copy of instructions passed on.
Nature has evolved an elegant solution as follows. Everyone carries precisely 2 copies of instructions, no more, no less. More than you need. For each instruction, you only actually use 1 copy (dominant/recessive genes).
Your father and mother both carried 2 copies also. They divided these to produce sperm and eggs ("gametes"), each containing 1 full copy. The 1-copy sperm and 1-copy egg come together to make new individual with 2 copies. Process repeats.
That's the basic scheme (not understood until 20th century, remember!)
It is the process of sperm/egg-production at which the first major reshuffling takes place.
There are 23 chromosomes (strings) to make up the whole instruction set (for humans). Your mother/father has 2 copies:
The sperm/egg gets 1 copy of the instructions, but mixed up (independent assortment of chromosomes):
Hence there are 223 possible combinations - massive genetic variety possible compared to asexual reproduction.
Secondly, even looking at a single chromosome string, new strings are created by crossover (there will also be mutation as well). For each chromosome at position i, we have 2 copies:
DNA replication:
0000000000000000000 0000000000000000000 1111111111111111111 1111111111111111111Possibly "cross over" the instructions of adjacent ones at some point (may be multiple crossovers):
0000000000000000000 0000000000000111111 1111111111111000000 1111111111111111111Each sperm/egg gets one of these strands, for each of its 23 chromosomes. This process produces sperm/eggs in batches of 4, each with 1 copy of instructions. (In fact, sperm are produced 4 at a time alright, but with eggs, 3 of these 1-copy "gametes" are discarded, and 1 picked for the egg.)
The second reshuffling is when the 1-copy sperm and 1-copy egg get together. Child has 2 copies. Some genes will be dominant and some recessive. Genes that were dominant in parent may be completely missing in child, and grandparent's recessive gene is expressed again. Child grows up with 2 copies. Process repeats.
In nature a crossover may break the gene
at the crossover site.
This may be a good thing (a useful mutation)
or (more likely) a bad thing.
However, in the 2-copy system,
this is only 1 of the copies.
The other may have undergone its own crossover,
but very unlikely to be the same point,
so we still have a working copy just in case.
If the only reshuffling was who you mated with, then children could be a new combination alright, but all siblings would be the same. So there is further reshuffling - every sperm and egg is unique.
Synchronisation of 2 copies happens inside the same body - easier to control. The crossover mechanism ensures that we can mix up the instructions while ensuring that each sperm/egg still has 1 full copy.
Nature could presumably have just 1-copy individuals, get the 1-copy sperm DNA and 1-copy egg DNA together, and then make sure there was a crossover as above, and pick the child from one of the crossed over segments. Would probably get a lot of clones (crossover didn't happen). Also not as much diversity (don't get grandparent's recessive genes, as above). 2-copies also more robust in terms of error correction.
Interesting to consider why 2-copies has evolved everywhere, and not 3 or more, and not 1.
If you have sexes, how on earth do you maintain a 50-50 coin flip for the sex of the offspring? In a machine algorithm, we can use a random number generator.
How can nature toss the coin so accurately so that 50 percent of population always is male and 50 percent female?
Each male carries 2 copies X, Y. Each female carries 2 copies X, X. Male produces millions of X sperm, millions of Y sperm, in proper proportions (doesn't have to count - it just takes millions of X-Y cells and splits them up). All female 1-copy eggs are X.
If a Y sperm fertilises egg, child has X plus Y (male).
If an X sperm, child is X plus X (female).
And so it continues.
Interesting that men throughout history have berated their wives for producing daughters, e.g. Henry VIII, when of course it is the man's own sperm that decides the issue.
Anything we can learn from this natural "Monte Carlo" "algorithm" to ensure 50-50 ratios?
If it used a 2-copy system,
it would have to get involved in defining what is dominant/recessive.
e.g. 10 genes in genotype. 2 copies.
Which is dominant/recessive?
210 possible choices.
Sex seems to be a way of maintaining better diversity in a population, by mixing up different building blocks, as opposed to asexual reproduction, where we depend on slow mutations from a common origin.
But still, once a solution is found, surely you settle down with asexual reproduction?
Yes, that may be true. Sex may be related to a (fast or slowly) changing fitness landscape. The fastest changing fitness landscape may, for example, be that caused by fast-evolving parasites. In a changing fitness landscape, we want to keep alive a diversity of solutions, so the population can move in one of many different directions when necessary. If there's only one genotype, and the Black Death kills it, then you go extinct.
But even if there is benefit for the species, how does that translate into benefit for the individual? The evolution of sex is a long-standing topic of debate.
Sexual selection: The individuals choose their own mates according to preferences that can be encoded in the genes.
The problem with sexual selection is it leads to
runaway effects
like the peacock's tail.
We tend not to allow sexual selection / mate choice
in machine evolution.