I try to learn and implement a simple genetic algorithm library for my project. At this time, evolution, selection of population is ready, and I’m trying to implement a simple good mutation operator like the Gaussian mutation operator (GMO) for my genetic evolution engine in Java and Scala.
I find some information on Gaussian mutation operator (GMO) into the paper A mutation operator based on a Pareto ranking for multi-objective evolutionary algorithms (P.M. Mateo, I. Alberto), page 6 and 7.
But I have some problem to find other information on how to implement this Gaussian mutation operator and other useful variants of this operator in Java. What should I do?
I’m using the random.nextGaussian() function of random Java util, but this method only returns a random number between 0 and 1.
So,
a) How can I modify the precision of the return number in this case? (For example, I want to get a random double number between 0 and 1 with step equal to 0.00001.)
b) and how can I specify mu and sigma for this function, because I want to search locally about a value of my genome, not between -1 and 1. How can I ajust that local research around my genome value?
After research, I found an answer for the b) question. It seems I can displace the Gaussian random number like this:
newGenomeValue = oldGenomeValue + (( gaussiandRndNumber * sigma ) + mean )
where mean = my genome value.
(Cf. method of bottom page in How can I generate random numbers with a normal or Gaussian distribution?.)
To answer question a, all you have to do is round to the nearest 0.00001 to get your answer in those units. For example:
Now for part b, you have the right idea and the code you presented should work. All you need to do is rescale your variable to the desired range. The only thing I can add is that the underlying reason this works is the change of variables theorem from calculus: http://en.wikipedia.org/wiki/Integration_by_substitution
If you work out this formula in the case of a Gaussian distribution with 0 mean and standard deviation 1 being transformed by a linear shift and a rescaling, then you will see that what you wrote out was indeed correct.
Putting it all together, here is some code that should do the trick: