• You are not logged in.
  • Index
  • General
  • Efficient Implementation of Fitness-Proportionate Selection

    Efficient Implementation of Fitness-Proportionate Selection

    • Started by SpeedMorph
    • 4 Replies:
    • Reputation: 0
    • Registered: 08-Mar-2008
    • Posts: 303

    I am currently writing a keyboard optimization algorithm in C (yes, another one :P) and I want to implement a fitness-proportionate selection as described here (http://www.public.iastate.edu/~crb002/ie574final.pdf):

    With roulette selection you select members of the population
    based on a roullete wheel model. Make a pie chart, where the
    area of a member’s slice to the whole circle is the ratio of
    the members fitness to the total population. As you can see if
    a point on the circumfrence of the circle is picked at random
    those population members with higher fitness will have a higher
    probability of being picked. This ensures natural selection takes
    place.

    The problem is, I don't see how to implement it efficiently. I've thought of two methods: one is unreliable, and the other is slow.

    First, the slow one:

    For a keyboard pool of length N, create an array of length N where each element of the array actually contains two elements, a minimum and a maximum value. Each keyboard has a corresponding minimum and maximum value, and the range is based on the fitness of the keyboard. For example, if keyboard zero has a fitness of 10, keyboard one has a fitness of 20, and keyboard two has a fitness of 25, it would look like this:

    array[0][0] = 0; // minimum
    array[0][1] = 9; // maximum
    array[1][0] = 10;
    array[1][1] = 30;
    array[2][0] = 31;
    array[2][1] = 55;

    (Remember that a lower fitness is better, since it means less effort is required.)

    Then generate a random number. For whichever range that number falls into, the corresponding keyboard is "killed" and replaced with the offspring of a different keyboard. Repeat this as many times as desired.

    The problem with this is that it is very slow. It takes O(N^2) operations to finish.

    Next the fast one:

    First figure out what the lowest and highest fitnesses for the keyboards are. Then generate a random number between (lowest fitness) and (highest fitness) and kill all keyboards with a fitness higher than the generated number. This is efficient, but it's not guaranteed to only kill half the keyboards. It also has somewhat different mechanics from a "roulette wheel" selection, so it may not even be applicable.

    So the question is, what is an efficient implementation?

    EDIT: There is a somewhat efficient algorithm on page 36 of this book (http://books.google.com/books?id=XY4rQJ … on&f=false), but the problem is, it's only efficient if you do the roulette selection only one or a few times. Is there any efficient way to do many roulette selections in parallel?

    Last edited by SpeedMorph (11-Aug-2009 21:54:37)
    Offline
    • 0
    • Reputation: 0
    • From: Horsham, West Sussex, UK
    • Registered: 11-Jun-2007
    • Posts: 86

    Have you considered asking this question on Stack Overflow? (https://stackoverflow.com/) You're much more likely to find developers there who have the particular domain knowledge and expertise needed to solve this problem.

    Offline
    • 0
    • Reputation: 0
    • Registered: 08-Mar-2008
    • Posts: 303
    jammycakes said:

    Have you considered asking this question on Stack Overflow? (https://stackoverflow.com/) You're much more likely to find developers there who have the particular domain knowledge and expertise needed to solve this problem.

    Awesome website. Thanks for the tip!

    Offline
    • 0
    • Reputation: 0
    • Registered: 01-May-2009
    • Posts: 68

    For people's personal projects, or "independent research" it would be useful if we had a central place to put our notes up.  I think a wiki would be perfect.  Perhaps Shai could open up the wiki for users, and make them able to edit within their own user space?  I'm not suggesting he let us edit any of the real colemak stuff, just let us make our own pages on there. :D

    Offline
    • 0
    • Reputation: 0
    • Registered: 17-Mar-2008
    • Posts: 192

    You certainly don't need a minimum and a maximum. An upper bound for each is sufficient to infer any other information. Eg, the ranges [0, 3], [4, 12], [13, 15] would be [4, 13, 16].

    Offline
    • 0
      • Index
      • General
      • Efficient Implementation of Fitness-Proportionate Selection