# 二元粒子群优化

二元粒子群优化（Binary particle swarm optimization, BPSO）是粒子群优化的一种离散变体，其中每个粒子的位置是一个二元向量，通过由连续速度驱动的概率规则进行更新。它的提出是为了将连续PSO的群体搜索应用于决策变量为比特的问题，例如特征选择和其他组合优化任务。<sup>[1](https://www.ahmetcevahircinar.com.tr/wp-content/uploads/2017/02/A_discrete_binary_version_of_the_particle_swarm_algorithm.pdf)</sup> 离散二元版本对于旅行商问题和任务调度等组合问题很有用。<sup>[2](https://pmc.ncbi.nlm.nih.gov/articles/PMC7516836/)</sup>

| 关键事实 | 详情 |
|---|---|
| 输出 | 每个粒子一个二元位置向量；找到的最优向量即为解（例如，一个选定的特征子集）。<sup>[1](https://www.ahmetcevahircinar.com.tr/wp-content/uploads/2017/02/A_discrete_binary_version_of_the_particle_swarm_algorithm.pdf)</sup> |
| 速度到位置的映射 | S形传递函数将实值速度转换为概率，与随机数比较以设置每个比特。<sup>[3](https://www.mdpi.com/2313-7673/8/2/266)</sup> |
| 速度更新 | 与连续PSO相同；仅位置更新不同。<sup>[4](https://link.springer.com/content/pdf/10.1007/978-3-030-53956-6_18.pdf)</sup> |
| 速度钳制 | 通常 \( v_{\max} = 6 \)，这将比特概率限制在0.9975到0.0025之间；4或5也是典型值。<sup>[5](https://www.cs.us.es/~fsancho/ficheros/IA2019/INBPSO.pdf)</sup><sup> • </sup><sup>[6](https://www.esann.org/sites/default/files/proceedings/legacy/es2013-91.pdf)</sup> |
| 加速系数 | \( c_{1} \) 和 \( c_{2} \) 最常设为2.0，但也有研究使用0.5等值。<sup>[6](https://www.esann.org/sites/default/files/proceedings/legacy/es2013-91.pdf)</sup><sup> • </sup><sup>[7](https://www.mdpi.com/2673-2688/5/3/60)</sup> |
| 主要失效模式 | 在复杂问题上早熟收敛，以及S形函数的伪影——当速度为零时，比特以0.5的概率翻转。<sup>[3](https://www.mdpi.com/2313-7673/8/2/266)</sup><sup> • </sup><sup>[5](https://www.cs.us.es/~fsancho/ficheros/IA2019/INBPSO.pdf)</sup> |
| 标准基准 | 用于特征选择的UCI数据集、背包问题套件、De Jong测试平台和微阵列数据集。<sup>[1](https://www.ahmetcevahircinar.com.tr/wp-content/uploads/2017/02/A_discrete_binary_version_of_the_particle_swarm_algorithm.pdf)</sup><sup> • </sup><sup>[8](https://hoaibach.github.io/files/StickyPSO/SBPSO.pdf)</sup> |

## 工作原理

BPSO保持连续PSO的速度更新不变，仅改变速度产生位置的方式。每个粒子 \( i \) 有一个由比特组成的位置向量 \( x_{i} \) 和一个实值速度向量 \( v_{i} \)。对于每个维度 \( d \)：<sup>[4](https://link.springer.com/content/pdf/10.1007/978-3-030-53956-6_18.pdf)</sup>

\[ v_{id}(t+1) = \omega \cdot v_{id}(t) + c_{1} \cdot \mathrm{rand} \cdot (p_{id} - x_{id}(t)) + c_{2} \cdot \mathrm{rand} \cdot (g_{d} - x_{id}(t)) \]

其中 \( p_{i} \) 是粒子的个体最优位置，\( g \) 是群体的全局最优位置，\( \omega \)、\( c_{1} \)、\( c_{2} \) 分别是惯性权重和加速系数。在1997年的原始公式中，速度更新相同，只是 \( p_{id} \) 和 \( x_{id} \) 是 \( \{0,1\} \) 中的整数，\( v_{id} \) 被解释为概率；离散版本中的 \( v_{\max} \) 控制比特向量的最终变异率，较小的 \( v_{\max} \) 允许更高的变异率。<sup>[1](https://www.ahmetcevahircinar.com.tr/wp-content/uploads/2017/02/A_discrete_binary_version_of_the_particle_swarm_algorithm.pdf)</sup>

速度通过S形传递函数 \( s(v_{id}) = 1/(1 + e^{-v_{id}}) \) 映射为概率，然后以概率方式设置比特：<sup>[4](https://link.springer.com/content/pdf/10.1007/978-3-030-53956-6_18.pdf)</sup>

\[ x_{id}(t+1) = \begin{cases} 1 & \text{若 } U(0,1) < s(v_{id}(t+1)) \\ 0 & \text{否则} \end{cases} \]

在肯尼迪和埃伯哈特的公式中，每个 \( v_{id} \) 表示比特 \( x_{id} \) 取值为1的倾向；在上述标准S形规则下，\( v_{id} = 0.20 \) 给出 \( s(0.20) \approx 0.55 \)，即该比特为1的概率约为百分之五十五。<sup>[1](https://www.ahmetcevahircinar.com.tr/wp-content/uploads/2017/02/A_discrete_binary_version_of_the_particle_swarm_algorithm.pdf)</sup> 两个组成部分将BPSO与连续PSO区分开来：将速度映射到 \( [0,1] \) 中概率的传递函数，以及概率性位置更新。<sup>[9](https://jmmrc.uk.ac.ir/article_4947_429e4a44bec547a527df987730b19aab.pdf)</sup> 一种推广将S形函数写为 \( \mathrm{sigm}(v_{id}) = 1/(1 + e^{-k \cdot v_{id}}) \)，其中陡度参数 \( k = 1 \) 恢复为标准BPSO。<sup>[10](https://people.sau.int/~jcbansal/uploads/11-Modified_BPSO_for_Knapsack_Problem.pdf)</sup>

## 实施方法

标准运行流程如下：用随机比特初始化每个粒子的位置，随机初始化其速度；评估适应度；更新个体最优和全局最优；应用速度更新并钳制到 \( [-v_{\max}, v_{\max}] \)；将速度转换为概率并采样新位置；重复固定次数的迭代。<sup>[5](https://www.cs.us.es/~fsancho/ficheros/IA2019/INBPSO.pdf)</sup>

报告的参数设置因研究而异。文献中大多将速度钳制到 \( [-6, 6] \)，将概率限制在 \( [0.0025, 0.9975] \)；\( v_{\max} = 4 \) 或5也很常见，当 \( v_{\max} = 4 \) 时，处于速度边界的比特只有0.018的翻转概率，表明收敛时探索能力很低。<sup>[5](https://www.cs.us.es/~fsancho/ficheros/IA2019/INBPSO.pdf)</sup><sup> • </sup><sup>[6](https://www.esann.org/sites/default/files/proceedings/legacy/es2013-91.pdf)</sup><sup> • </sup><sup>[10](https://people.sau.int/~jcbansal/uploads/11-Modified_BPSO_for_Knapsack_Problem.pdf)</sup> 种群规模按研究设定而非通用惯例，例如在一项特征选择比较中使用20个粒子迭代100次，另一项中使用30个粒子进化100代。<sup>[3](https://www.mdpi.com/2313-7673/8/2/266)</sup><sup> • </sup><sup>[11](https://www.sciencedirect.com/science/article/abs/pii/S1568494621002258)</sup> 惯性权重本身存在争议：一项分析认为，在标准BPSO中较小的惯性权重鼓励探索而较大的惯性权重增强开发，因此需要递增惯性权重方案，这与连续PSO相反；<sup>[9](https://jmmrc.uk.ac.ir/article_4947_429e4a44bec547a527df987730b19aab.pdf)</sup> 另一项研究将时间递减惯性权重列为缺陷，因为它使算法趋向最大不确定性。<sup>[6](https://www.esann.org/sites/default/files/proceedings/legacy/es2013-91.pdf)</sup>

## 起源

PSO的离散二元版本在论文《一种离散二元版本的粒子群算法》（"A discrete binary version of the particle swarm algorithm"）中描述，发表于1997年IEEE国际系统、人与[控制论](https://www.edgepedia.org/zh/cybernetics)会议，第5卷，第4104–4108页。<sup>[12](https://cir.nii.ac.jp/crid/1361981468588100352)</sup> 该论文报告了对算法的重新设计，此前版本在连续空间中运行，现改为在离散二元变量上运行，轨迹定义为坐标取零或一值的概率变化。<sup>[1](https://www.ahmetcevahircinar.com.tr/wp-content/uploads/2017/02/A_discrete_binary_version_of_the_particle_swarm_algorithm.pdf)</sup><sup> • </sup><sup>[1](https://www.ahmetcevahircinar.com.tr/wp-content/uploads/2017/02/A_discrete_binary_version_of_the_particle_swarm_algorithm.pdf)</sup> 后来的综述和调查一致将1997年的论文归为二元PSO的起源，<sup>[13](https://sci2s.ugr.es/sites/default/files/files/Teaching/OtherPostGraduateCourses/Metaheuristicas/A05%20-%20A-review-of-particle-swarm-optimization-PartI.pdf)</sup><sup> • </sup><sup>[2](https://pmc.ncbi.nlm.nih.gov/articles/PMC7516836/)</sup><sup> • </sup><sup>[14](https://dl.acm.org/doi/10.1016/j.engappai.2025.112397)</sup> 没有已发表文献将BPSO归功于其他团队。

## 变体

命名变体改变更新规则或传递函数。多阶段离散PSO（M-DiPSO）使用另一种速度更新技术。<sup>[13](https://sci2s.ugr.es/sites/default/files/files/Teaching/OtherPostGraduateCourses/Metaheuristicas/A05%20-%20A-review-of-particle-swarm-optimization-PartI.pdf)</sup> 布尔PSO完全使用二元变量和位运算符，速度更新为 \( v_{i,t+1} = w \cdot v_{i,t} + r_{1} \cdot (p_{i,t} \oplus x_{i,t}) + r_{2} \cdot (g_{t} \oplus x_{i,t}) \)，位置更新为 \( x_{i,t+1} = x_{i,t} \oplus v_{i,t} \)；添加小的纯噪声分量（\( \beta = 0.01 \)）在某些高维情况下提高了性能，并扩展到1000个二元维度，而肯尼迪–埃伯哈特BPSO在此表现不佳。<sup>[6](https://www.esann.org/sites/default/files/proceedings/legacy/es2013-91.pdf)</sup> 一种较新的BPSO变体将S形函数替换为 \( S'(V_{id}) = 2 \cdot (S(V_{id}) - 0.5) \)，使得当速度接近零时变化概率接近零。<sup>[5](https://www.cs.us.es/~fsancho/ficheros/IA2019/INBPSO.pdf)</sup> 用于背包问题的改进BPSO将S形函数替换为线性归一化 \( p(x_{id}, v_{id}) = (x_{id} + v_{id} + v_{\max})/(1 + 2 \cdot v_{\max}) \)，它依赖于前一位置并允许更多探索。<sup>[10](https://people.sau.int/~jcbansal/uploads/11-Modified_BPSO_for_Knapsack_Problem.pdf)</sup> 基于概率的BPSO（PBPSO）用于特征选择优于标准BPSO但缺乏动量，粘性BPSO（SBPSO）在PBPSO中添加粘性参数以模拟粒子动量。<sup>[11](https://www.sciencedirect.com/science/article/abs/pii/S1568494621002258)</sup> BRPSO完全消除传递函数和速度更新，通过 \( x_{i} = r_{1} \times pbest_{i} + (1 - r_{1}) \times gbest + p \) 与随机数比较来更新位置。<sup>[3](https://www.mdpi.com/2313-7673/8/2/266)</sup> EBPSO同样移除了速度分量。<sup>[9](https://jmmrc.uk.ac.ir/article_4947_429e4a44bec547a527df987730b19aab.pdf)</sup>

在传递函数方面，赛义达利·米尔贾利利和安德鲁·刘易斯在《群体与进化计算》（2012）中比较了二元PSO的S形和V形传递函数；<sup>[15](https://doi.org/10.1016/j.swevo.2012.09.002)</sup> 穆德·贾基鲁尔·伊斯兰、李晓东和梅毅开发了一种时变传递函数以平衡BPSO中的探索和开发（《应用软计算》，2017）；<sup>[16](https://doi.org/10.1016/j.asoc.2017.04.050)</sup> 扎赫拉·贝赫什提在《软计算》（2020）中引入了X形二元PSO（XBPSO）。<sup>[17](https://doi.org/10.1007/s00500-020-05360-2)</sup> 还报道了一种Z形传递函数——一种非对称映射，在九个基准函数上，在Z形、S形和V形中表现最佳。<sup>[3](https://www.mdpi.com/2313-7673/8/2/266)</sup> V形传递函数使用取反更新规则：如果 \( \mathrm{rand} < s(v_{id}(t)) \)，则 \( x_{id}(t+1) \) 为 \( x_{id}(t) \) 的反值，否则不变。原始V形函数为 \( s(v_{id}) = |\tanh(v_{id})| \)；其支持者发现S形函数缺乏后期局部搜索能力。<sup>[4](https://link.springer.com/content/pdf/10.1007/978-3-030-53956-6_18.pdf)</sup> 参数化版本 \( s(v_{id}) = (1 - e^{-k \cdot |v_{id}|})/2 \)（\( k > 0 \)）控制V形的开口大小，并提高了BPSO在特征选择上的性能。<sup>[4](https://link.springer.com/content/pdf/10.1007/978-3-030-53956-6_18.pdf)</sup>

## 应用

代表性定量结果：BRPSO在15个UCI数据集中的11个上取得了五种算法中最佳的平均分类准确率（k近邻，k = 5，10折交叉验证），并且在特征数超过200的数据集上，只需少于100个选定特征，而其他算法需要超过100个。<sup>[3](https://www.mdpi.com/2313-7673/8/2/266)</sup> ISBPSO使用基于互信息的初始化、动态比特掩码和模因精炼，在12个UCI数据集上优于六种基于PSO的特征选择方法加上序列前向和后向选择，以更少的特征和更少的计算时间取得更高或相似的准确率。<sup>[11](https://www.sciencedirect.com/science/article/abs/pii/S1568494621002258)</sup> 标准评估基准包括UCI仓库、背包问题套件、微阵列数据集和De Jong测试平台，原始二元PSO在De Jong测试平台上对所有函数使用相同参数，快速求解了五个测试函数。<sup>[1](https://www.ahmetcevahircinar.com.tr/wp-content/uploads/2017/02/A_discrete_binary_version_of_the_particle_swarm_algorithm.pdf)</sup><sup> • </sup><sup>[8](https://hoaibach.github.io/files/StickyPSO/SBPSO.pdf)</sup> 与深度学习的混合方法也已出现：一项2024年研究将BPSO特征选择与单层长短期记忆网络结合作为过滤器应用于苹果股票市场数据，将平均绝对误差从0.000433改善到0.000305，均方误差从0.016486改善到0.012886。<sup>[7](https://www.mdpi.com/2673-2688/5/3/60)</sup>

## 局限与替代方案

S形函数因多方面原因受到批评。它是单调递增的，因此不满足位置变化概率应随速度绝对值增加的原则。<sup>[4](https://link.springer.com/content/pdf/10.1007/978-3-030-53956-6_18.pdf)</sup> 在标准BPSO中，速度与处于特定位置的概率相关，而非与改变位置的可能性相关，算法保留每个粒子的个体最优位置和群体的全局最优位置（它们影响后续速度更新），并且S形饱和使比特卡在0或1状态。<sup>[6](https://www.esann.org/sites/default/files/proceedings/legacy/es2013-91.pdf)</sup><sup> • </sup><sup>[19](https://drops.dagstuhl.de/entities/document/10.4230/DagSemProc.08051.6)</sup> S形函数也未能捕捉PSO的特征：速度为0时产生0.5的比特置1概率，因此即使速度为零，比特仍可能变化。<sup>[3](https://www.mdpi.com/2313-7673/8/2/266)</sup><sup> • </sup><sup>[5](https://www.cs.us.es/~fsancho/ficheros/IA2019/INBPSO.pdf)</sup> 针对这些批评，S形和线性形函数被认为不能很好地拟合算法特征，V形和U形函数在速度接近0时无助于逃离局部最优，而X形函数和UTF每次迭代需要多次适应度评估。<sup>[3](https://www.mdpi.com/2313-7673/8/2/266)</sup>

BPSO继承了在复杂问题上早熟收敛的倾向，其性能受传递函数设计的显著影响。<sup>[3](https://www.mdpi.com/2313-7673/8/2/266)</sup> 当所有粒子以零速度坍缩在给定位置时发生停滞；此时群体已收敛，但这并不意味着已收敛到局部最优。<sup>[5](https://www.cs.us.es/~fsancho/ficheros/IA2019/INBPSO.pdf)</sup> 肯尼迪–埃伯哈特BPSO在高维二元空间中扩展性差。<sup>[6](https://www.esann.org/sites/default/files/proceedings/legacy/es2013-91.pdf)</sup> 一项被引用的比较发现，BPSO在特征选择问题上表现不如连续PSO，尽管特征选择本身是组合问题。<sup>[11](https://www.sciencedirect.com/science/article/abs/pii/S1568494621002258)</sup>

与其他二元元启发式算法相比，结果参差不齐且依赖于数据集。在2025年对52个基准数据集的比较中，基于S形函数的二元剑鱼运动优化器在35个数据集上取得最低平均分类误差，在34个数据集上取得最小平均子集大小，优于包括bPSO、bGA和bGWO在内的十二种二元优化器。<sup>[18](https://link.springer.com/article/10.1186/s40537-025-01328-x)</sup> 没有已发表的直接比较涵盖二元[蝙蝠算法](https://www.edgepedia.org/zh/bat-algorithm)或分支定界等精确方法，因此这些比较无法从本文总结的已发表比较中得出结论。

## References

1. [A Discrete Binary Version of the Particle Swarm Algorithm (Kennedy & Eberhart, Proc. IEEE SMC 1997)](https://www.ahmetcevahircinar.com.tr/wp-content/uploads/2017/02/A_discrete_binary_version_of_the_particle_swarm_algorithm.pdf)
2. [Particle Swarm Optimisation: A Historical Review Up to the Current Developments](https://pmc.ncbi.nlm.nih.gov/articles/PMC7516836/)
3. [Binary Restructuring Particle Swarm Optimization and Its Application (BRPSO, Biomimetics, MDPI, 2023)](https://www.mdpi.com/2313-7673/8/2/266)
4. [The Improvement of V-Shaped Transfer Function of Binary Particle Swarm Optimization (ICSI 2020, LNCS 12145; PMC copy PMC7354832)](https://link.springer.com/content/pdf/10.1007/978-3-030-53956-6_18.pdf)
5. [Binary Particle Swarm Optimization: challenges and New Solutions (Khanesar et al., NBPSO)](https://www.cs.us.es/~fsancho/ficheros/IA2019/INBPSO.pdf)
6. [Binary Particle Swarm Optimisation With Improved Scaling Behaviour (ESANN 2013)](https://www.esann.org/sites/default/files/proceedings/legacy/es2013-91.pdf)
7. [A Model for Feature Selection with Binary Particle Swarm Optimisation and Synthetic Features (MDPI AI, 2024)](https://www.mdpi.com/2673-2688/5/3/60)
8. [A Novel Binary Particle Swarm Optimization Algorithm and Its Applications on Knapsack and Feature Selection Problems (SBPSO)](https://hoaibach.github.io/files/StickyPSO/SBPSO.pdf)
9. [Expected binary particle swarm optimization (EBPSO, JMMR Vol. 16, No. 1, 2027)](https://jmmrc.uk.ac.ir/article_4947_429e4a44bec547a527df987730b19aab.pdf)
10. [A Modified Binary Particle Swarm Optimization for Knapsack Problems (Bansal et al., 2012)](https://people.sau.int/~jcbansal/uploads/11-Modified_BPSO_for_Knapsack_Problem.pdf)
11. [Improved binary particle swarm optimization for feature selection with new initialization and search space reduction strategies (ISBPSO, Applied Soft Computing; preprint copy andali89.github.io)](https://www.sciencedirect.com/science/article/abs/pii/S1568494621002258)
12. [A discrete binary version of the particle swarm algorithm, CiNii Research record](https://cir.nii.ac.jp/crid/1361981468588100352)
13. [A review of particle swarm optimization. Part I: background and development (Banks, Vincent, Anyakoha)](https://sci2s.ugr.es/sites/default/files/files/Teaching/OtherPostGraduateCourses/Metaheuristicas/A05%20-%20A-review-of-particle-swarm-optimization-PartI.pdf)
14. [A binary particle swarm optimization with dual encoding mechanism for feature selection (DEBPSO, Engineering Applications of Artificial Intelligence, 2025)](https://dl.acm.org/doi/10.1016/j.engappai.2025.112397)
15. [Seyedali Mirjalili, Andrew Lewis (2012). S-shaped versus V-shaped transfer functions for binary Particle Swarm Optimization. Swarm and Evolutionary Computation.](https://doi.org/10.1016/j.swevo.2012.09.002)
16. [Md. Jakirul Islam, Xiaodong Li, Yi Mei (2017). A time-varying transfer function for balancing the exploration and exploitation ability of a binary PSO. Applied Soft Computing.](https://doi.org/10.1016/j.asoc.2017.04.050)
17. [Zahra Beheshti (2020). A novel x-shaped binary particle swarm optimization. Soft Computing.](https://doi.org/10.1007/s00500-020-05360-2)
18. [Dynamic binary swordfish movement optimization algorithm for feature selection (Journal of Big Data, 2025)](https://link.springer.com/article/10.1186/s40537-025-01328-x)
19. [Runtime Analysis of Binary PSO](https://drops.dagstuhl.de/entities/document/10.4230/DagSemProc.08051.6)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods › Optimization and dynamic programming

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/binary-particle-swarm-optimization

English original: https://www.edgepedia.org/binary-particle-swarm-optimization
