# 轮盘赌选择

轮盘赌选择，又称适应度比例选择或有放回随机采样，是进化算法中的一种选择算子，其中每个个体被选中参与繁殖的概率等于其适应度除以种群总适应度。<sup>[1](http://www.geatbx.com/ver_3_3/algindex-02.html)</sup><sup> • </sup><sup>[2](https://link.springer.com/article/10.1007/s00500-025-10652-6)</sup> 这一名称来自标准的比喻：每个个体占据一个假想轮盘的一个扇区，扇区大小与其适应度成正比，最适的候选者拥有最大的扇区，每个父代通过转动一次轮盘来选定。<sup>[3](https://www.oreilly.com/library/view/hands-on-genetic-algorithms/9781838557744/b0f0a588-009b-4c57-9e7c-ab8208016bb6.xhtml)</sup><sup> • </sup><sup>[4](https://watchmaker.uncommons.org/manual/ch03s02.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 选择概率 | \( p_i = f(X_i) / \sum_{j=1}^{N} f(X_j) \)；每个个体在单位线段上分得长度为 \( p_i \) 的片段，随机数落入哪个个体的片段，就选中哪个个体。<sup>[2](https://link.springer.com/article/10.1007/s00500-025-10652-6)</sup> |
| 采样模式 | 有放回：每需要一个父代就转一次轮盘，一个个体可能被多次选中，这属于预期行为。<sup>[4](https://watchmaker.uncommons.org/manual/ch03s02.html)</sup> |
| 朴素实现代价 | 每次旋转做线性搜索，则每次选择为 O(n)，一代 n 次旋转为 O(n²)；在累积总和上做二分搜索可降至 O(n log n)。<sup>[5](https://www.cse.unr.edu/~sushil/class/gas/papers/Select.pdf)</sup><sup> • </sup><sup>[6](https://arxiv.org/html/1109.3627)</sup> |
| 最快的变体 | 随机接受法通常达到每次选择 O(1)，当平均权重约为最大值的一半时，约需 τ ≈ 2 次尝试。<sup>[6](https://arxiv.org/html/1109.3627)</sup> |
| 适用域限制 | 概率公式要求总适应度为正，某些实现要求每个适应度值都大于零；总适应度为正时，适应度为 0 的个体没有繁殖机会，最小化问题需要先做变换。<sup>[7](https://tik-old.ee.ethz.ch/file/6c0e384dceb283cd4301339a895b72b8/TIK-Report11.pdf)</sup><sup> • </sup><sup>[1](http://www.geatbx.com/ver_3_3/algindex-02.html)</sup> |
| 已知弱点 | 小种群中采样误差大；随着种群适应度方差缩小，漂变驱动早熟收敛，选择压力随之丧失。<sup>[8](https://www.ida.liu.se/~zebpe83/heuristic/papers/GA_survey.pdf)</sup><sup> • </sup><sup>[9](https://ebooks.inflibnet.ac.in/csp15/chapter/genetic-algorithms-ii/)</sup> |
| 历史地位 | 遗传算法早期发展中的主要选择机制；加权轮盘模拟可追溯至 Goldberg 1989 年的工作。<sup>[10](https://ar5iv.labs.arxiv.org/html/1908.08686)</sup><sup> • </sup><sup>[5](https://www.cse.unr.edu/~sushil/class/gas/papers/Select.pdf)</sup> |

## 机制与实现

该算子分三步将适应度值映射到轮盘扇区。第一步，计算每个个体的选择概率 \( p_i = f(X_i) / \sum_{j=1}^{N} f(X_j) \)。第二步，将这些概率铺成连续区间：在单位线段上取长度为 \( p_i \) 的片段，等价于在轮盘上取圆心角与适应度成正比的扇区。<sup>[2](https://link.springer.com/article/10.1007/s00500-025-10652-6)</sup><sup> • </sup><sup>[8](https://www.ida.liu.se/~zebpe83/heuristic/papers/GA_survey.pdf)</sup> 第三步，通过抽取一个均匀随机数并选中其区间包含该随机数的个体来模拟旋转；如此重复 N 次以填满交配池，且有放回。<sup>[2](https://link.springer.com/article/10.1007/s00500-025-10652-6)</sup><sup> • </sup><sup>[4](https://watchmaker.uncommons.org/manual/ch03s02.html)</sup>

**具体实现**遵循这一模式，只是搜索策略不同。DEAP 的 `selRoulette` 将 `sum_fits` 计算为适应度属性之和，抽取 `u = random.random() * sum_fits`，然后累加适应度值直到累积和超过 u，即线性扫描；它通过 k 次旋转选出 k 个个体，且只看第一个目标。<sup>[11](https://deap.readthedocs.io/en/latest/_modules/deap/tools/selection.html)</sup> PyGAD 提供辅助函数 `wheel_cumulative_probs(probs, num_parents)`，为其轮盘赌选择器和随机通用选择器构建 [start, end) 区间。<sup>[12](https://pygad.readthedocs.io/en/stable/pygad.html)</sup> 一项网络设计研究描述了经典的教科书版本：将累积概率存入数组，然后在 [0, Σfᵢ] 中生成 n 个随机数，每次旋转做一次数组搜索。<sup>[13](https://research.ijcaonline.org/volume70/number12/pxc3887848.pdf)</sup>

Rust 的 genx 库为每个父代在 0.0..1.0 中生成一个随机数，以定位轮盘的停止扇区，各扇区的面积与适应度成正比。<sup>[14](https://docs.rs/genx/latest/genx/selection/roulette_wheel/fn.roulette_wheel_selection.html)</sup> pygenalgo 的实现确保适应度值为正，以 f / sum_fitness 计算概率，并在总适应度为零或实际为零（在 1e-12 以内）时回退到均匀随机选择，通过 `rng.choice` 进行有放回采样。<sup>[15](https://pygeneticalgorithms.readthedocs.io/en/latest/_modules/pygenalgo/operators/selection/roulette_wheel_selector.html)</sup>

## 时间复杂度

采用线性搜索的朴素轮盘赌选择每次选择需要 O(n) 次操作，因为代码必须扫描列表以找到包含随机抽取值的扇区；因此填满一代 n 次旋转需要 O(n²) 步。<sup>[5](https://www.cse.unr.edu/~sushil/class/gas/papers/Select.pdf)</sup><sup> • </sup><sup>[6](https://arxiv.org/html/1109.3627)</sup> 预计算累积槽位总和需要一次 O(n) 扫描和额外内存，之后二分搜索以 O(log n) 找到每个扇区，将一代降至 O(n log n)。<sup>[5](https://www.cse.unr.edu/~sushil/class/gas/papers/Select.pdf)</sup>

Lipowski 与 Lipowska 的随机接受算法完全取消了搜索：它随机选取一个个体，并以与其权重和最大权重之比成正比的概率接受它，重复直到有一次被接受。这通常每次选择具有 O(1) 复杂度，当平均权重约为最大权重的一半时，每次选择约需 τ ≈ 2 次尝试；对于遗传算法应用中典型的 10² 至 10⁴ 种群规模，它相比线性或二分搜索程序带来显著的 CPU 收益。<sup>[6](https://arxiv.org/html/1109.3627)</sup> 作为对比，Goldberg 与 Deb 指出，最好的选择方法每代运行时间为 O(n)，其中锦标赛选择最容易并行化。<sup>[5](https://www.cse.unr.edu/~sushil/class/gas/papers/Select.pdf)</sup>

## 适应度缩放及其局限

概率公式要求总适应度为正，某些实现要求所有适应度值都大于零；选择概率强烈依赖于适应度函数的缩放方式。<sup>[7](https://tik-old.ee.ethz.ch/file/6c0e384dceb283cd4301339a895b72b8/TIK-Report11.pdf)</sup> 适应度值为 0 的个体得不到繁殖机会，DEAP 的文档指出，轮盘赌选择按定义不能用于最小化问题，也不能用于适应度可能小于或等于 0 的情况。<sup>[1](http://www.geatbx.com/ver_3_3/algindex-02.html)</sup><sup> • </sup><sup>[11](https://deap.readthedocs.io/en/latest/_modules/deap/tools/selection.html)</sup> 最小化问题必须先变换为等价的最大化问题，该算子才能适用。<sup>[9](https://ebooks.inflibnet.ac.in/csp15/chapter/genetic-algorithms-ii/)</sup>

**缩放变换**同时解决这两个问题。轮盘赌选择之前常用的方法包括线性缩放 \( f_{\mathrm{scaled}} = a \cdot f + b \)；sigma 截断 \( f_{\mathrm{scaled}} = f - (\overline{f} - c \cdot \sigma) \)；以及幂律缩放 \( f_{\mathrm{scaled}} = f^{k} \)，并将非正的缩放值替换为小常数 d。<sup>[2](https://link.springer.com/article/10.1007/s00500-025-10652-6)</sup> ecr R 包处理负适应度的方法是：将所有值加上最小适应度的相反数，再加上一个正偏移量（默认 0.1），这样即使适应度最小的个体也保留正的选择概率。<sup>[16](https://search.r-project.org/CRAN/refmans/ecr/html/selRoulette.html)</sup>

对绝对值的敏感性是结构性的：由于选择机会等于适应度除以总适应度，适应度函数的非线性缩放可能显著改变该算子的性质，这一点与基于排名的选择不同。<sup>[10](https://ar5iv.labs.arxiv.org/html/1908.08686)</sup> 线性缩放和 sigma 截断等缩放方法正是为解决比例选择的问题而开发的，而基于排名的选择和[锦标赛选择](https://www.edgepedia.org/zh/tournament-selection)则是作为规避这些问题的替代方案被提出的。<sup>[8](https://www.ida.liu.se/~zebpe83/heuristic/papers/GA_survey.pdf)</sup>

## 选择压力、漂变与采样误差

在轮盘赌选择下，分配给一个个体的期望后代数与其适应度比成正比，但实际数量可能与期望值相差很大：轮盘赌选择可能产生较大的采样误差，只有种群规模非常大时，分配的后代数才接近期望值。<sup>[8](https://www.ida.liu.se/~zebpe83/heuristic/papers/GA_survey.pdf)</sup> 文献记载的缺点包括：早期世代中超级个体占主导，以及后期种群收敛、选择压力丧失时收敛缓慢；早期工作中常用适应度缩放来对抗这些问题。<sup>[9](https://ebooks.inflibnet.ac.in/csp15/chapter/genetic-algorithms-ii/)</sup>

在选择压力低时，遗传漂变可能导致种群多样性丧失和早熟收敛，因为算法的运行变得几乎与个体适应度无关。<sup>[2](https://link.springer.com/article/10.1007/s00500-025-10652-6)</sup> 同一文献将降低选择噪声框定为一种旨在防止早熟收敛的多样化技术，同时指出进化算法也可能从选择中的随机性获益。<sup>[2](https://link.springer.com/article/10.1007/s00500-025-10652-6)</sup> XCS 分类器系统中的接管时间分析量化了压力损失：轮盘赌选择下的接管时间取决于竞争分类器之间的准确率比 ρ 以及最优分类器的初始比例，当 ρ = 1 时接管时间趋于无穷；经验上，当 ρ ≥ 0.5 时，最优分类器最终会从种群中被淘汰。<sup>[17](https://www.cs.york.ac.uk/rts/docs/GECCO_2007/docs/p1846.pdf)</sup>

## 与其他选择算子的比较

**偏差与分布范围。** 轮盘赌选择提供零偏差但不保证最小分布范围；随机通用采样（SUS）同时提供零偏差和最小分布范围，使用间隔为 1/NPointer 的等距指针，第一个指针置于 [0, 1/NPointer] 中的随机数处。<sup>[1](http://www.geatbx.com/ver_3_3/algindex-02.html)</sup> SUS 只需转动一次带有 N 个标记的轮盘，所有个体一次性选定，与 N 次独立轮盘试验的高方差相比，其平均波动极小。<sup>[7](https://tik-old.ee.ethz.ch/file/6c0e384dceb283cd4301339a895b72b8/TIK-Report11.pdf)</sup> Watchmaker 手册说明了这一保证：在总共选择 100 次时，一个占据轮盘 4.5% 的个体会被选中四次或五次，而不是三次、零次或 100 次；选择 30 个个体意味着每次选择前进 1/30 × 360 度。<sup>[4](https://watchmaker.uncommons.org/manual/ch03s02.html)</sup>

**多样性与代价。** 在相同选择强度下，截断选择导致的多样性损失远高于排名选择或锦标赛选择，排名选择的行为与锦标赛选择相似。<sup>[1](http://www.geatbx.com/ver_3_3/algindex-02.html)</sup> 锦标赛选择可以在 O(N) 时间内实现，无需对种群排序。<sup>[7](https://tik-old.ee.ethz.ch/file/6c0e384dceb283cd4301339a895b72b8/TIK-Report11.pdf)</sup> Goldberg 与 Deb 的比较分析发现，比例选择的接管速度显著慢于排名选择和锦标赛选择，线性排名与概率二元锦标赛在期望上相同。<sup>[5](https://www.cse.unr.edu/~sushil/class/gas/papers/Select.pdf)</sup>

## 数据说话

实证结果因问题和指标而异。在交叉和变异操作相同的简单遗传算法模拟中，采用锦标赛选择的算法比采用轮盘赌选择的算法收敛快得多。<sup>[18](https://dl.acm.org/doi/10.5555/1134824.1135472)</sup> 然而在旅行商问题上，基于排名的轮盘赌选择在八个实例中给出了最高的解质量，burma14、bay29 和 dantzig42 与最优解的偏差为 0%，eil51 低于 1%；锦标赛选择以更少的代数和最快的迭代时间达到最小总距离，但仅适用于小规模问题，随着问题规模增大，锦标赛选择和比例轮盘赌都容易早熟收敛，而基于排名的选择则继续探索搜索空间。<sup>[19](https://umpir.ump.edu.my/id/eprint/2609/1/WCE_noraini.pdf)</sup>

在三个多目标网络设计实例上，锦标赛选择在 10 节点网络上无论解质量还是计算时间都返回最佳解，而轮盘赌选择的解质量最差但计算时间最佳；对于更大的网络，排名和缩放与锦标赛的质量相当，但计算时间更优。<sup>[13](https://research.ijcaonline.org/volume70/number12/pxc3887848.pdf)</sup> 计算时间的发现因研究而异：网络设计研究发现轮盘赌最快，而 Goldberg 与 Deb 的分析则将比例选择视为慢于 O(n) 方案。<sup>[13](https://research.ijcaonline.org/volume70/number12/pxc3887848.pdf)</sup><sup> • </sup><sup>[5](https://www.cse.unr.edu/~sushil/class/gas/papers/Select.pdf)</sup> 一项 2024 年的模糊 [PROMETHEE](https://www.edgepedia.org/zh/promethee) 对七种遗传算法选择技术的比较将精英选择排在首位（净流量 0.0690），其次是锦标赛（0.0343）和排名选择（0.0078）；轮盘赌选择以 −0.0102 排在第四，领先于截断（−0.0116）和 SUS（−0.0156），玻尔兹曼选择垫底（−0.0738）。<sup>[20](https://doi.org/10.1109/dese63988.2024.10912015)</sup>

## 实际应用

轮盘赌选择作为标准算子随当前主流库一同提供：PyGAD 提供 `roulette_wheel_selection(fitness, num_parents)`，与稳态、排名、随机、锦标赛和随机通用方法并列；<sup>[12](https://pygad.readthedocs.io/en/stable/pygad.html)</sup> DEAP 提供 `selRoulette`；<sup>[11](https://deap.readthedocs.io/en/latest/_modules/deap/tools/selection.html)</sup> ecr R 包提供 `selRoulette`；<sup>[16](https://search.r-project.org/CRAN/refmans/ecr/html/selRoulette.html)</sup> Jenetics 9.1.0 实现了轮盘赌选择器，又称适应度比例选择器，作为概率选择器使用适应度值 fᵢ 计算每个选择概率；<sup>[21](https://jenetics.io/javadoc/jenetics/io.jenetics.base/io/jenetics/RouletteWheelSelector.html)</sup> pygenalgo 包含轮盘赌选择器；<sup>[15](https://pygeneticalgorithms.readthedocs.io/en/latest/_modules/pygenalgo/operators/selection/roulette_wheel_selector.html)</sup> genx 在 Rust 中实现了它。<sup>[14](https://docs.rs/genx/latest/genx/selection/roulette_wheel/fn.roulette_wheel_selection.html)</sup>

新的变体不断出现。2025 年的一种方法使用模糊逻辑，基于进化过程的历史数据以及个体适应度与种群平均适应度之间的关系，来控制个体被选入父代池的概率。<sup>[22](https://www.mdpi.com/2227-7080/13/2/78)</sup> 在 XCS 等分类器系统中，轮盘赌选择仍是被研究的基线，尽管在高度准确的分类器与略不准确的分类器竞争的场景中，锦标赛选择更为稳健。<sup>[17](https://www.cs.york.ac.uk/rts/docs/GECCO_2007/docs/p1846.pdf)</sup>

## 历史

适应度比例选择是遗传算法早期发展中使用的主要选择机制，大量文献报告了其在组合优化中的有竞争力应用。<sup>[10](https://ar5iv.labs.arxiv.org/html/1908.08686)</sup> 在 Holland 风格的遗传算法中，使用的是适应度比例选择而非锦标赛选择，且适应度可以在选择之前重新缩放。<sup>[23](https://hpi.de/friedrich/docs/publications/2012/HNC.pdf)</sup> 简单遗传算法使用轮盘赌方案实现比例选择，为每个串分配一个轮盘扇区，其圆心角等于适应度份额。<sup>[8](https://www.ida.liu.se/~zebpe83/heuristic/papers/GA_survey.pdf)</sup> 最简单的实现——也是最早期使用的实现之一——模拟加权轮盘的旋转，这一方法可追溯至 Goldberg 1989 年的工作。<sup>[5](https://www.cse.unr.edu/~sushil/class/gas/papers/Select.pdf)</sup> 由于缩放依赖性和采样误差这对孪生问题，后来的实践转向基于排名的选择和锦标赛选择，它们正是为克服困扰比例选择的问题而提出的。<sup>[8](https://www.ida.liu.se/~zebpe83/heuristic/papers/GA_survey.pdf)</sup>

## References

1. [Evolutionary Algorithms: Selection, GEATbx documentation (Bäck et al.)](http://www.geatbx.com/ver_3_3/algindex-02.html)
2. [Analysis of selection noise in genetic algorithms, Soft Computing (2025)](https://link.springer.com/article/10.1007/s00500-025-10652-6)
3. [Hands-On Genetic Algorithms with Python, Roulette wheel selection, O'Reilly](https://www.oreilly.com/library/view/hands-on-genetic-algorithms/9781838557744/b0f0a588-009b-4c57-9e7c-ab8208016bb6.xhtml)
4. [Watchmaker Framework Manual, Fitness-Proportionate Selection and Stochastic Universal Sampling](https://watchmaker.uncommons.org/manual/ch03s02.html)
5. [Goldberg & Deb, A Comparative Analysis of Selection Schemes Used in Genetic Algorithms](https://www.cse.unr.edu/~sushil/class/gas/papers/Select.pdf)
6. [Lipowski & Lipowska, Roulette-wheel selection via stochastic acceptance, arXiv:1109.3627](https://arxiv.org/html/1109.3627)
7. [Blickle & Thiele, A Comparison of Selection Schemes used in Genetic Algorithms, TIK-Report 11, ETH Zürich](https://tik-old.ee.ethz.ch/file/6c0e384dceb283cd4301339a895b72b8/TIK-Report11.pdf)
8. [Genetic algorithms: a survey](https://www.ida.liu.se/~zebpe83/heuristic/papers/GA_survey.pdf)
9. [Genetic Algorithms – II, INFLIBNET e-PG Pathshala](https://ebooks.inflibnet.ac.in/csp15/chapter/genetic-algorithms-ii/)
10. [Runtime Analysis of Fitness-Proportionate Selection on Linear Functions, arXiv:1908.08686](https://ar5iv.labs.arxiv.org/html/1908.08686)
11. [DEAP source code for deap.tools.selection (selRoulette)](https://deap.readthedocs.io/en/latest/_modules/deap/tools/selection.html)
12. [PyGAD Documentation, Parent Selection Methods](https://pygad.readthedocs.io/en/stable/pygad.html)
13. [Genetic Algorithm Performance with Different Selection Methods in Solving Multi-Objective Network Design Problem, IJCA (2013)](https://research.ijcaonline.org/volume70/number12/pxc3887848.pdf)
14. [roulette_wheel_selection in genx, Rust documentation](https://docs.rs/genx/latest/genx/selection/roulette_wheel/fn.roulette_wheel_selection.html)
15. [pygenalgo roulette_wheel_selector source code](https://pygeneticalgorithms.readthedocs.io/en/latest/_modules/pygenalgo/operators/selection/roulette_wheel_selector.html)
16. [ecr R package: selRoulette, CRAN](https://search.r-project.org/CRAN/refmans/ecr/html/selRoulette.html)
17. [Modeling Selection Pressure in XCS for Roulette Wheel and Tournament Selection, GECCO 2007](https://www.cs.york.ac.uk/rts/docs/GECCO_2007/docs/p1846.pdf)
18. [Comparison of Performance between Different Selection Strategies on Simple Genetic Algorithms, CIMCA-IAWTIC 2006](https://dl.acm.org/doi/10.5555/1134824.1135472)
19. [Noraini & Geraghty, Genetic Algorithm Performance with Different Selection Strategies in Solving TSP, WCE 2011](https://umpir.ump.edu.my/id/eprint/2609/1/WCE_noraini.pdf)
20. [Selection Techniques in Genetic Algorithm, IEEE DESE 2024](https://doi.org/10.1109/dese63988.2024.10912015)
21. [RouletteWheelSelector, Jenetics 9.1.0 javadoc](https://jenetics.io/javadoc/jenetics/io.jenetics.base/io/jenetics/RouletteWheelSelector.html)
22. [Fuzzy Guiding of Roulette Selection in Evolutionary Algorithms, Education Sciences (2025)](https://www.mdpi.com/2227-7080/13/2/78)
23. [Genetic Algorithms, HPI lecture notes (2012)](https://hpi.de/friedrich/docs/publications/2012/HNC.pdf)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Machine learning methods › Evolutionary and swarm computation › Selection, crossover, and mutation operators

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/roulette-wheel-selection

English original: https://www.edgepedia.org/roulette-wheel-selection
