Code center > Bugs and fixes

Genetic Distance / Generational Distance

(1/7) > >>

Botsareus:
I just realized that genetic distance and generational distance charts where never programmed. I would like to take a crack at it, but, not really sure how to code it. I did some experiments where I figure out the most unique robot but this is a little different. Also, should I code this cross-species or not? (My personal preference is to code this cross-species but it is your call to make)


I guess I can do (my number from the unique robot calculator / total robots) for genetic distance.
But, what about generational distance?

Botsareus:
I think I can use "reclev" from the "Score" function to get max generational distance right?

Numsgil:
Genetic distance is sort of tricky.  You need to match up lengths of DNA based on similarity, and then count the number of differences.  That makes the algorithm robust to insertions and deletions.  I think the sexrepro code already has a cross-over matching algorithm I helped Eric write a few years ago.  You could probably leverage that.  That would give you the genetic difference between any two bots.  I'm not sure how you'd turn that in to a sim-wide graph.  Either you'd do genetic distance from common ancestor, or some sort of median or average of genetic distance of all members of a species.

Generational distance is much simpler.  You can just do either the average/median generation number since the common ancestor or do the relative spread of the living members.

...

If you're going to be doing some non-trivial programming, do you want to try and clean up the trunk while you're at it?  I'll set you up with priveleges.  It's in a mucky state; too much development got tried all at the same time and it sort of imploded.  I tried to salvage it by separating out easy fixes from more systemic changes, but it turns out merging UI code is basically impossible so I failed at even that and gave up to go back to DB3 development :/  So the few patches you've submitted I haven't merged in yet, for instance.

I think the best bet is to rollback the trunk to changelist 61.  That's basically 2.45.01 with my shflav fix added in and some file reorgnization.  You could then go from there and add in the few patches you've done so far and then do the graph work.  We'd lose the veggy work, but I don't have the energy to salvage it so meh :/

Numsgil:
On the genetic distance:

See the Crossover function in robots.bas.  It does more work than you'd need to do, though.  The algorithm basically is recursive and looks something like:

Find largest matching sequence in current two DNA strands, or terminate if the sequences don't match.
For the DNA on either end of the matching sequence (the ones that don't match), feed them in to the algorithm again.

So you keep subdividing the DNA in to a matching middle and unmatching sides.  Eventually you terminate and you have a bunch of matched regions in between areas of genetic difference.

Then to get a genetic distance you could do 1 - the total sum of the matching sequence lengths divided by the total DNA length (or average of them or something like that if they're different).

0 would mean the DNA is exactly matching.  1 would mean they're basically totally different.

Numsgil:
Here's an article about the problem of finding the longest common sequence.

Navigation

[0] Message Index

[#] Next page

Go to full version