Roulette Wheel selection procedure
Asked Answered
R

2

5

is it possible to evaluate each individual in the population using the fitness value without finding the probability as the following pseudo code

For all members of population
    sum += fitness ( member)
End for 
Loop until new population is full 
      Do this twice 
            Number = Random between 0 and sum
            Currentfitness = 0.0
            For each member in population
               Currentfitness += fitness (member)
               if Number > Currentfitness then select member
            End for 
      End
Create offspring 
End loop

and what the following part of the code do ?

Do this twice

I really confuse how the Roulette Wheel selects pair of parents. can any help ? thanks in advance

Rosalvarosalyn answered 26/5, 2012 at 11:1 Comment(1)
Do this twice because for create offspring you need two parents. So you have to do the process of selecting parent twice.Galarza
B
3

The code is meant to select a random element, but with probabilities according to a certain weight.

Example:

  • We want to select from a two-element array with the following weights: { 1, 9 }
  • The cumulative weight is { 1, 10 }
  • The total weight is 10
  • We choose a random number between 1 and 10
  • We look into the cumulative weight array and find the first index where our random number is greater than the element
  • This index is the index of the randomly chosen element

Intuitively, this example makes sense: 9 out of ten times the random number will fall between 1 and 9 causing the first element to be drawn with probability 0.9 (just as the weights specified).

Beano answered 26/5, 2012 at 11:11 Comment(4)
So, can I use the value of cumulative fitness instead of cumulative probability. ?Rosalvarosalyn
Yes, the intent is to select randomly with weight = fitness and probability proportional to fitness.Beano
if I have 6 chromosomes, according to the original code. what will be the selection at each spin ? is it pair of parents or 3 pairs of parents?Rosalvarosalyn
I have not good experience with VB.net. coz i want to figure out what is the selected pair at each spin. and is it need to sort the chromosomes based on fitness ?Rosalvarosalyn
B
4

Number should be less than Currentfitness, otherwise it is heavily biased towards the first member of the population.

Example:

  • Consider weights {1, 2, 7}
  • Cumulative weights {1, 3, 10}
  • Total weight 10
  • Choose random double between 0 and 10 with r.NextDouble(10.0)
  • 90% of time 1 is chosen with given pseudo code. Should be 10%
Botello answered 27/8, 2015 at 10:36 Comment(0)
B
3

The code is meant to select a random element, but with probabilities according to a certain weight.

Example:

  • We want to select from a two-element array with the following weights: { 1, 9 }
  • The cumulative weight is { 1, 10 }
  • The total weight is 10
  • We choose a random number between 1 and 10
  • We look into the cumulative weight array and find the first index where our random number is greater than the element
  • This index is the index of the randomly chosen element

Intuitively, this example makes sense: 9 out of ten times the random number will fall between 1 and 9 causing the first element to be drawn with probability 0.9 (just as the weights specified).

Beano answered 26/5, 2012 at 11:11 Comment(4)
So, can I use the value of cumulative fitness instead of cumulative probability. ?Rosalvarosalyn
Yes, the intent is to select randomly with weight = fitness and probability proportional to fitness.Beano
if I have 6 chromosomes, according to the original code. what will be the selection at each spin ? is it pair of parents or 3 pairs of parents?Rosalvarosalyn
I have not good experience with VB.net. coz i want to figure out what is the selected pair at each spin. and is it need to sort the chromosomes based on fitness ?Rosalvarosalyn

© 2022 - 2024 — McMap. All rights reserved.