Darwinbots Forum

Bots and Simulations => Evolution and Internet Sharing Sims => Topic started by: Greven on June 21, 2005, 11:17:18 AM

Title: A little evolution for everyone!
Post by: Greven 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: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
Title: A little evolution for everyone!
Post by: Greven 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.
Title: A little evolution for everyone!
Post by: Greven 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!
Title: A little evolution for everyone!
Post by: Numsgil 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.
Title: A little evolution for everyone!
Post by: Carlo 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?
Title: A little evolution for everyone!
Post by: Numsgil 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?
Title: A little evolution for everyone!
Post by: shvarz 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...
Title: A little evolution for everyone!
Post by: Carlo 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:
Title: A little evolution for everyone!
Post by: Botsareus 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
Title: A little evolution for everyone!
Post by: Numsgil 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.
Title: A little evolution for everyone!
Post by: Botsareus on June 21, 2005, 03:10:18 PM
Well there you go Num , you have indeed found the "free energy" bug.
Title: A little evolution for everyone!
Post by: Numsgil on June 21, 2005, 03:18:36 PM
Quote
Well there you go Num , you have indeed found the "free energy" bug.
How so?
Title: A little evolution for everyone!
Post by: Botsareus on June 21, 2005, 03:19:33 PM
The Robot with the extra dna won right?
Title: A little evolution for everyone!
Post by: Numsgil 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".
Title: A little evolution for everyone!
Post by: Botsareus on June 21, 2005, 03:39:27 PM
Num , try serveral F1 modes trials , how come the one with more junk dna always wins?
Title: A little evolution for everyone!
Post by: Botsareus on June 21, 2005, 03:41:16 PM
But Yes I must agree that if the robots are identical F1 mode is not accurate.
Title: A little evolution for everyone!
Post by: PurpleYouko on June 21, 2005, 03:45:31 PM
Quote
So eventually random perturbations will produce a "winner".
Sure will.

I too have performed this kind of test on a number of occasions. Sometimes the modified bots win and sometimes the unmodified bots win.

In earlier versions where a bot was charged energy to replicate its DNA, this was pushed much stronger in favor of the shorter, unmodified bot but today it seems to be 50:50.

Maybe I will try a test with a bunch of empty genes added so that there is a significant difference in the DNA length. If the "free energy bug" is there in the current version then it should show up pretty quickly.
Title: A little evolution for everyone!
Post by: Botsareus on June 21, 2005, 03:51:58 PM
Try to add a bunch of useless *.aimdx add 3 sub 4 blablabla , into your "empty genes" , my robots never evolved purly "empty genes" , they never evolved any "conditions" eather exsept for the first gene were they evolved 8 almost identical conditions.
Title: A little evolution for everyone!
Post by: Numsgil on June 21, 2005, 03:51:59 PM
And just a note, be sure that you do NOT set up a random seed when you run F1 trials, or all your trials will be identical.

Very important!
Title: A little evolution for everyone!
Post by: Botsareus on June 21, 2005, 03:53:56 PM
Num , read Endys post in suggestions , it has a lot of "junky robot links" you and PY can use.
Title: A little evolution for everyone!
Post by: PurpleYouko on June 21, 2005, 04:01:00 PM
Quote
And just a note, be sure that you do NOT set up a random seed when you run F1 trials, or all your trials will be identical.

Very important!
They should only be identical if you turn of DB between trials.

Keep it running and the random seed will be different for each set.

Randomize to the timer and each new set will be unique. I know the timer resets each day but what are the chances of starting at exactly the same time on 2 occasions.
Title: A little evolution for everyone!
Post by: Numsgil on June 21, 2005, 04:02:12 PM
I mean the new toggle for "use user seed" in the general tab.  If you set it to, say, 86, and run a billion trials, all the trials will, I think, be identical.
Title: A little evolution for everyone!
Post by: PurpleYouko on June 21, 2005, 04:07:16 PM
I thought you said
Quote
do NOT set up a random seed

Did you mean to say "Do not manually enter a seed"

Just a misunderstanding I expect. Besides which I am currently using a version that doesn't have that manual seed override.  2.36.5 I believe
Title: A little evolution for everyone!
Post by: Numsgil on June 21, 2005, 04:09:30 PM
Quote
I thought you said
Quote
do NOT set up a random seed

