Assorted NextCS Notes

Selection: 04/05

When we select individuals to “reproduce” we want to do so in a way that takes the finess of the individuals into account, such that individuals with higher fitness values are more likely to be selected.

Once such method is called Roulette Wheel Selection

    Find the total fitness of the entire population.
    Pick a random number in the range [0, totalFitness). Let’s call this r
    Loop through the population, keeping track of the accumulated fitness value as you go. (that is to say, keep adding the fitness of each individual to some variable). Let’s call this variable runningFitness.
    Return the member of the population as soon as r < runningFitness.

With roulette wheel selection, each memeber of the population has a chance of being selected proportional to its fitness value. Specifically, each member of the population has a fitness/totalFitness chance of being selected.

    Imagine a population with the following fitness values: [3, 5, 10, 8].
        For selction, we would generate a random number in the range [0, 26) (assume integers for the puprose of this explation, but floating point values will work fine as well). Below are the values that would result in returning each respective individual:
        Individual 0: 0, 1, 2
        Individual 1: 3, 4, 5, 6, 7
        Individual 2: 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
        Individual 4: 18, 19, 20, 21, 22, 23, 24, 25
        So here, individual 2 has a 10/26 chance of being selected, while individual 0 has a 3/26 chance.