Author Topic: Sex repro botsareus style!  (Read 4587 times)

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Sex repro botsareus style!
« on: July 10, 2010, 05:30:24 PM »
hmm, did not look at the source before posting this topic, I hope what I suggest here is way better although the DNA  will probably grow exponential on every reproduction.


The idea here is to have robots find average values for there every store command if two robots point to the same store memory location. Or, to create additional  code so the child has code from both parents…

EX:

Parent A:

Cond
Boolean1
Start
.up inc
50 .aimdx store
Stop
Cond
Boolean2
Start
25 .dx store
Stop

Parent B:

Cond
Boolean3
Start
.up dec
77 .aimdx store
Stop
Cond
Boolean4
Start
15 .dx store
Stop

What happens is the robot changes the stores into the first unused memory location, sums them, and writes a new gene where the code is executed:

Step1 find memory locations for aimdx and dx
Lets say 998 , 999

Step2 create sum:

Resulting Bot:

Cond
Boolean1
Start
.up inc
50 2 div *998 add 998 store
Stop
Cond
Boolean2
Start
25 2 div   *999 add 999 store
Stop
Cond
Boolean3
Start
.up dec
77 2 div  *998 add 998 store
Stop
Cond
Boolean4
Start
15 2 div  *999 add 999 store
Stop
Cond

There must be exceptions for stuff like -1 shoot…

Step3 new gene:


Cond
Boolean1
Start
.up inc
50 2 div *998 add 998 store
Stop
Cond
Boolean2
Start
25 2 div   *999 add 999 store
Stop
Cond
Boolean3
Start
.up dec
77 2 div  *998 add 998 store
Stop
Cond
Boolean4
Start
15 2 div  *999 add 999 store
Stop
Cond
Start
*998
.aimdx
Store
*999
.dx
store
Stop

The mutations will be done after the combined dna is generated.

Now lets say there is another robot that wants to sexrepro:

Parent C:

Cond
Boolean7
Start
50 .tie store
Stop
Cond
Start
-90 .aimdx store
Stop

Then the resulting robot is:

Cond
Boolean1
Start
.up inc
50 3 div *998 add 998 store
Stop
Cond
Boolean2
Start
25 2 div   *999 add 999 store
Stop
Cond
Boolean3
Start
.up dec
77 3 div  *998 add 998 store
Stop
Cond
Boolean4
Start
15 2 div  *999 add 999 store
Stop
Cond
Boolean7
Start
50 .tie store
Stop
Cond
Start
-90 3 div  *998 add 998 store
Stop
Cond
Start
*998
.aimdx
Store
*999
.dx
store
Stop

To make the system even more efficient we may have to add code that does this:

50 .aimsx store

Changes to

-50 .aimdx store

and

50 .sx store

Changes to

-50 .dx store

Etc.

P.S.

Nice new look of the forum 8)



Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Sex repro botsareus style!
« Reply #1 on: July 10, 2010, 05:47:56 PM »
Thought about it a little more, maybe it will be possible to skip the new memory usage completely:

Like so:

Cond
Boolean1
Start
.up inc
50 3 div *.aimdx add .aimdx store
Stop
Cond
Boolean2
Start
25 2 div   *.dx add .dx store
Stop
Cond
Boolean3
Start
.up dec
77 3 div *.aimdx add .aimdx store
Stop
Cond
Boolean4
Start
15 2 div  *.dx add .dx store
Stop
Cond
Boolean7
Start
50 .tie store
Stop
Cond
Start
-90 3 div  *.aimdx add .aimdx store
Stop
Cond

Offline ikke

  • Bot Destroyer
  • ***
  • Posts: 300
    • View Profile
Re: Sex repro botsareus style!
« Reply #2 on: July 11, 2010, 02:14:30 AM »
I think, evolutionary speaking, the most important part of sexual reproduction is sexual selection. The penalty on sexual selection (replicating only half your genes) can only be offset by making sure the foreign half is at least as good and preferably better than your own.
Cross over can be like it is now with some additional preconditions: species or genes ( or whatever your unit of selection is going to be) can only cross over if their code overlaps for say 80%.
I wouldn't average in the DNA, but in code execution: execute the average of all .up store etc.

Offline Billy

  • Bot Destroyer
  • ***
  • Posts: 175
    • View Profile
Re: Sex repro botsareus style!
« Reply #3 on: July 11, 2010, 04:12:27 AM »
I think that the lines of code should mix, not the genes. I also think that sexrepro should only work if the parent bots had the same number of genes.
"I cannot persuade myself that a beneficent and omnipotent God would have designedly created parasitic wasps with the express intention of their feeding within the living bodies of Caterpillars."

-Charles Darwin

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Sex repro botsareus style!
« Reply #4 on: August 20, 2010, 12:59:07 PM »
Quote
I wouldn't average in the DNA, but in code execution: execute the average of all .up store etc.

That is an idea. However this means we have to drastically change the way the code is processed.

Actually I have improved on my original design:
We can have the reproduction event convert everything into stores (with making non-action-output-memory not overlap from both DNAs)
Then it can select 50% stores from one robot and 50% from the other.

(I have no time right now to clarify what I mean by "non-action-output-memory")

P.S.
Numsgil, I would love to start helping you out on DB3 since I did learn some c#. However I still do not have free Wi-Fi where I live now (it broke a while ago). And my mom does not want to pay extra for internet (because we already pay for Wi-Fi in the rent). I am using the club house computers right now.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Sex repro botsareus style!
« Reply #5 on: August 23, 2010, 05:18:34 PM »
Numsgil, I would love to start helping you out on DB3 since I did learn some c#. However I still do not have free Wi-Fi where I live now (it broke a while ago). And my mom does not want to pay extra for internet (because we already pay for Wi-Fi in the rent). I am using the club house computers right now.

Eh?  If you get wifi as part of rent, and it's broken, can't you have the landlord fix it?

Anyway, yeah, if you get the code up and compiling, and you want to help, I can probably find something for you to work on.  Most of what needs doing right now is pretty technical and/or math heavy, though, so fair warning.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Sex repro botsareus style!
« Reply #6 on: August 24, 2010, 06:46:53 PM »
Quote
can't you have the landlord fix it?

err, it's not "rent" its a condominum complex (maintenense)

And I am the managements computer wizz here. I also attend most meetings, they apparently have better things to throw money at right now  :wacko:

BTW

Numsgil what do you think of the idea:

Quote
Quote
I wouldn't average in the DNA, but in code execution: execute the average of all .up store etc.
That is an idea.


If we go with it, we got worry about stuff like -1 shoot avrg. with 50 shoot etc.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Sex repro botsareus style!
« Reply #7 on: August 25, 2010, 05:28:40 PM »
Quote
I wouldn't average in the DNA, but in code execution: execute the average of all .up store etc.

That is an idea.

...

If we go with it, we got worry about stuff like -1 shoot avrg. with 50 shoot etc.

Yeah, that's the problem.  You'd really need to redesign all the sysvars so that averaging them makes sense.  It's something I want to do for DB3, but instead of averaging all stores you average conflicting stores between "chromosomes".