# 果蝇优化算法

果蝇优化算法（fruit fly optimization algorithm，FOA）是一种用于数值全局优化的群体智能元启发式算法。它模拟果蝇先靠嗅觉、再靠视觉寻找食物的过程，迭代地移动一群候选解。该算法针对连续目标函数给出一个找到的最优解；其离散变体则可将其推广到旅行商问题等组合优化问题。

| 关键事实 | 详情 |
|---|---|
| 提出者 | 潘文藻（Wen-Tsao Pan），《Knowledge-Based Systems》，2011年（部分文献标注为2012年）<sup>[1](https://doi.org/10.1016/j.knosys.2011.07.001)</sup><sup> • </sup><sup>[2](https://www.sciencedirect.com/science/article/abs/pii/S0950705114000781)</sup> |
| 问题类别 | 连续全局优化；用于TSP及其他组合问题的离散变体<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)</sup> |
| 核心循环 | 嗅觉（气味）觅食、种群评估、视觉觅食，重复至最大代数<sup>[2](https://www.sciencedirect.com/science/article/abs/pii/S0950705114000781)</sup><sup> • </sup><sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)</sup> |
| 控制参数 | 种群规模与终止准则；总体可调参数很少<sup>[2](https://www.sciencedirect.com/science/article/abs/pii/S0950705114000781)</sup><sup> • </sup><sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)</sup> |
| 被引述的优点 | 结构简单、参数少、CPU运行时间相对较短<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)</sup> |
| 已知缺点 | 收敛精度低、早熟收敛、在原点附近难以求解、高维情况下性能退化<sup>[4](https://onlinelibrary.wiley.com/doi/10.1155/2015/492195)</sup><sup> • </sup><sup>[5](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0173516)</sup> |
| 收敛性证明 | 仅针对一种多种群变体发表过证明，基本FOA尚无证明<sup>[6](https://www.sciencedirect.com/science/article/abs/pii/S0950705120305669)</sup> |

## 工作原理

生物学模型来自果蝇的两阶段觅食行为。首先，果蝇用嗅觉器官嗅到食物源的气味，朝该方向飞去；随后，一旦接近食物位置，便用视觉精确定位。<sup>[7](https://onlinelibrary.wiley.com/doi/10.1155/2013/108768)</sup>潘将其概括为一个随机搜索过程，随后是一个视觉定位过程。<sup>[8](https://jzus.zju.edu.cn/opentxt.php?doi=10.1631%2FFITEE.1601364)</sup>

在计算上，嗅觉阶段是一个随机探索步骤：每个个体在当前群体位置周围随机采样一个新位置。视觉阶段则是一个社会步骤：一旦确定已知气味最佳的位置，整个群体便以群集方式向该位置移动。<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)</sup>算法重复这些阶段，直至达到最大代数。<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)</sup>

## 实现步骤

基本算法依次运行四个阶段：初始化、嗅觉觅食、种群评估和视觉觅食，控制参数设定为种群规模和终止准则。<sup>[2](https://www.sciencedirect.com/science/article/abs/pii/S0950705114000781)</sup>

1. 初始化群体位置 \( (X_{\mathrm{axis}}, Y_{\mathrm{axis}}) \) 和一群果蝇。
2. 在嗅觉阶段，围绕当前群体位置，以随机的飞行方向和距离随机生成每个候选个体。<sup>[9](https://bibliotekanauki.pl/articles/330026.pdf)</sup>
3. 评估每个候选个体。计算果蝇与原点之间的距离 \( \mathrm{Dist}_{i} \)，其倒数 \( \mathrm{Smell}_{i} = 1/\mathrm{Dist}_{i} \) 作为气味浓度判定值输入目标函数，因此距离越近的果蝇气味越强。<sup>[10](https://www.degruyterbrill.com/document/doi/10.1515/JSSI-2015-0365/html)</sup>
4. 在视觉阶段，采用贪婪选择：求 \( [\mathrm{bestSmell}, \mathrm{bestIndex}] = \max(\mathrm{Smell}) \)，因为 \( \mathrm{Smell}_{i} = 1/\mathrm{Dist}_{i} \) 有利于距离更近的果蝇；若 \( \mathrm{bestSmell} > \mathrm{smellBest} \)，则更新 \( \mathrm{smellBest} = \mathrm{bestSmell} \)，并通过 \( \mathrm{Smellbest} = \mathrm{bestSmell} \)、\( X_{\mathrm{axis}} = X(\mathrm{bestindex}) \)、\( Y_{\mathrm{axis}} = Y(\mathrm{bestindex}) \) 移动群体。<sup>[10](https://www.degruyterbrill.com/document/doi/10.1515/JSSI-2015-0365/html)</sup><sup> • </sup><sup>[9](https://bibliotekanauki.pl/articles/330026.pdf)</sup>
5. 重复，直至满足终止准则。

已发表的实验采用的设置包括：PI控制器整定时种群为20、迭代50次<sup>[4](https://onlinelibrary.wiley.com/doi/10.1155/2015/492195)</sup>；函数优化时种群为200、迭代100代<sup>[10](https://www.degruyterbrill.com/document/doi/10.1515/JSSI-2015-0365/html)</sup>；在TSPLIB实例上种群为5、迭代100代。<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)</sup>

## 起源

FOA由潘文藻在其论文《一种新的果蝇优化算法：以财务困境模型为例》（A new Fruit Fly Optimization Algorithm: Taking the financial distress model as an example）中提出，发表于2011年的《Knowledge-Based Systems》。<sup>[1](https://doi.org/10.1016/j.knosys.2011.07.001)</sup>该论文于2011年在线发表<sup>[10](https://www.degruyterbrill.com/document/doi/10.1515/JSSI-2015-0365/html)</sup>，并刊载于2012年的《Knowledge-Based Systems》（第26卷）<sup>[11](https://www.joca.cn/EN/Y2013/V33/I04/964)</sup>，因此引用文献将其标注为其中任一年份。潘将其界定为一类新的全局优化进化算法，源于对果蝇觅食行为的模拟。<sup>[10](https://www.degruyterbrill.com/document/doi/10.1515/JSSI-2015-0365/html)</sup>此后，该算法迅速被应用于财务困境预测、电力负荷预测、网络拍卖物流、PID控制器整定和多维背包问题。<sup>[2](https://www.sciencedirect.com/science/article/abs/pii/S0950705114000781)</sup>

## 变体

许多有名称的变体修改了候选解的生成机制，或引入了其他算法的算子：

- **LGMS-FOA** 以候选解的线性生成机制取代原有的非线性生成机制<sup>[7](https://onlinelibrary.wiley.com/doi/10.1155/2013/108768)</sup>，按 \( x_{i,j} = \delta_{j} + \omega \cdot \mathrm{rand}() \cdot (UB_{j} - LB_{j}) \) 生成个体，其中权重 \( \omega = \omega_{0} \cdot \alpha^{\mathrm{Iter}} \)。<sup>[2](https://www.sciencedirect.com/science/article/abs/pii/S0950705114000781)</sup>
- **IFFO** 增加一个控制参数，自适应地调节群体位置周围的搜索范围，并加入一种新的解生成方法。<sup>[2](https://www.sciencedirect.com/science/article/abs/pii/S0950705114000781)</sup>
- **CIFOA-SVM** 用混沌粒子初始化群体位置，并采用一种变异策略，配合两种嗅觉阶段的生成机制分别进行全局和局部搜索。<sup>[5](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0173516)</sup>
- **DFOA**（离散FOA）在嗅觉过程中使用交叉算子，并使用边交叉消除（edge intersection elimination，EXE）算子求解TSP<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)</sup>；**EFOA** 强化视觉搜索，加入消除机制，并定义反向算子和乘法算子，在约40次迭代内即可达到TSPLIB最优解，而基本FOA需要100次以上。<sup>[8](https://jzus.zju.edu.cn/opentxt.php?doi=10.1631%2FFITEE.1601364)</sup>
- **FOADE** 在每次FOA迭代后附加差分进化的变异、交叉和选择<sup>[10](https://www.degruyterbrill.com/document/doi/10.1515/JSSI-2015-0365/html)</sup>；**BCFOA** 引入细菌趋化的吸引和排斥操作，根据适应度方差是否为零在两者之间选择<sup>[11](https://www.joca.cn/EN/Y2013/V33/I04/964)</sup>；**CFOA** 将全局最差、均值和最优解信息纳入搜索策略。<sup>[4](https://onlinelibrary.wiley.com/doi/10.1155/2015/492195)</sup>
- **QTFOA** 将FOA与QUATRE进化矩阵结合以更新粒子位置。<sup>[12](https://journals.sagepub.com/doi/full/10.1177/15501477211073037)</sup>
- 一种随机分形多目标变体使用随迭代变化的自适应标准差 \( \delta \)，以平衡全局探索与局部开发，在随机维度上按 \( \mathrm{Gaussian}(X_{bj}, \delta) + (\gamma \cdot X_{r1j} - \gamma \cdot X_{r2j}) \) 生成候选解。<sup>[9](https://bibliotekanauki.pl/articles/330026.pdf)</sup>
- 一种2026年提出的改进FOA（FOA-LV）融合莱维飞行和动态搜索半径，针对传统FOA在无线传感器网络节点定位中过早停滞于次优解的问题；仿真表明，与常规FOA及其他优化器相比，其收敛更快、定位误差更低、定位效率达100%，且计算时间缩短。<sup>[13](https://link.springer.com/article/10.1007/s11277-026-11931-7)</sup>
- 一种2026年提出的FOA-ACO混合云调度器按 \( X_{i}(t+1) = X_{\mathrm{best}}(t) + \alpha \cdot \mathrm{rand}() \cdot (X_{j}(t) - X_{k}(t)) \) 更新位置，并按 \( \tau_{ij}(0) = \lambda \cdot (1/d_{ij}) + (1 - \lambda) \cdot \mathrm{FOAinit}(ij) \) 初始化信息素；与先来先服务（FCFS）、Min-Min算法、独立ACO和WOA相比，其完工时间缩短9.57%，资源利用率提高7.14%，负载均衡因子改善23.06%。<sup>[14](https://online-journals.org/index.php/i-joe/article/download/61591/17335/198621)</sup>

2021年的一篇综述将这些改进归为三类：候选解生成机制、多群协同搜索和飞行策略。<sup>[15](http://cea.ceaj.org/EN/10.3778/j.issn.1002-8331.2011-0174)</sup>

## 应用

已发表的应用涵盖财务困境预测、电力负荷预测、网络拍卖物流服务满意度、PID及分数阶模糊PID控制器整定和多维背包问题。<sup>[2](https://www.sciencedirect.com/science/article/abs/pii/S0950705114000781)</sup><sup> • </sup><sup>[4](https://onlinelibrary.wiley.com/doi/10.1155/2015/492195)</sup>其他有记载的用途包括半导体测试调度、结构工程设计优化、路径规划和神经网络参数优化。<sup>[6](https://www.sciencedirect.com/science/article/abs/pii/S0950705120305669)</sup>CIFOA-SVM可同时进行SVM参数整定和特征选择，据报道在医学诊断和信用卡问题上取得成功。<sup>[5](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0173516)</sup>离散变体可处理TSP<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)</sup>和带容量约束的车辆路径问题。<sup>[12](https://journals.sagepub.com/doi/full/10.1177/15501477211073037)</sup>CFOA被用于优化碳纤维生产中预氧化炉史密斯预估器的PI控制器。<sup>[4](https://onlinelibrary.wiley.com/doi/10.1155/2015/492195)</sup>

## 局限与替代方案

基准比较显示，改进变体优于基本算法。IFFO在维度30和50的29个基准函数上测试，显著改进了基本FOA，并优于FFO_LGMS和五种最先进的和声搜索算法。<sup>[2](https://www.sciencedirect.com/science/article/abs/pii/S0950705114000781)</sup>在维度5、30和50的Schaffer、Sphere、Griewank和Rastrigin函数上，CFOA在多数实验中优于FOA和PSO。<sup>[4](https://onlinelibrary.wiley.com/doi/10.1155/2015/492195)</sup>在30维测试中，FOADE在Sphere、Griewank、Rosenbrock和Rastrigin函数上比FOA收敛更快、精度更高。<sup>[10](https://www.degruyterbrill.com/document/doi/10.1515/JSSI-2015-0365/html)</sup>在TSPLIB实例上，DFOA的平均巡回长度小于并行混合遗传算法和PSO，且CPU时间更少；PSO因计算负荷过大而无法在大型实例上给出结果。<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)</sup>

关于收敛性保证，已有文献针对一种带混沌全局扰动的多种群跟随行为驱动FOA变体发表了[马尔可夫链](https://www.edgepedia.org/zh/markov-chain)收敛性证明，弥补了基本FOA缺乏保证的不足；已发表文献中尚未出现针对基本算法的证明。<sup>[6](https://www.sciencedirect.com/science/article/abs/pii/S0950705120305669)</sup>

有记载的失效模式在各文献中较为一致。由于每次迭代中所有个体都向当前最优个体聚集，种群多样性下降，算法会陷入局部极值，收敛精度低。<sup>[10](https://www.degruyterbrill.com/document/doi/10.1515/JSSI-2015-0365/html)</sup><sup> • </sup><sup>[8](https://jzus.zju.edu.cn/opentxt.php?doi=10.1631%2FFITEE.1601364)</sup><sup> • </sup><sup>[11](https://www.joca.cn/EN/Y2013/V33/I04/964)</sup>另一个结构性弱点是难以在原点附近获得最优解，因为气味是到原点距离的倒数；为此专门提出了一种基于差分进化的DFOA来解决该问题。<sup>[5](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0173516)</sup>随着搜索空间维度增加，FOA仍容易陷入局部最优。<sup>[6](https://www.sciencedirect.com/science/article/abs/pii/S0950705120305669)</sup>与其他算法相比，FOA的吸引力在于成本：结构简单、可调参数少、可操作性强、全局优化速度快，使其比许多智能算法更易实现。<sup>[15](http://cea.ceaj.org/EN/10.3778/j.issn.1002-8331.2011-0174)</sup><sup> • </sup><sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)</sup>

## References

1. [Wen-Tsao Pan (2011). A new Fruit Fly Optimization Algorithm: Taking the financial distress model as an example. Knowledge-Based Systems.](https://doi.org/10.1016/j.knosys.2011.07.001)
2. [An improved fruit fly optimization algorithm for continuous function optimization problems (Pan, Sang, Duan, Gao; Knowledge-Based Systems, 2014)](https://www.sciencedirect.com/science/article/abs/pii/S0950705114000781)
3. [A Discrete Fruit Fly Optimization Algorithm for the Traveling Salesman Problem (PLOS ONE)](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0165804)
4. [An Improved Fruit Fly Optimization Algorithm Inspired from Cell Communication Mechanism (CFOA)](https://onlinelibrary.wiley.com/doi/10.1155/2015/492195)
5. [An improved chaotic fruit fly optimization based on a mutation strategy for simultaneous feature selection and parameter optimization for SVM (PLOS ONE)](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0173516)
6. [Multi-population following behavior-driven fruit fly optimization: A Markov chain convergence proof and comprehensive analysis (Knowledge-Based Systems, 2020)](https://www.sciencedirect.com/science/article/abs/pii/S0950705120305669)
7. [LGMS-FOA: An Improved Fruit Fly Optimization Algorithm for Solving Optimization Problems (Shan, Cao, Dong; Mathematical Problems in Engineering, 2013)](https://onlinelibrary.wiley.com/doi/10.1155/2013/108768)
8. [An improved fruit fly optimization algorithm for solving traveling salesman problem (EFOA; Frontiers of Information Technology & Electronic Engineering)](https://jzus.zju.edu.cn/opentxt.php?doi=10.1631%2FFITEE.1601364)
9. [Stochastic Fractal Based Multiobjective Fruit Fly Optimization (repository copy with full equations)](https://bibliotekanauki.pl/articles/330026.pdf)
10. [A New Fruit Fly Optimization Algorithm Based on Differential Evolution (FOADE; Journal of Systems Science and Information, 2015)](https://www.degruyterbrill.com/document/doi/10.1515/JSSI-2015-0365/html)
11. [Fruit fly optimization algorithm based on bacterial chemotaxis (BCFOA; Journal of Computer Applications, 2013)](https://www.joca.cn/EN/Y2013/V33/I04/964)
12. [Quasi-affine Transformation evolutionary for the Fruit fly Optimization Algorithm (QTFOA; SAGE)](https://journals.sagepub.com/doi/full/10.1177/15501477211073037)
13. [Optimized Sensor Node Localization in Wireless Sensor Network Using an Improved Fruit Fly Optimization Algorithm Incorporating Levy Flight and Variable Search Radius (Wireless Personal Communications, 2026)](https://link.springer.com/article/10.1007/s11277-026-11931-7)
14. [Hybrid fruit fly optimization–ant colony optimization (FOA-ACO) for cloud task scheduling (iJOE, 2026)](https://online-journals.org/index.php/i-joe/article/download/61591/17335/198621)
15. [Research and Analysis on Progress of Fruit Fly Optimization Algorithm (Zhang Shuiping, Wang Lina; Computer Engineering and Applications, 2021)](http://cea.ceaj.org/EN/10.3778/j.issn.1002-8331.2011-0174)

---
*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 › Swarm intelligence optimizers

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/fruit-fly-optimization-algorithm

English original: https://www.edgepedia.org/fruit-fly-optimization-algorithm
