Author Topic: Phylogenic trees  (Read 3402 times)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Phylogenic trees
« on: November 05, 2006, 08:50:50 PM »
I've been toying around with this in my mind for a while.  I hope by typing it out to explain, I'll be able to work out the rough edges.  It doesn't provide a change in the gameplay at all, its mostly a way to provide more meaningful data about what's going on in the simulation as far as evolution.

The phylogenic tree is a method in real biology to track ancestry and evolution over time.  It's use is limited because when you begin throwing things like sex and viruses into the mix, things get very complicated very fast.

Darwinbots knows exactly what changed a DNA though, so I think it would be possible to construct a meaningful phylogenic tree in the program.  It's possible to log the changes in DNA over time into a data structure that can be traversed without too much problem.  This implementation assumes that codules are being used, and viruses are using codules.  I'll explain trickier details near the end.

When the simulation starts, instead of actual DNA each robot has a link back to a single instance of its specie's DNA.  This marks the head of the phylogenic tree for this species, and this phylogenic head carries the instance of the actual DNA.

Everytime an organism is created, a check is made to see if it's mutated at all from its ancestor.  If it hasn't, its information (date of birth, net energy change over lifetime, date of death, parent(s), child(ren), any other information we want to provide) is logged into the node of its ancestor in the phylogenic tree.

If its DNA has changed, a new child node is created with the information of what's changed, in addition to its life stats.

When a bot's DNA program executes, it executes the DNA stored in the bot's node, or it searches backwards in the tree until it finds a complete copy of the DNA and then re-traverses the tree, modifying a copy of this root DNA as it goes.  Every node doesn't need to store the DNA program, it just needs to provide a way to reconstruct the DNA at that node.

When the tree reaches a certain depth, certain child nodes are given a complete DNA program instead of just the information to reconstruct one.  Very old nodes can be destructed back into the instructions to reconstruct the node as system resources becomes scarce.

The above is the base data structure I'm imagining for use in vanilla asexual reproduction.  I'm hoping that since you're instancing DNA instead of using local copies for every bot, you can save some RAM.  Of course, storing the entire phylogenic tree in memory after millions of cycles will probably use up some RAM as well.  Luckily most of the phylogenic tree can reside in virtual memory just fine.  It might also save some time with cancerous bots not needing to allocate and deallocate their DNA structures.

It should be fairly trivial to build a visualization function to display the tree, and provide a clear record of various strains, and how narrow the tree really is.

Tricky bits
Point mutations, viruses, and sexual recombination canmake things very tricky.

Viruses aren't that hard.  If we assume that viruses are transmitted as whole codules, we just attach some additional information to codules if they're viruses that can be used to track the changes in the viral DNA over time.  We record this information in a seperate phylogenic tree for the viruses.

Point mutations could be represented as a different sort of link than the ones between mother/daughter bot.  Otherwise they would follow the same rules.

Sex really screws things up.  I think trying to record DNA would be a disaster.  We'd probably have to settle for the more traditional geneology approach.  Bot A and Bot B had kid C during cycle X...

That's pretty much all I have at the moment.  I'm looking for some feedback.

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Phylogenic trees
« Reply #1 on: November 05, 2006, 11:55:52 PM »
Do you want to use this as a general model for storing DNA information for sim's use?  Would it be better than the current one?  Because for the phylogenetic trees we don't really need to know exact mutation for every bot that lived.

Having Ph.T. is a nice thing, but it is very difficult to interpret, so the usefulness of it is going to be limited.  I can see just one thing for which it can be used - to take a broad look at the general behaviour of population.  Again, the specific DNA information is not important here and would be a hell to sort out.  It should be more of a tool to see what is going on.  Is my population mutating too much?  Too little?  Is my current population derived from a recent single ancestor or does it contain two independent groups that have been separated for some time?  Do my populations go through frequent bottlenecks?  That sort of thing...   In that sense I would want the tree to have the following properties:

1.  Visual representation of how many bots of a given genotype had ever lived.  Maybe put circles in each node with area proportional to that.
2.  Ability to "zoom in and out" for the level of details.  For example, for some things I would not want to see any genotypes that had only a single bot for them.  For other things I would.  And sometimes I would want to get rid of branches that did not make it to "today" and only see the direct parents of bots that live now.
3. Ability to "clump genotypes together".  Sometimes it may be useful to ignore the small changes and count closely-related bots as having the same genotype.
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Phylogenic trees
« Reply #2 on: November 06, 2006, 01:45:04 AM »
It's a bit between an internal method for DNA and a method for phylogenic trees.  Either alone would be a lot of effort for not a lot of gain, but together they provide a good framework.

I like your ideas for visualization.  I'm pretty sure I can make something neat looking.