# Thread: average mutation in evolutionary simulation

1. ## average mutation in evolutionary simulation

Hi All,

I use a simple evolutionary simulation in which agents can navigate an environment to gather food while avoiding predation. The agents are controlled by artificial neural networks with weights between -10 and 10. Successful agents reproduce and pass their weight configuration on to their offspring (the weights do not change during an agent's 'lifetime', hence there is no learning involved). When a weight is copied to an offspring it mutates slightly according to the following formula.

$\displaystyle Mutation(r) = -0.1 Ln\left(\frac{1}{r}-1\right)$

where r is a random real between <0, 1>. If r = 0.5 the mutation is 0. If r is smaller than 0 the mutation is negative and if r is larger the mutation is positive. On average the mutation is then of course 0. However, someone asked me what the average weight change is, i.e. the average on the absolute outcome of the function. Since the part left and right of r = 0.5 are equal the answer is equal to the average outcome between r=0.5 and r=1. To get at that I can use:

$\displaystyle \int Mutation(r) dr = 0.1 Ln(r-1) - 0.1 r Ln \left(\frac{1}{r}-1\right)$

For the average I take the above function and divide it by half, because I only calculate the average between r=0.5 and r=1.

$\displaystyle Average = \frac{0.1 Ln(r-1) - 0.1 r Ln \left(\frac{1}{r}-1\right)}{0.5}$

And here I try to fill in r=1, but since r = 1 does not exist I have to calculate the limit of the function approaching 1. And this is beyond my mathematical skills (and I apoligize apriori if my formating or formulations confuse you. I tried my best to copy the style of the forum but I'm new here and don't know if I succeeded).

Intuitively I had the idea that the surface below the graph is not infinite. The graph goes to infinite but does this on an infinitely small part. Besides I actually use the first function to calculate the weights' mutation and they are mostly small (choosing random value I seem to get an average mutation around 0.139).

I would be grateful for any comments and will be pleased to clear any confusions in my story.

Bram

2. I'm not sure you can use the Mean Value Theorem for Integrals to find the average value when the function is not continuous on a closed interval.

The mutation function is $\displaystyle M(r)=a\ln\left(\frac{1-r}{r}\right)$

This function of course is not continuous on the end points; a requirement of the Mean Value Theorem.

Note I can still formulate the expression: $\displaystyle \frac{1}{c-b}\int_b^c f(x)dx$

If I integrate this, I get:

$\displaystyle 2a\int\ln\left(\frac{1-r}{r}\right)dr=2a\bigg(1-r\ln(r)-(1-r)\ln(1-r)\bigg)$

Then

$\displaystyle \frac{1}{c-b}\int_b^c f(x)dx=2a\int_{1/2}^1\ln\left(\frac{1-r}{r}\right)dr=2a\bigg(1-r\ln(r)-(1-r)\ln(1-r)\bigg)\Bigg|_{1/2}^1$
$\displaystyle =2a\left[1-(1+\ln(2)\right]$

Since $\displaystyle \lim_{r\to 1}\bigg(1-r\ln(r)-(1-r)\ln(1-r)\bigg)=1$
Note when $\displaystyle a=-0.1$ that comes out to be approx 0.138.

Bram, I'm not sure. I've never applied the Mean Value Theorem to a function non-continuous on a closed interval. However, after looking as it a while, seems to me the concept is still valid if one interprets the theorem as the value of the function which when multiplied by the length of the interval, gives the integral over that interval. Perhaps that interpretation is not valid though. Maybe someone more knowledgeable in analysis can comment further about this.