General > Biology

Need some input on my cholorplast algorithm

(1/3) > >>

Botsareus:
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:
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).

Botsareus:

--- 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.
--- End quote ---

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).
--- End quote ---

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.
--- End quote ---

Oh, sorry. That's not what I meant. I mean Average bot radius as a constant. I can't give you exact numbers :P 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: ---FindRadius = (Log(bodypoints) * bodypoints * CubicTwipPerBody * 3 * 0.25 / PI) ^ (1 / 3) + (Log(chloroplasts) * chloroplasts * CubicTwipPerBody * 3 * 0.25 / PI) ^ (1 / 3)

--- End code ---

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: ---.mass = (.body / 1000) + (.shell / 200) + .Chlr * 0.99 'set value for mass
--- End code ---

shvarz:

--- 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?
--- End quote ---

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:
--- End quote ---
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.

Botsareus:
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
--- End quote ---