💾 Archived View for uscoffings.net › writing › 20141020-evolution.md captured on 2024-05-12 at 15:16:51.
⬅️ Previous capture (2022-06-03)
-=-=-=-=-=-=-
# Modeling Evolution [tags: evolution, modeling, software] [date: 2014-10-20] I have long been fascinated with computer modeling, simulations, and open-ended explorations on the computer. So finally over the past weekend I got serious about doing some evolution. I have pondered evolving digital organisms for years, so I had a mental arsenal ready to release on the project, but the discussion here is based on a weekend's worth of coding. # First Implementation Obviously after just a weekend, this code is not yet well baked. The interesting thing is where the program met my preconceived notions and where it completely blindsided me. I based my digital organisms on the [Avida instruction set](http://myxo.css.msu.edu/papers/nature2003/glossary.html) (with some extensions), with a Qt-based 2D visualization. The initial organisms are hand-coded trivial copy machines, derived from my reading of the Avida documentation: 0000 H_ALLOC 0001 H_SEARCH ; Set FH to the end of the genome 0002 NOP_C 0003 NOP_C 0004 NOP_A 0005 MOV_HEAD ; Set WH to the end of the genome 0006 NOP_C 0007 JMP_HEAD ; Add length of complement, to not overwrite 0008 NOP_C 0009 H_SEARCH ; Set FH to top of copy loop 000a H_COPY ; [WH] <- [RH] 000b IF_LABEL ; Done copying? 000c NOP_C 000d NOP_C 000e NOP_A 000f H_DIVIDE ; Yes, so divide 0010 MOV_HEAD ; Jump back to the top of copy loop 0011 NOP_A ; Marks the end of the genome 0012 NOP_A 0013 NOP_B I added some simple point-mutations (insertion, deletion, alteration) during reproduction and also some alterations that occurred with increasing frequency as the organism aged. Organisms that did not reproduce in a sensible way would die (for example, it's possible to divide off your entire genome to your child; in this case I enforced that the parent died rather than spin uselessly). Finally, as the organisms aged, they had an increasing chance to spontaneously die. Child organisms are spawned randomly within a 3x3 grid focused on the parent. (Someday I plan to move to a hex grid.) Much like (optionally) in Avida, an organism dies when an offspring is plopped on top of it. I have a higher-level organism abstraction, which can move in 2D, and send and receive signals, but as of yet there are almost no selective pressures to encourage these behaviors. I say "almost" because I expected the chance of being replaced by a new child would encourage the learning of movement. Here is a screenshot of a run. The colors are a poor attempt to classify related organisms. I found it interesting that the two initial separate but identical organisms evolved distinct dominant genotypes. Also interesting is the rogue blue guy running from the upper left colony -- this is my predicted evolved "runner". ![Early evolution screenshot](early-evolution-screenshot.jpg) # Runners Occasionally (but rarely) I also saw a runner that had a child or two, but this was more rare than the celibate runner. Celibate runners are more expected (at least to start with) because with such a limited genome, any alteration which would enable running would probably break successful reproduction. But adding "junk" to the genome, hoping to enable reproductive runners, just led to worse... # Cancer But the most surprising, and vexing, development is "cancer". Most runs grind to a halt within perhaps 10 generations (that is, a split-second) because of cancer. Mutations occur which cause the child's genome to be huge. Capping the maximum growth rate does not fundamentally help (1.1^n is still exponential). The real problem is that I do not yet have selective pressures to encourage judicious use of CPU cycles. If cycles are free, growth is unbounded. Avida researchers usually select on the ability to solve simple arithmetic problems, but I naively want(ed) to leave my evolution more open-ended. But almost immediately I've discovered that I need stronger pressures. (Admittedly, some portion of this may be due, in part, to the Avida instruction set. I am still researching this... and believe me, my 8-year old son is hounding me to crack this so we can move forward!) I've been thinking about this in other contexts for a while, but this further reinforces my understanding that mortality is healthy for the population. Don't fear the reaper, I suppose. # Next Steps Add pressures to push back against cancer. Add introspection (tools to inspect genome, evolutionary history, ...)