Author Topic: Holy Moly! Species Classification Idea that Just Hit Me.  (Read 7064 times)

Offline rwill128

  • Bot Builder
  • **
  • Posts: 67
    • View Profile
Holy Moly! Species Classification Idea that Just Hit Me.
« on: May 13, 2013, 01:26:58 PM »
Okay, I'd really like your feedback, but I will issue the disclaimer that I'm using this post more as a brain-dump/note-taking device than anything else. And I might be repeating other people's ideas here -- I certainly haven't read through all the posts on this issue.

I was thinking of nifty ways to classify species in DB, as part of graphing and record-keeping efforts but also to facilitate the possibility of sexual reproduction.

Here are some criteria that occur to me:

1. In order for two organisms to be of the same species, their DNA needs to be relatively similar in length. Off the top of my head, plus or minus 10% of their total DNA seems like a nice starting point for an arbitrary limit.

2. To create a rough taxonomy of sorts, we could compare their genes, and note which are roughly similar. (Which have ~90% of their commands in common, or have identical strings of commands that are long enough to be a significant sign of species similarity?)

OR

if we wanted to allow for mating between members of a species even if one is carrying a lot of junk DNA, has experienced a significant mutation, etc. we could only look for similar code surrounding certain commands, such as feeding or repro commands. That would allow for creatures that reproduce in similar ways to meet each other, while also allowing for significant differences in DNA composition elsewhere, which would be cool for allowing things like sexual differentiation, etc.

-----

Also, by writing this down, I realize, the more I think about these issues, the more questions I have. As a general design principle, to what extent do we want the features of real-life biology to be supported directly by the framework of the genes, and to what extent do we want the features of real-life biology to arise out of the genetic code?

An example (one of many) would be ... age-related growth stages. We could continue with the current, rather minimalist approach, where a creature would only ever change its behavior according the time it had been alive if it happened to have a code segment hidden behind an if age > X condition.

Or we could have one parameter of all organisms' DNA be an array of the organism's current genes, each gene paired with a variable that helps decide when they turn on. It's an artificial way of achieving age-related growth/behavior changes, but by providing a structure for such age-related behavior, you're allowing for more complex, more interesting bot behavior right off the bat.

---

Another example would be having a low food, medium food, high status variable (one that switches at various levels of bot energy -- these levels being subject to mutation) as a built-in part of every organism and it's genetic code.

The genetic code might be regulated so that each gene can have a low food, medium food, or high food tag -- or no tag at all -- at the beginning of the gene. The tag is a signal to the interpreting engine that this code should only be run when the appropriate status is in effect. And the mutation engine is smart, allowing mutations to modify these tags, remove them, or place them in the right position.

---

I know these methods (or similar ones -- these are just examples) might seem like artificial attempts to impose order on something that we think of as random and chaotic, but the facts might be different. There's a lot of evidence (from what I've read) that suggests, for example, that our genes can be turned on and off by environmental factors, by our behaviors, by our age, etc.

It would also be interesting to research whether different parts of our genetic code are subject to higher or lower rates of mutation depending on factors such as how often they are read, etc.

---

Also, here's a kid's video on youtube about biology that actually is pretty interesting. If you watch the last part about an experiment done with a fruit fly and a mouse's genetic code for producing an eye, you'll get an idea of another subject I'm curious about.

If we want to simulate an environment that supports organisms with great complexity and, well, interesting behavior, might it not be a good strategy to pre-structure the genetic code in such a way that all organisms, for example, are asked -- essentially -- "How do you make eyes?" An organism's "eye code" section could be blank, extravagant, or anything in between, but we gear the code's mutation engine so that eye-related commands appear exclusively in this section.

We could also have every organism posses a built-in section of code for building a body, and a special subset of commands that are only available in this section of code, these commands telling how to build a body. Another section of code might be all movement-related, etc.

I know this is a lot different than what DB does now, in some ways, but I'm just thinking that if we want to simulate more complex organisms, we have to provide some built-in avenues for structured behavior to arise. Anyway, please don't take my suggestions as criticisms.. I'm just curious what other people think.

That's my brain dump.
« Last Edit: May 13, 2013, 02:04:14 PM by rwill128 »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #1 on: May 13, 2013, 03:14:10 PM »
For tracking similar species, it probably makes sense to do a most recent common ancestor.  We can store the complete ancestor tree without much effort, and then it shouldn't be very expensive to determine how many generations back you have to go to find a common ancenstor.  This works well for both asexual and sexual reproduction.

For sexual reproduction, chromosomal crossover works just as well in the computer as in real life.  It's actually a fairly elegant algorithm.  Basically you do something like a greedy search to match homologous sequences in either strand together, and then "crossover" the strands at random points where they're fused together.  If the strands don't share enough DNA there won't be many points to do crossovers and the resulting strands won't be very well shuffled.  At the extreme you'd just get back one strand or the other without any mixing, defeating the purpose of sexual reproduction entirely.

Because of sexual reproduction and things like viruses, we might need to track ancestry of blocks of DNA instead of whole organisms.

...

I'm trying to avoid adding arbitrary things to the simulation to enforce a real world biology.  But I like the idea of adding elements with emergent behavior that mimics real life biology.  The idea of chloroplasts is a good example.  Instead of granting certain bots free nrg arbitrarily, bots can build substances that generate nrg.  These substances are large and heavy, which encourages plants to be sessile without preventing bots that can photosynthesize and hunt at the same time if they really want.

For controlling growth stages, the new DNA will eventually have "codules", which are basically sub functions that aren't allowed to recurse.  At a top level you could have something like:

*age 100 <
juvenile call
*age 10 <
birth call
*age 100 >=
adult call

where 'juvenile', 'birth', and 'adult' are functions that can call other functions, like in a normal computer program.

...

I don't want to give bots hints as to high level concepts like 'high' 'medium' and 'low' energy levels.  Rather, they get a simple numeric feedback for nrg and fat and other substances, and it's up to them to decide how they want to interpret that data.  The DNA has branching, so it's just a matter of bots deciding what they want to branch on.

Since there's no high level constructs in the DNA code, clever things that evolve are all the more impressive.

...

The mechanisms of DNA transcription in real biology is actually pretty cool.  Basically the DNA is transcibed to RNA, which can be used multiple times in building proteins.  Since the DNA is protected inside the nucleus and only read sparingly, the wear and tear it experiences is minimized.  RNA floats freely in the cytoplasm and gets degraded fairly quickly.  But since the cell is set up to transcribe any RNA floating around in the cytoplasm things like viruses can inject their own RNA in to the cell and the cell will start building proteins from the instructions it contains.

...

I was playing with the idea of separate eye code actually, but more because the DNA doesn't support loops, and I want bots to be able to loop over everything they can see.

However there's a certain elegance to just having a flat DNA program that can read and write all the data available to the organism from anywhere in code, so I might abandon the dedicated eye code idea.

I definitely want bots to be able to construct additional eyes or whatever whenever they want.  In unicellular biology, cells are just created by a mother cell splitting in half.  There's nothing special about the splitting beyond the need for the cell to build up enough components to support two daughter cells before it splits.  For developmental biology in multicellular creatures it's more complex, but that's because it involves lots of cells working in a coordinated fashion.  That falls more under multibot territory.  In real biology the cells basically have a switch-case built to their DNA in based on past specializations and incoming chemical signals.  I don't think we'll have chemical signals, but there should be other ways for bots to communicate with other bots in the near vicinity.  Then it's just a matter of building up the mechanisms for bots to form large articulated constructions.

I don't want to impose a rigid architecture to the DNA code.  But there's nothing that says you can only run with zerobots.  You could start with a simple organism that has a specific architecture and let it evolve from that.  I might let you do something like set per codule mutation rates.  So you could disable mutations at the "main" codule, and allow mutations in sub codules.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #2 on: May 13, 2013, 03:46:09 PM »
Well to start with: I have a pretty good algorithm I built into DB2 for a crossover however it is not based on chromosomal. I am going beta with this by the end of the week (cross fingers).

Here is how it works:

Lets say the two sequences are

Code: [Select]
abc1234defghijklm90nopq

and

Code: [Select]
abc5678defghijklmnopq

The possible results are:

Code: [Select]
abc1234defghijklm90nopq
abc5678defghijklm90nopq
abc1234defghijklmnopq
abc5678defghijklmnopq


  Btw, Numsgil how is 'chromosmal' part different from the algo. you wanted me to code into DB2 (above)?



I have been playing around in my mind how to force speciation in an evo. sim. I am looking at figuring out genetic distance between robots and selecting the most unique robots for the next run. Don't know if I ever get to code it though.
« Last Edit: May 13, 2013, 03:58:08 PM by Botsareus »

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #3 on: May 13, 2013, 04:12:30 PM »
Chromosomes would basically be defined in the dna. Each chromosome would have one or multiple genes. Old bots don't have chromosomes, don't know if putting it in would do much good.

I think a good way for specialization would be different energy sources. And that those sources can't be used by the same bot.

Like chloroplast that creates bots that move less. So it can't hunt other bots.
Like a bot that can feed on shapes while feeding on other bots is less effective.
A bot that doesn't have the earlier disadvantages, so it can hunt the alge and the shape eater.
« Last Edit: May 13, 2013, 04:15:09 PM by Peter »
Oh my god, who the hell cares.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #4 on: May 13, 2013, 04:29:12 PM »
Btw, Numsgil how is 'chromosmal' part different from the algo. you wanted me to code into DB2 (above)?

Same thing basically.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #5 on: May 13, 2013, 08:57:46 PM »
Like a bot that can feed on shapes while feeding on other bots is less effective.

I'm currently thinking that the stuff shapes are made out of is like protein: an important raw material for building stuff, but little metabolic reward for decomposing.  And it can be synthesized from scratch, but it's expensive to do that.

