轮盘赌选择算法 [英] Roulette wheel selection algorithm

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

问题描述

任何人都可以提供一些伪$ C $下一个轮盘赌选择功能?我将如何实现这一点:我真的不知道如何阅读本数学notation.I想一般的算法来此

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 want General algorithm to this.

推荐答案

其他的答案似乎假设你正在试图实现一个轮盘游戏。我认为你是问关于进化算法的轮盘赌选择。

The other answers seem to be assuming that you are trying to implement a roulette game. I think that you are asking about roulette wheel selection in evolutionary algorithms.

<一个href="https://github.com/dwdyer/watchmaker/blob/master/framework/src/java/main/org/uncommons/watchmaker/framework/selection/RouletteWheelSelection.java">Here是实现轮盘赌选择一些Java code 。

假设你有10个项目可供选择,你选择用0和1之间产生一个随机数你把范围在0到1成十个非重叠段,每段成正比的十大项目之一的健身。例如,这可能是这样的:

Assume you have 10 items to choose from and you choose by generating a random number between 0 and 1. You divide the range 0 to 1 up into ten non-overlapping segments, each proportional to the fitness of one of the ten items. For example, this might look like this:

0 - 0.3 is item 1
0.3 - 0.4 is item 2
0.4 - 0.5 is item 3
0.5 - 0.57 is item 4
0.57 - 0.63 is item 5
0.63 - 0.68 is item 6
0.68 - 0.8 is item 7
0.8 - 0.85 is item 8
0.85 - 0.98 is item 9
0.98 - 1 is item 10

这是你的轮盘赌。您的0和1之间的随机数是您的自旋。如果随机数是0.46,则所选择的项目是项目3.如果它是0.92,那么它的项目9

This is your roulette wheel. Your random number between 0 and 1 is your spin. If the random number is 0.46, then the chosen item is item 3. If it's 0.92, then it's item 9.

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

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