Did you mean to say "Do not manually enter a seed"
Indeed I did.  "Do NOT set up a manual random seed, let the system use the timer", is what I should have said.
Title: A little evolution for everyone!
Post by: Carlo on June 21, 2005, 04:15:39 PM
Quote
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".
I don't see the problem. You can always calculate the significance of the final result. For example, you can calculate that, after 100 rounds, you have 99% probability of getting a ratio of wins of 1/2 +- delta when running two identical copies. I don't actually know how to make the calculation (you're the matematician), anyway it's trivial.
Title: A little evolution for everyone!
Post by: PurpleYouko on June 21, 2005, 04:23:35 PM
You have to run a whole lot more than 100 contests but your point is correct. Finding a statistically better robot shouldn't be too hard.

I am also starting to wonder whether there is an advantage to having lower robot ID numbers. (being top on the list of selected robots)

run 2 just finished with the original winning 52 to 33 contests.
In both matches the robot listed first in the robot selection box has won. (it crashed between the two sets)

They are now neck and neck with 10 wins each in set 3.
Title: A little evolution for everyone!
Post by: Numsgil on June 21, 2005, 05:14:54 PM
Quote
Quote
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".
I don't see the problem. You can always calculate the significance of the final result. For example, you can calculate that, after 100 rounds, you have 99% probability of getting a ratio of wins of 1/2 +- delta when running two identical copies. I don't actually know how to make the calculation (you're the matematician), anyway it's trivial.
Yes, but there is a subtle problem that is difficult to understand without a bit of stats background.

You have to understand what it is you're testing.  It's been a while, but I think you're testing if two supposedly events are NOT related.  When you conclude that they are not NOT related, you can't conclude that they ARE related.  Or something like that.

There are some subtle things you cannot conclude, but it's been too long and I just don't remember it all exactly.  I think this is a case of that.  I think sometimes F1 test give a false positive, but they won't give a false negative, or something like that.
Title: A little evolution for everyone!
Post by: Greven on June 22, 2005, 04:50:55 AM
But then again, I think we need some formal test of bots, to compare them. Of couse a bot evolved in a specific enviroment have a lesser fitness in another enviroment. F1 is not optimal, but it is the best around right now.  We need more experiments, but a lot of the data/information in the sim is not available to the scientist.. ;) and therefore it is very difficult to see if your have isolated a variable enough etc.
Title: A little evolution for everyone!
Post by: Greven on June 22, 2005, 05:02:51 AM
These were not perfectly precise, but if they should be we need to elimate all the overflow errors, I even got a memory dump error, almost a destruction of my physical computer :( (:)) These experminents were just fun, not at any time very serious. But I need the community's to understand we need more tests etc. purely sciencetify studies of DB, so I hope we set the fighting bots on standby, until we have made some serious work here.

I also tested 4 different bots vs. their conspecies-cousins, and all the conspeices always did win 5-0 (and I concluded I didnt needed to making more or longer trails) and if the conspecies is so important, why doesnt it evolve in the first place?

I know shvarz had a bot evolved into cannies and back to non-cannies, this is interesting enough, but I bet a lot of the coded needed to return to non-cannies already were in the genome. The conspecies gene or non-canny bots, dont need very complex DNA to avoid killing there own species, but I have yet to see this evolve! I understand why tie feeding is not evolving, because this is extremely complex, but a simple *.refeye *.myrefeye != aint very complex!
Title: A little evolution for everyone!
Post by: Greven on June 22, 2005, 05:04:48 AM
And therefore I conclude that something is very [span style=\'font-size:21pt;line-height:100%\']WRONG[/span]  :D
Title: A little evolution for everyone!
Post by: Carlo on June 22, 2005, 08:32:21 AM
Quote
You have to understand what it is you're testing.  It's been a while, but I think you're testing if two supposedly events are NOT related.  When you conclude that they are not NOT related, you can't conclude that they ARE related.  Or something like that.

There are some subtle things you cannot conclude, but it's been too long and I just don't remember it all exactly.  I think this is a case of that.  I think sometimes F1 test give a false positive, but they won't give a false negative, or something like that.
A bit of confusion here, it seems.
We're trying to know the probabilities of two _completely related_ events: that is, A wins or B wins. The events are completely related because if A wins, B loses, and vice versa. Ok? We're just tossing a coin, and counting the times we have head, and the times we have cross.

But the sequence of results (A wins, B wins, B wins, A wins, B wins, etc..) is completely unrelated, since there's no information passing from one simulation to the other, so they cannot be related.

Hence, we can apply the same methods we use to calculate whether a coin is even or uneven (fair or unfair, don't know how you say). We toss it a zillion times, and calculate the ratio of head and cross, then we calculate the probabilities, and the error range inside a probability of, say, 90% (this means: that you have 90% chances that the real ratio is inside the error delta).
Title: A little evolution for everyone!
Post by: Numsgil on June 22, 2005, 11:09:37 AM
Quote
I also tested 4 different bots vs. their conspecies-cousins, and all the conspeices always did win 5-0 (and I concluded I didnt needed to making more or longer trails) and if the conspecies is so important, why doesnt it evolve in the first place?
You have to understand that evolution works from the individual's point of view, never from the species point of view.  At least, that's the mainstream opinion in science at the moment.

So, while a species is more fit with a conspec gene, and thus able to win F1 battles, individuals that evolve to eat others of its own kind, especially when there aren't any other species around, have suddenly gained a huge advantage.

Imagine if I lock you in a room with another guy, and give you a bowl of jello every day to eat.  You both will probably be alive, but you have to share your limited resources.  If you kill and eat the other guy, you gain a huge advantage.  You get all his meat, and you get the whole bowl of jello every day.

So why aren't we all going around killing and eating each other?  Well, groups of genetically close humans tended in the past to battle, and manytimes eat (especially the heart, as part of ceremonies), other groups of non-genetically close humans.

Ants likewise often battle each other over territory, but only primitive ant species battle within the colony.

Basically, it is only advantageous to not kill close relatives because they are genetically similar to you, but to utterly decimate fourth and fifth cousins, because they aren't as likely to share your own genes.

So especially in an arena where it's only you and the plants, there's just no reason for a conspec gene.  This isn't a limitation of the simulation, it's a fact of real life.  Cooperative bacteria will evolve cheaters that steal food and eat other members if kept in isolation in a pitri dish.

Read the bot tavern's thread on Comesum, I think we discussed this a bit there.
Title: A little evolution for everyone!
Post by: Sprotiel on June 22, 2005, 12:25:41 PM
I'll try to explain a bit more:
Each contest is a Bernoulli trial (http://en.wikipedia.org/wiki/Bernoulli_trial). If we knew the probability p that bot A wins the contest, then the probability that A wins n contests out of a sequence of N would be given by the Binomial distribution (http://en.wikipedia.org/wiki/Binomial_distribution):
P(n) = C(N,n).p^n.(1-p)^{N-n}.
The maximum of this distribution is at n=pN and the variance is Np(1-p).

However, we only know the results and not the underlying probability, so we have to "invert" the binomial distribution and use Bayesian inference (http://en.wikipedia.org/wiki/Bayesian_inference). Imagine bot A won more contests than bot B, to know if this is statiscally significant, we have to compare likelihood functions, e.g. the probability of obtaining n wins under the hypothesis p=0.5 and the probability of obtaining n wins under the hypothesis p=n/N. If we have reasons to think that the bots are equivalent, we should probably only revise this assessment if the ratio of the likelihoods exceeds 100. Thus, a 5-0 win could be considered barely significant (ratio: 32) while a 4-1 win isn't (ratio: 2.6).
Title: A little evolution for everyone!
Post by: Numsgil on June 22, 2005, 12:28:52 PM
Quote
I'll try to explain a bit more:
Each contest is a Bernoulli trial (http://en.wikipedia.org/wiki/Bernoulli_trial). If we knew the probability p that bot A wins the contest, then the probability that A wins n contests out of a sequence of N would be given by the Binomial distribution (http://en.wikipedia.org/wiki/Binomial_distribution):
P(n) = C(N,n).p^n.(1-p)^{N-n}.
The maximum of this distribution is at n=pN and the variance is Np(1-p).

However, we only know the results and not the underlying probability, so we have to "invert" the binomial distribution and use Bayesian inference (http://en.wikipedia.org/wiki/Bayesian_inference). Imagine bot A won more contests than bot B, to know if this is statiscally significant, we have to compare likelihood functions, e.g. the probability of obtaining n wins under the hypothesis p=0.5 and the probability of obtaining n wins under the hypothesis p=n/N. If we have reasons to think that the bots are equivalent, we should probably only revise this assessment if the ratio of the likelihoods exceeds 100. Thus, a 5-0 win could be considered barely significant (ratio: 32) while a 4-1 win isn't (ratio: 2.6).
That sounds familiar.  I think that's what I was trying to say.  It's been 2.5 years since I even touched stats.
Title: A little evolution for everyone!
Post by: Sprotiel on June 22, 2005, 12:49:48 PM
Quote
Quote
I also tested 4 different bots vs. their conspecies-cousins, and all the conspeices always did win 5-0 (and I concluded I didnt needed to making more or longer trails) and if the conspecies is so important, why doesnt it evolve in the first place?
You have to understand that evolution works from the individual's point of view, never from the species point of view.  At least, that's the mainstream opinion in science at the moment.

So, while a species is more fit with a conspec gene, and thus able to win F1 battles, individuals that evolve to eat others of its own kind, especially when there aren't any other species around, have suddenly gained a huge advantage.
 
This isn't exactly true. Parthogenesis is a counter-example. Lizards have a tendency to become parthogenetic, however all species that become parthogenetic get extinct in a few tens of thousands of years. What happens is that this mutation is beneficial in the short term, but fatal in the long run since it decreases hugely the adaptability of the species.

OK, it's perhaps not relevant for DB since there's no mechanism to exchange genes between members of a species. Actually, I wonder if the concept of species itself is relevant for DB, for the same reasons.
Title: A little evolution for everyone!
Post by: Numsgil on June 22, 2005, 01:04:21 PM
Quote
Quote
Quote
I also tested 4 different bots vs. their conspecies-cousins, and all the conspeices always did win 5-0 (and I concluded I didnt needed to making more or longer trails) and if the conspecies is so important, why doesnt it evolve in the first place?
You have to understand that evolution works from the individual's point of view, never from the species point of view.  At least, that's the mainstream opinion in science at the moment.

So, while a species is more fit with a conspec gene, and thus able to win F1 battles, individuals that evolve to eat others of its own kind, especially when there aren't any other species around, have suddenly gained a huge advantage.
 
This isn't exactly true. Parthogenesis is a counter-example. Lizards have a tendency to become parthogenetic, however all species that become parthogenetic get extinct in a few tens of thousands of years. What happens is that this mutation is beneficial in the short term, but fatal in the long run since it decreases hugely the adaptability of the species.

OK, it's perhaps not relevant for DB since there's no mechanism to exchange genes between members of a species. Actually, I wonder if the concept of species itself is relevant for DB, for the same reasons.
But if you are the only species in existance, you have incentive to become a cannibot because it's an unexploited niche.

Think about it, the very first cells didn't eat each other.  But once some of them figured out how to, they became successful, and gave rise to every living animal on the planet.

Bots evolve cannibalism because it's an open niche.  But in F1 competition, it's not an open niche, which again shows that using F1 as a measure of the increase in fitness of a species is faulty.

The advent of cannibalism does not necessarily make a species less fit when it is alone (it's simply the bots evolving to fill unfilled niches), but it does make it less fit if there is another species it's battling.
Title: A little evolution for everyone!
Post by: Sprotiel on June 23, 2005, 08:02:04 AM
Back on topic!

I analyzed Greven's Bot 1 and it should do almost the same as
Code: [Select]
cond  
*.eye3  *.eye8  >
start
  -25  .aimdx  store  
stop

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

cond
start  
  32000  rnd  .up  store  
stop

cond  
*.eye5  41  >
start
  -1  .shoot  store
stop

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

end

I tried to test it and indeed both perform the same: they die so fast that I don't even have time to pause the simulation! Greven, which version did you use? My guess is that it's one from before the MAJOR change to stack behaviour.
Title: A little evolution for everyone!
Post by: Greven on June 23, 2005, 09:33:54 AM
I have used the new 2.37.2! If this is what you get when analyzed Sprotiel, this is indeed very interesting, because it actually show that the bot indeed did not evolve very much! As I have stated before this explosion in DNA lenght may be because of the deletious mutations are destructive, as stated by Num, and therefore evolution will work against these by increasing the DNA lenght, because when the DNA is longer it is less likely to get messed up when a delete mutation occures.

And regarding Num: Num I think I understand now, you dont have to cut it entirely down into pieces. But I welcome open discussions on this, we need more EXPERIMENTS to validate DB. I understand we there is low energy, often a species eats its own members, like in real life, but because DB is so simple and the bots behavior is determined by direct DNA encoding, the bots dont have the ability to decide to eat or not to eat its own family members. But dont begin to compare humans with animals. Indeed we are animals, but we can think abstract, the animals only live by insticts (okay very simple but you know what I mean).
Title: A little evolution for everyone!
Post by: Ulciscor on June 23, 2005, 09:37:25 AM
Maybe a bit off topic sorry but is there a sort of optimum DNA length so that mutations are not catastrophic yet lots of pointless operations are not carried out? Could it be found by letting lots of bots mutate for a while then averaging the DNA length of each of them?
Title: A little evolution for everyone!
Post by: PurpleYouko on June 23, 2005, 10:27:29 AM
Quote
Maybe a bit off topic sorry but is there a sort of optimum DNA length so that mutations are not catastrophic yet lots of pointless operations are not carried out? Could it be found by letting lots of bots mutate for a while then averaging the DNA length of each of them?
Probably wouldn't work since the longer you run the sim, the longer the DNA length seems to get.
In short there are more additions than subtractions in the DNA mutater.

The way it mutates is by running through the entire DNA one entry at a time and applying a random flagging event for each one.

example:
with mutation level (any one take your pick) set to 1, the random number is from 1 to 1 so it is always 1 so every entry is mutated.
with mutation set to 1000, the random number is from 1 to 1000 but a mutation only occurs when the number is 1 so on average, every 1000th entry will be mutated.

A longer DNA will always result in more overall mutations but the ratio of mutations/DNA length will remain constant
Title: A little evolution for everyone!
Post by: Ulciscor on June 23, 2005, 10:30:55 AM
I was just assuming that a bot with more pointless additions to its genome would be less likely to survive that a bot with a long but more streamlined genome.
Title: A little evolution for everyone!
Post by: PurpleYouko on June 23, 2005, 10:47:24 AM
Possibly but I don't think so.

Right now I am still trying to determine if DNA length has any effect whatsoever on the "fitness" of a robot. I strongly suspect that pointless "junk" DNA has absolutely no effect at all
Title: A little evolution for everyone!
Post by: Greven on June 23, 2005, 10:52:00 AM
PY this is a very important one! Whatever junk DNA has an influence on the overall fitness of the bot! Because it shouldnt have, but if it has then it is a bug or it is not junk DNA  :P
Title: A little evolution for everyone!
Post by: Greven on June 23, 2005, 10:53:37 AM
But then again, in reallife we do still not understand the concept of junk DNA entirely, it seems to have no function whatsoever, but it actually may have some influence on the execution and translation on the DNA... (or so I think I have read!!??)
Title: A little evolution for everyone!
Post by: Ulciscor on June 23, 2005, 10:59:30 AM
I think junk DNA is important because sometimes parts of it copy themselves bang in the middle of a useful sequence, causing really big mutations. I think viruses do something similar. I seem to recall hearing the phrase 'jumping genes'...
Title: A little evolution for everyone!
Post by: Sprotiel on June 23, 2005, 11:21:18 AM
Mmm... Let's try a simple model. Consider that a bot has N meaningful DNA instructions and J junk instructions. Consider also that when it mutates :
1. N remains constant.
2. Deletions of meaningful DNA is fatal
3. A proportion (1-r) of insertions in meaningful DNA is fatal and that non-fatal insertions yield junk DNA.
4. Insertions or deletions of junk DNA have no effect on fitness.
Call d the rate of deletions and I the rate of insertions.

Then at each generation, you have I (rN + J) insertions and dJ deletions and the new junk DNA length J' = J + I r N + (I-d) J.

So there are 3 cases:
Case 1: I>d : junk DNA grows exponentially.
Case 2: I=d : junk DNA grows linearly.
Case 3: I<d : junk DNA reaches an equilibrium value equal to I /(I-d) *r N

Now, all we have to do is testing this!
Title: A little evolution for everyone!
Post by: Greven on June 23, 2005, 11:26:29 AM
This is very sprotiel, but what about normal substitutions, dont we have to take this into accout to?
Title: A little evolution for everyone!
Post by: Ulciscor on June 23, 2005, 11:29:04 AM
Argh my head exploded reading that; it's extremely clever! Go [Sprotiel]!
Title: A little evolution for everyone!
Post by: Sprotiel on June 23, 2005, 11:38:54 AM
Quote
This is very sprotiel, but what about normal substitutions, dont we have to take this into accout to?
Bah! Let's say substitutions will wreck good DNA and transform junk into junk. OK, there's also the possibility that substitutions in good DNA improve the fitness of the bot, but it doesn't change anything to DNA structure. The key point in my crude model is that junk doesn't turn into good DNA (too bloody unlikely) and that good DNA doesn't turn into junk (this would "kill" the bot).
Title: A little evolution for everyone!
Post by: Numsgil on June 23, 2005, 12:11:14 PM
I'd just like to point out that the only "cost" of having Junk DNA is having to copy it every time you reproduce.

In DB, this doesn't cost anything, so there's no downward force on the DNA length aside from deletious mutations (mm, delicious mutations).
Title: A little evolution for everyone!
Post by: PurpleYouko on June 23, 2005, 12:25:32 PM
I'm not arguing that "junk" DNA cannot become useful. It obviously can.

I am looking at present "junk" in a non-mutating environment to see whether it has any effect whatsoever.

As greven said, if it has an effect then it is a bug. I am attempting to find out if there is a bug or not. That is all.
Title: A little evolution for everyone!
Post by: Greven on June 24, 2005, 06:57:31 AM
What about adding cost to reproducing? say 1 nrg for every 10th instruction or so?
Title: A little evolution for everyone!
Post by: PurpleYouko on June 24, 2005, 08:56:41 AM
Back when I were a lad, it used to cost energy to reproduce.

Well actually about a year ago. I had to remove the feature.

Here is the problem with doing it that way.

imagine a robot busy feeding on a patch of veggies with its face (do DBs have faces?) buried in its food, shooting away and building up vast amounts of energy.

He/she/it passes the repro threshold and tries to make a baby. The repro gene activates. The program goes through all the motions of making a new baby. All costs are applied including the cost of replicating the DNA.
Then what happens?
There isn't room for the young 'un to be created so all the effort and cost has gone for nothing due to an arbitrary decision by the program that there ain't enough space.

There is just no justification for charging all that energy to do absolutely nothing. It just put an effective cap on how much energy a robot could colect.
Title: A little evolution for everyone!
Post by: Sprotiel on June 24, 2005, 10:00:53 AM
The solution is rather obvious: charge the ehergy only when the bot reproduces!
Title: A little evolution for everyone!
Post by: Greven on June 24, 2005, 10:06:14 AM
No that is stupid Sprotiel  :boing:  :)

I think, like real cells, a bot divides, not repoduces, and therefore, the daughter cell(bot) should appear were there are any empty space! or something like it!
Title: A little evolution for everyone!
Post by: Numsgil on June 24, 2005, 10:20:56 AM
I think I agree with sprotiel on this one.  Only apply the cost if a baby is successfully produced.
Title: A little evolution for everyone!
Post by: Greven on June 24, 2005, 10:26:59 AM
Yes maybe Sprotiel is right!!!
Title: A little evolution for everyone!
Post by: Ulciscor on June 24, 2005, 10:35:20 AM
I think so too. Since the offspring never actually comes into being no resources should be spent. Unless a portion of the energy is used attempting to make the offspring and the rest used only if it exists.
Title: A little evolution for everyone!
Post by: PurpleYouko on June 24, 2005, 10:43:24 AM
Quote
The solution is rather obvious: charge the ehergy only when the bot reproduces!
I didn't claim that the solution wasn't obvious.

It just isn't that easy to implement.

I agree that a bot should only be charged when the reproduction is successful. The trouble is in telling when it has actually been successful.

I spent a few hours attempting to figure this out then decided it wasn't worth the effort so I just removed the cost altogether. There should probably be some minor cost involved to copy the DNA so if need be we can put in the time to code it again.
Title: A little evolution for everyone!
Post by: Botsareus on June 24, 2005, 10:50:59 AM
PY, you are saying the robots currently lose half there energy during 50 .repo if there was not enough room?
Title: A little evolution for everyone!
Post by: Ulciscor on June 24, 2005, 10:52:02 AM
Yeah I think that is what happens which is why I use a condition to check there is enough room for a new bot to be created.
Title: A little evolution for everyone!
Post by: PurpleYouko on June 24, 2005, 11:20:22 AM
Quote
PY, you are saying the robots currently lose half there energy during 50 .repo if there was not enough room?
That is what was happening.
They were also being charged energy equal to their DNA length on top of that.

Doesn't happen now though.