### Author Topic: Need some input on my cholorplast algorithm  (Read 3013 times)

#### Botsareus

• Society makes it all backwards - there is a good reason for that
• Bot God
• Posts: 4483
##### Need some input on my cholorplast algorithm
« on: January 08, 2013, 12:27:49 PM »
So I developed an chloroplast simulation. Mainly a fabrication of my mind. It is probably not based very well on real biology. That is why I need some input. I am going to try my best to describe it in more mathematical and biologist friendly terms, without giving you just sudo-code:

Rule 1 (Vegy feeding)

Assuming that Vegy feeding rate is 150, at half the chloroplasts (16K) the robot will be fed:

150 x Current bot radius / Average bot radius (for simplicity the "Current bot radius / Average bot radius" ratio is bypassed in my simulation (see off-topic)

The number, let us call it 'N'. Is subtracted from the robots energy (for simplicity energy and body are simply treated as energy in my simulation.)

Next, N gets multiplied by the exchange rate (4 in my simulation)

Next, We get the current chloroplast amount, let call this 'C.' Max number if chloroplasts is 32K

Next, N gets multiplied by (32000 - C) / 32000 This is done so it will be difficult for a veg. to maintain chloroplasts the more chloroplasts it has.

Finally, the resulting value is added to chloroplasts.

Rule 3 (How does the robot lose chloroplasts?)

First we need to figure out how much chloroplasts the robot just turned into energy, lets call this E

E is equal to C / 16000 * vegy_feeding_rate

Then, we divide E by 4 (our exchange value)

Finally, we divide E by ( (32100 - C ) / 32000 ) This is done so chloroplast loss has a half life.

E gets subtracted from the current amount of chloroplasts.

Finally, if C falls below a certain point (75 in my simulation) the robot gets 'up-rooted' and instantly looses all its chloroplasts.

Rule 4 (Removing chloroplasts or setting them at a certain value)

Remove is similar to 'Add more chloroplasts' but the resulting value is subtracted from chloroplasts.
And also, the initial value 'N' is added to energy.

If you want to set chloroplasts to a certain value, the program figures out the difference, and ether performs Add or Remove chloroplasts.

The reason I developed this, was because the existing algorithms where too liner in nature.

#### shvarz

• Moderator
• Bot God
• Posts: 1341
##### Re: Need some input on my cholorplast algorithm
« Reply #1 on: January 08, 2013, 12:56:11 PM »
Can't comment on the exact values, but will say something about the concepts.

I agree that in general feeding veggies just because we called them veggies is not a great solution, ideally this should be a complex property that can be evolved and regulated by bots. So I applaud the effort.

Feeding:
I'm not sure what you are trying to accomplish with normalizing for average radius. Are you trying to setup some competition between bots for food? Does not make much sense, as the sim may have a very small number of bots, so competing for light would not make sense. But in general a competition for light is a nice idea. I would add up all the areas of all bots, normalize it by the size of the sim (dimensions) and then give out a preset amount of total energy in the sim distributed based on the number of chloroplasts in each bot. Setup a competition at that level if you want.

You are right, these should cost energy to make and should either decompose with time (what you have now, and it's reasonable) or just cost energy to maintain at each cycle so that the bot has to carefully regulate how many it has (more biologically-accurate).
"Never underestimate the power of stupid things in big numbers" - Serious Sam

#### Botsareus

• Society makes it all backwards - there is a good reason for that
• Bot God
• Posts: 4483
##### Re: Need some input on my cholorplast algorithm
« Reply #2 on: January 08, 2013, 01:59:25 PM »
Quote
I agree that in general feeding veggies just because we called them veggies is not a great solution, ideally this should be a complex property that can be evolved and regulated by bots. So I applaud the effort.

It was not my idea actually, It is from a guy named Panda.

Quote
or just cost energy to maintain at each cycle so that the bot has to carefully regulate how many it has (more biologically-accurate).

Well, In a way, it does cost energy to maintain each cycle (indirectly) because chloroplasts decay each cycle.  If you can give me a formula I'll be happy to look into it though. The problem is, the robot gains energy from chloroplasts each cycle, so, how do I add energy and subtract it at the same time?

Quote
I would add up all the areas of all bots, normalize it by the size of the sim (dimensions) and then give out a preset amount of total energy in the sim distributed based on the number of chloroplasts in each bot. Setup a competition at that level if you want.

Oh, sorry. That's not what I meant. I mean Average bot radius as a constant. I can't give you exact numbers brb,  the magic number is 644.  Also, I forgot to mention that chloroplasts are already added to radius (radius is basically = conversion formula (body) + conversion formula (chloroplasts) The idea here is simply that "the more leafs a robot has, the more energy it can generate"

Code: [Select]
`FindRadius = (Log(bodypoints) * bodypoints * CubicTwipPerBody * 3 * 0.25 / PI) ^ (1 / 3) + (Log(chloroplasts) * chloroplasts * CubicTwipPerBody * 3 * 0.25 / PI) ^ (1 / 3)`
I also forgot to mention that robots that have chloroplasts have extream mass, which was basically a way for us to keep them in place:

Code: [Select]
`.mass = (.body / 1000) + (.shell / 200) + .Chlr * 0.99 'set value for mass`
« Last Edit: January 08, 2013, 03:04:51 PM by Botsareus »

#### shvarz

• Moderator
• Bot God
• Posts: 1341
##### Re: Need some input on my cholorplast algorithm
« Reply #3 on: January 09, 2013, 11:31:13 AM »
Quote
The problem is, the robot gains energy from chloroplasts each cycle, so, how do I add energy and subtract it at the same time?

If it's linear (as in each chloroplast always produces x energy and costs y energy to maintain), then indeed this does not make sense to do. I thought your exact point was to make this a more complex system. In that system there are environment-dependent pluses and minuses in having chloroplasts. As a simple example, you may have "night" and "day" (DB already supports that) and depending on the relative duration of the two, having chloroplasts may be beneficial or not. Or, as another example, it may be beneficial to have chloroplasts when bot population density is low and "light is abundant", but as population density grows and there's more "competition for light", then chloroplasts may not be a good idea. So, it does make sense to add and subtract energy at the same time.

Quote
I also forgot to mention that robots that have chloroplasts have extream mass, which was basically a way for us to keep them in place:
Having chloroplasts contribute to total mass and size makes perfect sense. I would, however, make their contribution progressive: when the number of chloroplasts is small, then this contribution is small, but it gets progressively higher with each additional chloroplast.
"Never underestimate the power of stupid things in big numbers" - Serious Sam

#### Botsareus

• Society makes it all backwards - there is a good reason for that
• Bot God
• Posts: 4483
##### Re: Need some input on my cholorplast algorithm
« Reply #4 on: January 09, 2013, 11:57:37 AM »
Ok, I think I understand:

• Keep chloroplasts static
• If the whole screen was pure robots then the feeding rate is zero, If half the screen is robots then feeding rate is average.
Formula is: Actual feeding rate =  ((Screen area - Total robot area)  / Screen area) ^ 2 *  feeding rate * 4 * chloroplasts / 16000
• The more chloroplasts a robot has the more it costs energy to maintain
Formula is: Energy subtract rate =  (Total chloroplasts / 32000) ^ 2 * feeding rate
(I apply square to both formulas to yield better results)

Right?

Quote
I would, however, make their contribution progressive

The only thing I am concerned about is , what incentive will robots have to evolve there own chloroplasts if the program repopulates Vegys (as it does now, and I really do not want to modify that too much)?

I believe in my system (where there is less effect from the environment) the robots will have more incentive to evolve there own chloroplasts.

The only thing I can think of (and I was going to optionally implement it anyway) is figure out the max number of how much chloroplasts other species (not Vegs) evolved for the whole life time of the simulation, and subtract that from the number of Vegs to repopulate. This way, if the robots de-evolve chloroplasts then they are in trouble because the program will not repopulate Vegys.
« Last Edit: January 09, 2013, 12:42:16 PM by Botsareus »

#### shvarz

• Moderator
• Bot God
• Posts: 1341
##### Re: Need some input on my cholorplast algorithm
« Reply #5 on: January 09, 2013, 03:40:25 PM »
Quote
If the whole screen was pure robots then the feeding rate is zero, If half the screen is robots then feeding rate is average.

Something like that. This would automatically create a self-balancing system of veggies, which could oscillate or remain fairly static or even lead to different life strategies. The exact details of how much to give when - that I don't know, this would require some careful thinking and empirical testing (can leave that up to the user if you want).

Quote
The only thing I am concerned about is , what incentive will robots have to evolve there own chloroplasts if the program repopulates Vegys (as it does now, and I really do not want to modify that too much)?

I'm actually thinking that you would only keep "veggies" in the sim and get rid of "non-veggies". The "veggies" in this system can turn themselves into "non-veggies" by dumping all of their chloroplasts.

A good sim would not need to repopulate veggies (only when the whole system dies off), their population would be autobalanced by the mechanism suggested above and by the natural predator-prey cycles. You would only need to populate it once.
"Never underestimate the power of stupid things in big numbers" - Serious Sam

#### Botsareus

• Society makes it all backwards - there is a good reason for that
• Bot God
• Posts: 4483
##### Re: Need some input on my cholorplast algorithm
« Reply #6 on: January 09, 2013, 04:36:53 PM »
Quote
Something like that. This would automatically create a self-balancing system of veggies, which could oscillate or remain fairly static or even lead to different life strategies. The exact details of how much to give when - that I don't know, this would require some careful thinking and empirical testing (can leave that up to the user if you want).

Good, that's what I will do then. I think the only value I'll leave up to the user is 'feeding rate' (150)

Quote
I'm actually thinking that you would only keep "veggies" in the sim and get rid of "non-veggies". The "veggies" in this system can turn themselves into "non-veggies" by dumping all of their chloroplasts.

A good sim would not need to repopulate veggies (only when the whole system dies off), their population would be autobalanced by the mechanism suggested above and by the natural predator-prey cycles. You would only need to populate it once.

ok, I really hate this one, let me explain why:

Let's say we start with everything Vegs, and even give them a starting amount of chloroplasts:

One big aspect of the program is per-programed bots (and putting them vs each other) If we go with this, every bot has to be updated with "on age 1 I need to dump all my chloroplasts" I don't see how that can be an internal staring condition ether, because, what if it is a hybrid bot that uses chloroplasts only after it's first reproduction?

Also, after long long generations a robot can evolve not to rely on chloroplasts at all. What if we take that robot (DNA only) and put it into a new sim? If we somehow predefine that this robot should not use chloroplasts (let's say it is a special instruction in the beginning of the dna file "start with 0 chloroplasts") then the robot is dead because it had nothing to feed on and killed itself off.

If we don't give them a starting amount of chloroplasts, they are dead anyway because they still have nothing to feed on...

What you are basically telling me is we do not repopulate anything. I have spent a long time designing a system where I evolve a robot that can kill any other robot in F1 mode (computer beat human, that I really want to implement one day) As you may know in F1 mode (see leagues) the robots get Vegs. And are really good at keeping there food away from competitors as well as neutralizing there competitors as well. (I don't know, I guess I just have a thing for proving that a computer can out preform a human in a ALife scenario, which will be, basically, a revolution in Artificial General Intelligence) (F1 mode does not last too long if there are no Vegs...)
« Last Edit: January 09, 2013, 04:58:40 PM by Botsareus »

#### shvarz

• Moderator
• Bot God
• Posts: 1341
##### Re: Need some input on my cholorplast algorithm
« Reply #7 on: January 09, 2013, 07:14:15 PM »
Quote
If we go with this, every bot has to be updated with "on age 1 I need to dump all my chloroplasts"

Not necessarily. They can be dropped into the sim without chloroplasts and then make them.

Quote
after long long generations a robot can evolve not to rely on chloroplasts at all. What if we take that robot (DNA only) and put it into a new sim?

As I discovered in my sims a long time ago, that's a problem for any long-evolved bot. You take it out of a sim, drop into a new one and most likely it will not survive. That's because the bots that evolved alongside it are the proper environment for it, it adapted to them. It's not adapted to "being dropped into a new sim".

Quote
I have spent a long time designing a system where I evolve a robot that can kill any other robot in F1 mode
The whole point of the F1 mode is to keep conditions always the same, as they were originally designed. You do any changes to it and the bots will not work as before and ratings will change. So, if you want F1 mode, don't bother with ANY changes. If you want to improve the program and make it a more sophisticated model, then you should strive to make the sims as self-sufficient as possible. And that means "no repopulating". I never liked the sims with active repopulating, it always felt like a cludge, made to compensate for the fact that DB's ecosystems are often unstable. You implement this and you won't need that cludge.
"Never underestimate the power of stupid things in big numbers" - Serious Sam

#### Botsareus

• Society makes it all backwards - there is a good reason for that
• Bot God
• Posts: 4483
##### Re: Need some input on my cholorplast algorithm
« Reply #8 on: January 10, 2013, 09:44:04 AM »
Quote
So, if you want F1 mode, don't bother with ANY changes.

But, I like chloroplasts because maybe later I can evolve an ecosystem

• Vegy re-population is normalized by area as well.
• How much chloroplasts a robot has at start up is a requirement of the DNA file. If this is not set, the program will ask you to set it when the robot is loaded into the list.
• You can always not select anything as veg and that will mach your conditions perfectly.

Quote
As I discovered in my sims a long time ago, that's a problem for any long-evolved bot. You take it out of a sim, drop into a new one and most likely it will not survive.

From my experiments, (and I am referring to explicitly to version 2.44.1) If you periodically reset epi-genetic memory as the robot mutates, then the DNA actually becomes usable.

Quote
ratings will change

Actually, the ratings will change probably every time a new version is released as bugs are found or we implement new suggestions. I am planning to do a complete re-run of all the modes after I implement chloroplasts. And besides, there are 25% new robots that need to be sorted anyway.

example:

I still need to fix boyancy, tieang tielen 1...5, and sexual reproduction. This definitely changes the ratings...
« Last Edit: January 10, 2013, 10:38:09 AM by Botsareus »

#### shvarz

• Moderator
• Bot God
• Posts: 1341
##### Re: Need some input on my cholorplast algorithm
« Reply #9 on: January 10, 2013, 03:29:04 PM »
Sounds reasonable, good luck!
"Never underestimate the power of stupid things in big numbers" - Serious Sam

#### Botsareus

• Society makes it all backwards - there is a good reason for that
• Bot God
• Posts: 4483
##### Re: Need some input on my cholorplast algorithm
« Reply #10 on: January 10, 2013, 04:59:48 PM »
Thank you very much for your help Shvarz