轮盘赌选择算法算法、轮盘赌

由网友(左手边の幸福)分享简介:任何人都可以提供一些伪$ C $下一个轮盘赌选择功能?我将如何实现这一点:我真的不知道如何阅读本数学notation.I想一般的算法来此Can anyone provide some pseudo code for a roulette selection function? How would I implemen...

任何人都可以提供一些伪$ 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.

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.

阅读全文

相关推荐

最新文章