遗传算法中的轮盘选择 [英] Roulette Selection in Genetic Algorithms

查看:167
本文介绍了遗传算法中的轮盘选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以为轮盘赌选择功能提供一些伪代码吗?我将如何实施:

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

我不太了解如何阅读这种数学符号.我从没做过任何概率或统计.

I don't really understand how to read this math notation. I never took any probability or statistics.

推荐答案

自从我自己完成这项工作已有几年了,但是在Google上很容易找到以下伪代码.

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.

这篇关于遗传算法中的轮盘选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