mutationRate is the probability to select each value to mutate. For large N (the number of parameters) it tends to t/N. The extra +t term from t/(N+t) is just so that if N is smaller that T the mutation probability is not >1. mutationRate is somewhere in interval (0, 1).Joerg Oster wrote:
Could you explain these 2 lines of code, please?Code: Select all
=> mutationRate := ft / (ft + float64(len(vals))) for has := false; !has; { // loop until at least one value was modified for i, o := range opts { => if i == 0 || rand.Float64() < mutationRate {
Second line is basically: do the following with probability mutationRate. rand.Float64() returns a uniformly distributed number between 0 and 1.