Author Topic: A little evolution for everyone!  (Read 19139 times)

Offline Greven

  • Bot Destroyer
  • ***
  • Posts: 345
    • View Profile
A little evolution for everyone!
« on: June 21, 2005, 11:17:18 AM »
Following my recent "succes" with mutating bots, I began some extensive experiments, this is far from finished, and I like anybody to help out here, but check this out:

I wanted to make some experiments and find some answers:
  • What mutation rate is best?
  • Which sim size is best? (Not finished yet)
  • Is conspecies gene essentiel?
My start bot were in all sims PY simplebot, without the conspecies gene.

OBS! OBS!
I have not analyzed the evolved bots, and thus I dont know why they are better than its ancestor, if anyone would like to help me out with this one..????

[span style=\'font-size:14pt;line-height:100%\'][you]Mutation rates[/you][/span]
Okay I wanted to check if low mutation rates truely were so bad for evolution in Darwinbots. Becuase DB is not truely based on real life, mutations aint nesessary bad, and I want to confirm my hypothesis with evidence, thus making it theory.
A bad mutation may decrease the fitness in the individual in short time, but if a possibly new mutation combined with the old bad one my give an increase in fitness, and therefore a bad mutation is not always deadly in the long term.

I made 4 experiments:
2 with mutation 1500, one with timer number and one with a set seed value.
2 with mutation 5000, same as above

All with sim size 5, 5 nrg/cycle/veggie, waste threshold 50, Max Vegs 100, Friction 1.0, unblocked veggies and anything else as normal.

My evidence is the following: (you are welcome to retry these)
Mutations with 5000 are to slow, if you have a super massively parellel computer and you are able to simulate millions of bots a time, this might be the best setting, but we only have at max 3.4-4.0 GHz.

Evolve bot from orignal, in 1500 mutation mode.
Code: [Select]
cond  
*.eye3  *.eye8  >
start  
div  *413  *720  sub  rnd  *413  *720  rnd  *581  746  *332  store  
*840  inc -25  .aimdx  store  
sub  mult  add
stop

cond  
*.eye7  *.eye5  >
start  
*954  25  .aimdx  store
stop

cond  
*.ploc  0  >  
*.ploc  0  >  
*.in1  0  >  
*.veldx -1  <  
*.aim  0  >
start
-2069  *587  *136 -56  rnd  *136 -56  div  
rnd  2092  rnd  *136 -56  rnd  *.veldx  427  
516  2  div  921  201  *56  dec  mult  *.eye5  
sub  *976  mult  div  *.eye5  sub  sub  *.maxvel  *782  
div  *.in1  482  rnd  *.pwaste  200  add  rnd -39  1431  div  
rnd  dec  *344  *.shoot  add -40 -773 -646  dec -773 -647  dec  store  
1790  dec  div  510 -640 -580  201 -962  *157  8
stop

cond  
*.veldx  0  !%=  
*.veldx  0  !%=  
*.sharewaste  0  !=
start  
*.memloc  rnd  *.fixlen  *.veldx  2  rnd  *.trefage  mult  200  add  mult  dec  store  
mult  *264  dec  store  
div  sub  *25  dec -1142  *170  551  *100  sub  *.myshoot  rnd  sub  *.myshoot  rnd  
214  789  add  *863  .nrg  store  
789  add  .trefvelmydn  store -144  92  dec -439  936  *636  *.reftie  *565  mult  inc  
*170  dec  sub  *344  107  add  rnd  107  div  add  rnd  sub  dec -40  store
-40  store
-40  store
-775  1839  dec  *.setboy  7 -237
stop

cond
start  
5  1501  1321  mult  rnd  .up  store  
1531  inc -147
stop

cond  
*.eye5  41  >
start  
916  rnd  rnd -1  add  7  *374  878  rnd  
*854 -40  *514  *.refsx -690  *.fdbody  *417  store  
rnd  store  
dec  mult -1  .shoot  store  
add
stop

cond  
*.nrg  5000  =
start  
*260  1158  50  *.tieloc  inc  140 -1117  *975  .slime  store
stop

cond  
*.nrg  5100  >
start  
50  300  store
stop

end
(Evolved bot 1)

After the experiments were finished (around 1 million cycles), I took the most abundant bots it the sims and made a F1 fight, and the above won (it were from random seed 1500 mutation sim).

I then took this one and made a F1 fight against the original bot, and it won by 5-0.

[span style=\'font-size:14pt;line-height:100%\'][you]Conspecies[/you][/span]

This table shows want the F1 fight turned out:

                       Original bot   EBot 1     EBot 2
Original bot            NA            0-5          0-5
Evolved bot 1         5-0           NA           0-5
Evolved bot 2         5-0           5-0           NA

All bots did lose 5-0 to their conspecies-cousins.

But interesting enough did EBot 1 win 5-0 against OBot w/conspecies.
And EBot 2 did likewise.

I have yet to test EBot 1 and EBot 2 with and without the conspecies against each other.

Actually I think the evolved bots is behaving much better than the original!

Hope you have any comments....


The evolved bot 2, were evolved in a new sim with the same 1500 mutation conditions.

(Evolved bot 2)
Code: [Select]
cond
*.eye3  *.eye8  >
start  
*568  store  
div  *568  store  
div  *413  *720  sub  rnd  *720  sub  rnd  *.poison  *720  rnd  *581  746  *332  store  
dec  *840  store
-25  .aimdx  store
-25  5  rnd  store  store  
*416  mult  inc  add
stop

cond  
*.eye7  *.eye1  >
start  
*954  25  add  .aimdx  store
stop

cond  
*.ploc  0  >  
*.in1  0  >  
*.mydx -1  <
start
-2070  *.dnalen  *.refveldn -56  *240  rnd  rnd  *136  381 -1193 -56  sub  
rnd -56  div  rnd  2092 -132  *742  dec  store  
*136 -56  rnd  *.veldx  427  mult  dec  *162  801  516  2  div  914  201  
*56  *535  sub  dec  *917  mult  dec  *917  mult  rnd  *.eye5  sub  *940  mult  
*.eye5  sub  *976  dec  mult  div  *.eye5  sub  mult  rnd  *.aimsx  *17  *782  div  
*.in1  492  rnd -122  *.mass  200  add  rnd -40  1431  div  rnd  sub  rnd  *.tmemval  
*.shoot  add  mult  *.shoot  add  mult -40 -773  div  529  store
-646  dec -186 -773 -647 dec  dec  454  23  store
-647  dec  store  
div  dec  store  
div  dec  store  
div  327  1783  dec  div  dec  524 -640 -580  201 -962  *157  rnd  sub  8
stop

cond  
*.veldx  0  !%=  
*.sharewaste  0  !=
start  
*.memloc  rnd  *.memloc  *924  rnd  *.fixlen  *.veldx  .dn  store  
*.trefvelyourdx  mult  div  dec  inc  200  div  mult  *.mysx  dec  store  
mult  *264  dec  1725  store  
sub  1725  store  
sub  rnd  store
stop

cond
start  
5  1501  1321  mult  rnd  1321  mult  rnd  .up  store  
1531  inc -147
stop

cond  
*.eye5  41  >  
*.eye5  41  >
start  
916  add -347  rnd  rnd  mult -1  64  add  7  259  *374  878  rnd  *854  40  store  
*514  *.refsx  add -690  inc  *.fdbody -35  *417  div  store  
rnd  store  
dec  mult -1  .shoot  store
-1577  div  add
stop

cond  
*.nrg  5000  =
start  
*260  div  *368  1158  50  *.tieloc  add  140 -1115  *975  store  
821  mult  821  dec  mult  div  mult  store  
div  store  
*.mkshell  *353
stop

cond  
*.nrg  5100  >
start  
50  .repro  store
stop

end
« Last Edit: June 21, 2005, 11:19:33 AM by Greven »
10010011000001110111110100111011001101100100000110110111000011101011110010110000
011000011000001100010110010111101001110100110010111100101000001000001111001011101
001101001110011011010011100011110100111000011101100100000100110011010011100110110
010110000011100111101001110110111101011101100110000111101001101001110111111011101
01100100000111010011010001100001110111010000010001001000010100001

Offline Greven

  • Bot Destroyer
  • ***
  • Posts: 345
    • View Profile
A little evolution for everyone!
« Reply #1 on: June 21, 2005, 11:27:11 AM »
I did actually evolved yet another bot, with over [span style=\'font-size:21pt;line-height:100%\']4000[/span] DNA commands! Can this be true? Didnt count them? But this were of course a way for evolution to stop the deletious mutations, because I did set them really high, around 500 and the rest 2500, to check if deletion were so bad, and with an increase by a factor of 10 in the DNA, must indicate that they are. The bot itself were not better than the ancestor.

I have attached the bot.
10010011000001110111110100111011001101100100000110110111000011101011110010110000
011000011000001100010110010111101001110100110010111100101000001000001111001011101
001101001110011011010011100011110100111000011101100100000100110011010011100110110
010110000011100111101001110110111101011101100110000111101001101001110111111011101
01100100000111010011010001100001110111010000010001001000010100001

Offline Greven

  • Bot Destroyer
  • ***
  • Posts: 345
    • View Profile
A little evolution for everyone!
« Reply #2 on: June 21, 2005, 11:31:30 AM »
I actually think we need alot more experiments to see if DB is heading in the right way and to confirm DB as a science tool for artifical lifer.

Also make some specific experiments, to test whatever a newer version of DB is better than or equal the older (which it always should be), but we need some serious thoughts on this one!
« Last Edit: June 21, 2005, 11:32:03 AM by Greven »
10010011000001110111110100111011001101100100000110110111000011101011110010110000
011000011000001100010110010111101001110100110010111100101000001000001111001011101
001101001110011011010011100011110100111000011101100100000100110011010011100110110
010110000011100111101001110110111101011101100110000111101001101001110111111011101
01100100000111010011010001100001110111010000010001001000010100001

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
A little evolution for everyone!
« Reply #3 on: June 21, 2005, 12:27:04 PM »
A couple of comments on your experiment with mutation rates:

1.  Mutation rates are expressed as 1 in X chance per bp, so quite obviously mutation rates are "high" or "low" depending on the length of the genome, which itself is a function of the mutation rates and time.

2.  Comparing two species in a F1 battle to the death doesn't give you any clues as to how well each species adapted to its environment (that is, how strong the Darwinian evolution was).

Imagine if aliens came today, picked the most successful human, and made him (or her) battle to the death with father Adam in the Garden of Eden.  I think you see my point.

Natural selection is only selecting against what the world currently is.  That is, you only have to compete against the previous one to three generations.

A better way perhaps is to measure the total energy in the system.  It seems to me the better adapted an ecosystem is to its physical environment, the more efficient it becomes, and so the higher the vested energy will be in the system.  (That's a supposition that may or may not be true, shvarz might know better than I).

Currently there isn't really a way to measure this though.  (Maybe through snapshot?)  And also, since there needs to be a veg cap for practicality, that could complicate matters.  When vegs evolve the .aimdx rnd store thing, they become more fit, but the total energy of the system decreases as the bots die and the vegs can't reproduce to fill in the gap.

3.  You need to collect more data points.  I would collect information on the bots at 5000, 50000, 500000, and 1 million cycles.  I would also try mutations rates of all 5s (not practical, it slows the simulation down to a crawl), 50, 500, 5000, 50000, and 0 (for a control.  I know, nothing will happen.  But that's how a good experiment is run).

4.  Only using 1 bot means your results are of limited proof.  I would use at least a few bots.  Perhaps my cannibot Comesum, Dominator Invicibalis, PY's simple bot, and shvarz's evolved Dom.  That gives you a broad spectrum of bot types to try with.

5.  Since you're testing the mutation rates, be sure to set the rate of change of mutation rates to 0.
« Last Edit: June 21, 2005, 12:29:29 PM by Numsgil »

Offline Carlo

  • Bot Destroyer
  • ***
  • Posts: 122
    • View Profile
A little evolution for everyone!
« Reply #4 on: June 21, 2005, 12:50:56 PM »
Quote
2.  Comparing two species in a F1 battle to the death doesn't give you any clues as to how well each species adapted to its environment (that is, how strong the Darwinian evolution was).

I understand you point, but that's not completely true. Bots adapt to the environment, which is made of, say, the physics settings AND the other bots; however, you can suppose that, except from particular cases, most of the adaptation is towards the physical environment. Otherwise, you'd not understand why the evolved robot "does better" against the unevolved version and not vice-versa: both are unadapted to the other, since the evolved should be adapted, as you noted, only to two-three generations before.

Quote
Imagine if aliens came today, picked the most successful human, and made him (or her) battle to the death with father Adam in the Garden of Eden.  I think you see my point.

No, that's wrong. Humans have a great variability, so you can take very successful humans and suppose that they have something tha makes them so successful. But robots are much simpler, their behaviour is totally determined by the dna (and they have no sexual reproduction, so no dna remixing) so thata  successful robot is successful either by pure chance or because it is, alone, a new species, in the sense that it has some important mutation.

Quote
5.  Since you're testing the mutation rates, be sure to set the rate of change of mutation rates to 0.

Why instead, as I suggested, don't you try to run a looong simulation with mutrate of mutrates at 1 or so, so to evolve the best mutation rates?

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
A little evolution for everyone!
« Reply #5 on: June 21, 2005, 01:23:03 PM »
Quote
Bots adapt to the environment, which is made of, say, the physics settings AND the other bots; however, you can suppose that, except from particular cases, most of the adaptation is towards the physical environment.

That's an assumption that hasn't been really tested.  And in a good scientific experiment, you want to isolate all other possible variables except the one you're testing.

You may be right, you may be wrong.  No one has really devised an experiment to decide one way or another.  So you have to assume that bots do adapt against each other and plan your experiment accordingly.

For an informal study, you're welcome to make such an assumption, but my critiques are all on the methodology.  I'm trying to think and comment the same way scientists do to each others' papers.

Quote
No, that's wrong. Humans have a great variability, so you can take very successful humans and suppose that they have something tha makes them so successful. But robots are much simpler, their behaviour is totally determined by the dna (and they have no sexual reproduction, so no dna remixing) so thata  successful robot is successful either by pure chance or because it is, alone, a new species, in the sense that it has some important mutation.

True, true, the analogy isn't perfect.  But what makes a human successful today and what made a human successful 10000 years ago are very different (or somewhat different, some things never change).  Humans haven't really had a chance to adapt in that time, but imagine they have.  A successful human 10000 years ago was a good hunter, or perhaps a good farmer (was agriculture arouynd 10K years ago?).  A successful human today is probably very good at finances, perhaps at diplomacy and "playing the game".

Again, a good study isolates all but the variable you're testing.

Quote
Why instead, as I suggested, don't you try to run a looong simulation with mutrate of mutrates at 1 or so, so to evolve the best mutation rates?

That would be an interesting experiment too.  But you'd probably need to run the sim longer.  Maybe like 10 000 000 cycles?

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
A little evolution for everyone!
« Reply #6 on: June 21, 2005, 01:26:34 PM »
It is a good idea to run these kinds of experiments, although interpretation may be a problem as we can see already :)

As Nums mentioned, you need to express mutation rates as N/command.  You also need to keep track of your average population size - the bigger the population, the higher mutation rate it can tolerate (up to some limit).

And interpretation still may be a problem...  I actually don't agree with Nums idea that putting two bots in competition does not represent their relative fitness (because they were not adapted to each other).  While it may be true, it should not have a large effect if bots are still relatively similar.  But I do agree that you need to run the same experiement at least three times and come to conclusion only if you see the same trend in all three simulations.  There is quite a lot of variability in DBs - the population is small, the environment is small, the DNA is short - this all leads to a lot of noise.

Finally:

Quote
Why instead, as I suggested, don't you try to run a looong simulation with mutrate of mutrates at 1 or so, so to evolve the best mutation rates?

This is an interesting experiment, but I have no idea what it is going to do.  My head hirts when I try to think about all the stuff that is going to be involved in that.  Thing with mutrate of mutrates is that mutrate has no advantage for current generation - it only affects the next generation and even then not directly.  In general, organisms don't want to mutate - chances of getting better after mutations are minute.  So the selection should drive to eliminate mutation rates completely.   I guess..   I may be wrong...
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline Carlo

  • Bot Destroyer
  • ***
  • Posts: 122
    • View Profile
A little evolution for everyone!
« Reply #7 on: June 21, 2005, 02:42:10 PM »
Quote
Quote
Why instead, as I suggested, don't you try to run a looong simulation with mutrate of mutrates at 1 or so, so to evolve the best mutation rates?

This is an interesting experiment, but I have no idea what it is going to do.  My head hirts when I try to think about all the stuff that is going to be involved in that.  Thing with mutrate of mutrates is that mutrate has no advantage for current generation - it only affects the next generation and even then not directly.  In general, organisms don't want to mutate - chances of getting better after mutations are minute.  So the selection should drive to eliminate mutation rates completely.   I guess..   I may be wrong...
Well, basically the mutation rates determine the probability of having an offspring more or less mutated. This simply means that they affect the probabilty of the offrspring being more or less successful. For each set of mutation rates, say that you have these three values:

a- probability for the offspring to be identical to the parent
b- probability for the offspring to be worse
c- probability to be better

Say that a realistic mutation rates set may have a=90%, b=9.98%, c=0.02%. The interest of the robot is to have a successful offrspring, so it has to maximize c while keeping a good ratio between a and b, which can be done by regulating the mutation rates set. So you can treat it like a mutation as every other: evolution will try to optimize mutation rates to give the better a, b, c ratios.

About the idea that evolution tries to eliminate mutation: it's wrong! As long as an organism has the ability to mutate, it can find some good mutation to be better than its competitors. Let's reason in terms of lions and gazelles. If evolutions succeeds in eliminating mutation in lions, gazelles, which still mutate, can always develop the ability to run faster. No lion will ever catch them again, since lions lost the ability to mutate. A gene which gives gazelles the ability to mutate is successful, because allowing the mutation of the genes for speed in the gazelle gene pool, has more probability to be passed to the faster gazelles, which survive better.
You can do this little experiment, anyway (I tried, and seemd to work - now that there are tools for leagues, should be even easier): just put in the same environment two copies of the same species, identical except for the fact that one has reasonable mutation rates, while the other one has mutations disabled. When I tried it, the species unable to mutate was usually (on average) wiped out by the other one in more or less time.
But would be really great to make the experiment seriously: that is, with tens or hundreds of tries to have precise numbers (and maybe with a good esteem of the average time for a species to take over the other one, and how this time is affected by mutation rates... ). Something may be done automatically with the tools for leagues. And maybe Shvarz knows wheter somebody would be interested in a paper on the subject  :boing:
« Last Edit: June 21, 2005, 02:43:17 PM by Carlo »

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
A little evolution for everyone!
« Reply #8 on: June 21, 2005, 02:49:47 PM »
Shvartz I run a lot of simulations with m of m set to 5 this what happens:

we start off at m of m = 5 , the rest 300

we result with 5 of 5 = 13 , the rest minimum 225 maximum 410 , the interesting thing is that in most cases the same rates get the same numbers under any seed value you provide. And that the  x in 1 / x of  rates generaly increased
« Last Edit: June 21, 2005, 02:51:13 PM by Botsareus »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
A little evolution for everyone!
« Reply #9 on: June 21, 2005, 02:59:35 PM »
I have run an F1 competition between identical copies of a species, except one had an extra eye reference comparison in an empty gene to make it look different.  After many many many rounds, the modified version won.

Which shows that even identical copies will eventually produce a winner in F1 settings.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
A little evolution for everyone!
« Reply #10 on: June 21, 2005, 03:10:18 PM »
Well there you go Num , you have indeed found the "free energy" bug.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
A little evolution for everyone!
« Reply #11 on: June 21, 2005, 03:18:36 PM »
Quote
Well there you go Num , you have indeed found the "free energy" bug.
How so?

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
A little evolution for everyone!
« Reply #12 on: June 21, 2005, 03:19:33 PM »
The Robot with the extra dna won right?

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
A little evolution for everyone!
« Reply #13 on: June 21, 2005, 03:33:03 PM »
Yes, but it's not because it was "better".  It's just that you expect any statistical test between identical copies to produce 50/50 results.  And the way F1 settings works, as the number of trials aproaches infinity, the number of wins you need decreases to about 50%.

So eventually random perturbations will produce a "winner".

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
A little evolution for everyone!
« Reply #14 on: June 21, 2005, 03:39:27 PM »
Num , try serveral F1 modes trials , how come the one with more junk dna always wins?
« Last Edit: June 21, 2005, 03:39:55 PM by Botsareus »