So for example: maybe a bot "eating" its weight in shape could digest it for 10 nrg.  A veggy with a similar amount of shape in its gut could use it to build chloroplasts for, say, 1000 nrg, that give back 1 nrg/cycle.  And a similar amount of shape could be built from scratch using, say, 10K nrg.  An animal bots need the shape to build shell, connective material for multibots, etc.  The numbers probably have to be tweaked, but that gives you a rough idea.  There might also be different kinds of shape: one like protein and one like metals.  The metals wouldn't give you nrg but also couldn't be constructed, so they'd be conserved in a sim and could be used as a limiting factor.

I'm also playing with the idea of "muscles", which set the max rate of various activities.  So you'd have "shape digesting" muscles that you'd have to build to digest shape.  Sort of like how chloroplasts let you "digest" sunlight.  So a bot can build, say, 10 units of "shape digesting" muscles for 100 nrg, that would let it extract 1 nrg/cycle from shape, assuming it can find a constant supply.  If it builds 20 units of shape digesting muscle, it can extract 2 nrg/cycle from shape, but it burns through 2x the amount of shape per cycle, so it needs a much larger supply.  The benefit to specializing in this case is just the cost in time and nrg to build the muscles necessary to digest everything.  Hopefully it makes sense for some bots to just specialize in digesting "fat" and let shape fall to the bottom of the sim, where bottom feeders can feed on it, for instance.

There's a lot of specifics still to work out, but that's the sort of thing I'm going for.  There's nothing that says a bot can't do X and Y, or sets up arbitrary negative consequences if it does.  Instead, it's a matter of opportunity costs.

Offline rwill128

  • Bot Builder
  • **
  • Posts: 67
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #6 on: May 14, 2013, 01:36:36 PM »
Also, wouldn't it be cool to have a section of genetic code that described the size and configuration of each bot's "brain"? It could contain code for a small neural net, the parameters and initial configuration of which could be subject to mutation.

Of course.. that'd require a lot of computational power. But it would be cool.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #7 on: May 14, 2013, 02:02:39 PM »
I have a poor understanding of neural nets. But I do know they are not compatible with the style of coding used by the DB engine. I think we will need to add some recursion if we want to implement this directly.

On the other hand, if this code only describes how the net is formed then this may actually work.

In any case it is very much work

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #8 on: May 14, 2013, 02:34:01 PM »
You could implement a neural net in the DB programming language.  The weights would be stored in the bots' memory.  See NNTestBot, for instance.  Again, if you set the DNA to not mutate, you could enforce the structure and bots would have to adapt by changing weights, etc.

[tirade]
There's nothing all that special about neural nets.  They're just basically approximation functions.  They "train" on some known data points (inputs/outputs) and try to build an approximating function in its hidden layer.  Most of the hype around them is the fact that they have the word "neural" in their name.  If they were called "feedforward approximating systems" or something like that they wouldn't seem nearly so sexy.  They're more or less glorified splines.
[/tirade]

Offline rwill128

  • Bot Builder
  • **
  • Posts: 67
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #9 on: May 14, 2013, 04:16:46 PM »
You're right that you could implement them in the code. It's just that when you do that the entire system is subject to mutations that are likely to break the code.

I was thinking of a system that allows variables in the genetic code that would affect various behaviors of the bot to be subject to the training you mention, rather than simply being static.

That way you've got evolution affecting the structure and logic of the code for each bot, with the neural nets adjusting behavior within an individual bots' lifetime.

You could implement that with DB code, but I was thinking more of a system that allows all DB bots to not only evolve but -- within some significant limitations, granted -- adjust their behavior during their own lifetimes.

----

Maybe neural nets aren't the best tool for that, but maybe they are, I'm not sure. I just like the idea of each bot having a brain -- the framework of which is set by genetic code.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #10 on: May 14, 2013, 04:28:29 PM »
Quote
If they were called "feedforward approximating systems" or something like that they wouldn't seem nearly so sexy. 

But I thought the difference was that all 'neurons' on a specific given layer all fire at the same time...
Then again, they can fire one by one and then the result can be computed together. Ok, I think it makes more sense now.

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #11 on: May 14, 2013, 04:53:54 PM »
I think neural nets take too much CPU to have much benefit.
Oh my god, who the hell cares.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #12 on: May 14, 2013, 05:05:48 PM »
Quote
I think neural nets take too much CPU to have much benefit.

Tell that to the the 'Blue Brain Project' guys and don't forget to mention OpenCog.  :)

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #13 on: May 14, 2013, 05:38:59 PM »
Quote
I think neural nets take too much CPU to have much benefit.

Tell that to the the 'Blue Brain Project' guys and don't forget to mention OpenCog.  :)
I meant in relation with DB3 :P
Neural nets are in most cases too CPU intensive to be a good solution. But yea that is bound to change in the future.

Seems OpenCog wants to make a AGI in 2021. Feels like science fiction, hello Skynet. I wonder how that would change the world if they manage to do it.
Oh my god, who the hell cares.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Holy Moly! Species Classification Idea that Just Hit Me.
« Reply #14 on: May 14, 2013, 06:51:31 PM »
It is not that different then my DB2 experiments really. Only in my experiments the computer generated AGI is bound by the (simpler) rules of the program and not the rules of real life.