Roulette Selection in Genetic Algorithms

后端 未结 14 848
庸人自扰
庸人自扰 2020-11-27 12:19

Can anyone provide some pseudo code for a roulette selection function? How would I implement this:

相关标签:
14条回答
  • 2020-11-27 13:13

    It's been a few years since i've done this myself, however the following pseudo code was found easily enough on google.

    for all members of population
        sum += fitness of this individual
    end for
    
    for all members of population
        probability = sum of probabilities + (fitness / sum)
        sum of probabilities += probability
    end for
    
    loop until new population is full
        do this twice
            number = Random between 0 and 1
            for all members of population
                if number > probability but less than next probability 
                    then you have been selected
            end for
        end
        create offspring
    end loop
    

    The site where this came from can be found here if you need further details.

    0 讨论(0)
  • 2020-11-27 13:13

    Prof. Thrun of Stanford AI lab also presented a fast(er?) re-sampling code in python during his CS373 of Udacity. Google search result led to the following link:

    http://www.udacity-forums.com/cs373/questions/20194/fast-resampling-algorithm

    Hope this helps

    0 讨论(0)
提交回复
热议问题