# 蛇优化算法

蛇优化算法（Snake Optimizer，SO）是一种基于群智能的元启发式算法，用于求解连续优化问题。在该算法中，一组候选解模拟蛇的觅食、进食、争斗和交配行为，以搜索使目标函数最小化（或最大化）的设计向量或参数向量。<sup>[1](https://doi.org/10.1016/j.knosys.2022.108320)</sup> 它属于仿生优化器家族，与该家族中的许多同类算法相比，所需的调参量相对较少。<sup>[2](https://www.mdpi.com/2313-7673/11/2/137)</sup>

| 关键事实 | 详情 |
|---|---|
| 提出时间 | 2022年，发表于《Knowledge-Based Systems》第242卷，文章编号108320，作者为法特玛·A·哈希姆和阿卜杜勒阿齐姆·G·侯赛因<sup>[3](https://scholarhub.vn/publication/Snake-Optimizer-A-novel-meta-heuristic-optimization-algorithm/cd121fa8-f74e-4ece-94a1-0c4272ace35f)</sup> |
| 问题类别 | 连续（实值）优化；针对离散问题和多准则问题存在二值版本和多目标版本<sup>[4](https://pmc.ncbi.nlm.nih.gov/articles/PMC9935299/)</sup><sup> • </sup><sup>[5](https://www.techscience.com/CMES/v147n1/67137/html)</sup> |
| 种群结构 | 按50%雄性、50%雌性划分；根据食物和温度条件选择八种位置更新方法<sup>[6](https://www.scitepress.org/Papers/2022/115243/115243.pdf)</sup><sup> • </sup><sup>[7](https://www.mdpi.com/2227-7390/12/11/1708)</sup> |
| 核心控制调度 | 温度 \( \mathrm{Temp} = \mathrm{Exp}(-\mathrm{Curiter}/\mathrm{Totiter}) \)；食物量阈值0.25；温度阈值0.6<sup>[6](https://www.scitepress.org/Papers/2022/115243/115243.pdf)</sup> |
| 原始基准测试 | 30个无约束函数，外加减速器、焊接梁、压力容器和拉压弹簧设计问题<sup>[1](https://doi.org/10.1016/j.knosys.2022.108320)</sup> |
| 已记录的弱点 | 搜索偏向最优解、开发能力弱、收敛慢、易陷入局部最优<sup>[2](https://www.mdpi.com/2313-7673/11/2/137)</sup><sup> • </sup><sup>[6](https://www.scitepress.org/Papers/2022/115243/115243.pdf)</sup> |

## 工作原理

蛇优化算法对两个外部条件——食物可获得性和温度——进行建模，并将其映射到搜索阶段。当温度较高（\( \mathrm{Temp} > 0.6 \)）且食物稀缺（食物量 \( Q \) 低于0.25）时，蛇进行觅食：每个个体向搜索空间中的随机位置移动，从而驱动探索；当温度降至0.6或以下时，则改用下文所述的争斗或交配规则。当食物充足且环境温暖（\( Q > 0.25 \) 且 \( \mathrm{Temp} > 0.6 \)）时，蛇进行进食：每个个体向当前最优位置 \( X_{\mathrm{food}} \) 移动，从而驱动开发。<sup>[7](https://www.mdpi.com/2227-7390/12/11/1708)</sup><sup> • </sup><sup>[2](https://www.mdpi.com/2313-7673/11/2/137)</sup>

当温度降至0.6以下且食物充足（\( Q \ge 0.25 \)）时，通过随机抽取决定蛇是争斗还是交配。<sup>[22](https://www.aimspress.com/aimspress-data/mbe/2023/6/PDF/mbe-20-06-423.pdf)</sup><sup> • </sup><sup>[23](https://www.nature.com/articles/s41598-025-01299-2)</sup> 在争斗模式下，雄性争夺最优雌性，雌性争夺最优雄性，产生向异性子种群中最优个体的更新。在交配模式下，成对蛇产卵，卵孵化后，最差雄性和最差雌性被替换，从而实现种群更新。<sup>[7](https://www.mdpi.com/2227-7390/12/11/1708)</sup><sup> • </sup><sup>[4](https://pmc.ncbi.nlm.nih.gov/articles/PMC9935299/)</sup> 温度调度在运行过程中逐渐下降，因此算法自然地从早期的觅食（探索）转向后期的进食、争斗和交配（开发）。<sup>[6](https://www.scitepress.org/Papers/2022/115243/115243.pdf)</sup>

## 实施方法

使用者运行以下循环：<sup>[7](https://www.mdpi.com/2227-7390/12/11/1708)</sup><sup> • </sup><sup>[6](https://www.scitepress.org/Papers/2022/115243/115243.pdf)</sup>

1. 在搜索边界内随机初始化规模为 \( N \) 的种群，并按50%雄性、50%雌性划分。
2. 评估适应度，识别最优雌性和最优雄性。
3. 在每次迭代中计算 \( \mathrm{Temp} = \mathrm{Exp}(-\mathrm{Curiter}/\mathrm{Totiter}) \)，其中Curiter为当前迭代次数，Totiter为总迭代次数，并更新食物量 \( Q \)。
4. 若 \( \mathrm{Temp} > 0.6 \) 且 \( Q < 0.25 \)，将每个位置向随机位置更新（探索）；若 \( \mathrm{Temp} > 0.6 \) 且 \( Q \geq 0.25 \)，向食物移动；若 \( \mathrm{Temp} \leq 0.6 \) 且 \( Q < 0.25 \)，将每个位置向随机位置更新（探索）；若 \( \mathrm{Temp} \leq 0.6 \) 且 \( Q \geq 0.25 \)，通过随机抽取选择争斗模式或交配模式。<sup>[22](https://www.aimspress.com/aimspress-data/mbe/2023/6/PDF/mbe-20-06-423.pdf)</sup><sup> • </sup><sup>[23](https://www.nature.com/articles/s41598-025-01299-2)</sup>
5. 若 \( Q > 0.25 \) 且 \( \mathrm{Temp} > 0.6 \)，向食物移动：

\[ X_{i}(t+1) = X_{\mathrm{food}} \pm c_{3} \cdot \mathrm{Temp} \cdot \mathrm{rand} \cdot (X_{\mathrm{food}} - X_{i}(t)) \]

6. 若 \( \mathrm{Temp} < 0.6 \)，当 \( Q \geq 0.25 \) 时通过随机抽取选择争斗或交配，当 \( Q < 0.25 \) 时使用探索，例如对雄性<sup>[22](https://www.aimspress.com/aimspress-data/mbe/2023/6/PDF/mbe-20-06-423.pdf)</sup><sup> • </sup><sup>[23](https://www.nature.com/articles/s41598-025-01299-2)</sup>：

\[ X_{i,m}(t+1) = X_{i,m}(t) + c_{3} \cdot FM \cdot \mathrm{rand} \cdot (Q \cdot X_{\mathrm{best},f} - X_{i,m}(t)) \]

或交配模式：

\[ X_{i,m}(t+1) = X_{i,m}(t) + c_{3} \cdot M_{m} \cdot \mathrm{rand} \cdot (Q \cdot X_{i,f}(t) - X_{i,m}(t)) \]

其中交配能力是针对雄性定义的。<sup>[2](https://www.mdpi.com/2313-7673/11/2/137)</sup><sup> • </sup><sup>[5](https://www.techscience.com/CMES/v147n1/67137/html)</sup>

7. 当卵孵化时，替换最差雄性和最差雌性，重复直至迭代预算 \( T \) 耗尽。

参数列表包括种群规模 \( N \)、最大迭代次数 \( T \) 以及常数 \( c_{1} = 0.5 \)、\( c_{2} \) 和 \( c_{3} \)；食物量 \( Q = 0.5 \cdot \mathrm{Exp}((\mathrm{Curiter} - T)/T) \) 和温度 \( \mathrm{Temp} \) 并非自由参数，而是在运行过程中计算得出，标准算法不包含能量参数 \( E \)。阈值过低会使搜索过早切换到开发或交配，增加早熟收敛的风险；阈值过高则延长探索阶段，面临收敛缓慢的风险。<sup>[5](https://www.techscience.com/CMES/v147n1/67137/html)</sup>

## 起源

蛇优化算法由法特玛·A·哈希姆（埃及赫勒万大学）和阿卜杜勒阿齐姆·G·侯赛因（瑞典林雪平大学；埃及法尤姆大学）在论文《蛇优化算法：一种新型元启发式优化算法》中提出，发表于2022年《Knowledge-Based Systems》第242卷，文章编号108320。<sup>[3](https://scholarhub.vn/publication/Snake-Optimizer-A-novel-meta-heuristic-optimization-algorithm/cd121fa8-f74e-4ece-94a1-0c4272ace35f)</sup> 其生物学灵感归功于理查德·沙因关于蛇类繁殖策略的研究，包括《蛇类的繁殖策略》（2003）。<sup>[3](https://scholarhub.vn/publication/Snake-Optimizer-A-novel-meta-heuristic-optimization-algorithm/cd121fa8-f74e-4ece-94a1-0c4272ace35f)</sup><sup> • </sup><sup>[8](https://doi.org/10.1098/rspb.2002.2307)</sup> 最初提出该算法的论文的参考文献列表建立在早期受交配和繁殖启发的优化器基础之上：高拉夫·迪曼和维贾伊·库马尔的[帝企鹅](https://www.edgepedia.org/zh/emperor-penguin)优化器（2018）<sup>[9](https://doi.org/10.1016/j.knosys.2018.06.001)</sup>、莫赫德·赫尔万·苏莱曼及其同事的藤壶交配优化器（2019）<sup>[10](https://doi.org/10.1016/j.engappai.2019.103330)</sup>、程然和金耀初的竞争群优化器（2014）<sup>[11](https://doi.org/10.1109/tcyb.2014.2322602)</sup>、贾扎·马哈茂德·阿卜杜拉和塔里克·艾哈迈德的适应度依赖优化器（2019）<sup>[12](https://doi.org/10.1109/access.2019.2907012)</sup>，以及埃萨姆·H·侯赛因及其同事的Lévy飞行分布（2020）<sup>[13](https://doi.org/10.1016/j.engappai.2020.103731)</sup>。

## 变体

综述文献将蛇优化算法的变体分为四类：改进变体、与其他元启发式算法的混合变体、面向离散问题的二值变体和多目标变体。<sup>[5](https://www.techscience.com/CMES/v147n1/67137/html)</sup>

- 二值版本：原始蛇优化算法仅处理连续搜索空间；使用S形传递函数的二值转换（BSO）被创建用于特征选择，而交叉增强版本（BSO-CV）将COVID-19数据集的维度降低了89%，而BSO为79%。<sup>[4](https://pmc.ncbi.nlm.nih.gov/articles/PMC9935299/)</sup> 名为指数SO、幂SO和延迟S形SO的自适应传递函数变体在24个数据集上使用KNN分类器进行了验证。<sup>[5](https://www.techscience.com/CMES/v147n1/67137/html)</sup>
- 改进变体：SNDSO由郑文达、艾一博和张卫东于2024年提出，用反正切非线性因子替代食物量控制，使用Sobol序列初始化，并加入学习策略。<sup>[14](https://doi.org/10.3390/math12111708)</sup> 增强蛇优化算法应用了反向学习和动态参数调整；改进蛇优化算法（MSO）将拉丁超立方采样与逻辑映射初始化、带缩放因子的反向学习以及来自RIME的软霜搜索策略相结合。<sup>[2](https://www.mdpi.com/2313-7673/11/2/137)</sup>
- 混合变体：混合蛇优化算法针对早熟收敛和种群多样性问题；蛇优化粒子群优化（SO-PSO）变体将PSO速度向量引入SO的探索阶段。<sup>[2](https://www.mdpi.com/2313-7673/11/2/137)</sup> 易卜拉欣·阿尔-舒尔巴吉及其同事于2022年提出了一种用于特征选择的并行爬行动物搜索算法与蛇优化算法方法。<sup>[15](https://doi.org/10.3390/math10132351)</sup>
- 多目标：MOSO由张世辉及其同事于2025年提出，增加了密度估计和网格索引，用于边缘计算任务卸载与调度。<sup>[16](https://doi.org/10.1007/s10586-024-04902-9)</sup>

## 应用

最初提出该算法的论文在四个工程设计问题上验证了SO：减速器、焊接梁、压力容器和拉压弹簧设计。<sup>[1](https://doi.org/10.1016/j.knosys.2022.108320)</sup> 后续工作将其扩展到静压推力轴承设计和无人机路径规划<sup>[2](https://www.mdpi.com/2313-7673/11/2/137)</sup>、特征选择和疾病诊断（包括COVID-19数据集）<sup>[4](https://pmc.ncbi.nlm.nih.gov/articles/PMC9935299/)</sup>、基于聚类的图像分割<sup>[5](https://www.techscience.com/CMES/v147n1/67137/html)</sup>、光伏参数估计<sup>[17](https://link.springer.com/article/10.1007/s10462-025-11272-0)</sup>、平面运动臂控制<sup>[18](https://peerj.com/articles/cs-2688/)</sup>，以及多无人机路径规划——其中一个改进变体相对于原始版本将平均迭代次数减少了34%<sup>[19](https://sage.cnpereading.com/doi/10.1177/01423312241263637)</sup>。综述文献报告了其在能源、工程、物联网、机器学习和大数据领域的应用，包括MPPT控制和波浪能转换器。<sup>[5](https://www.techscience.com/CMES/v147n1/67137/html)</sup>

## 局限与替代方案

已记录了几种失效模式。搜索偏向目前找到的最优解，这降低了种群多样性，可能导致早熟收敛和陷入局部极小。<sup>[6](https://www.scitepress.org/Papers/2022/115243/115243.pdf)</sup> 食物量切换使SO在探索方面强但在开发方面弱，导致收敛速度和精度较差。<sup>[7](https://www.mdpi.com/2227-7390/12/11/1708)</sup> 阈值设置直接权衡这些风险：低阈值容易导致早熟收敛，高阈值则减慢搜索。<sup>[5](https://www.techscience.com/CMES/v147n1/67137/html)</sup>

比较证据主要来自提出变体的论文。一项混合化研究报告了在CEC2017函数上270次实验测试的弗里德曼排名：SO-PSO为1.62，WOA为6.5，PSO为5.91，GWO为4.18，EO为1.98，LSHADE为4.53，SO为3.28，威尔科克森检验显示在96.42%的CEC17测试中存在显著差异。<sup>[20](https://doi.org/10.1016/j.jestch.2025.102077)</sup> 在基准算法中包含HHO或SSA的已发表比较存在于变体文献中。所有性能声明均来自提出SO变体的作者或持同情态度的综述，文献中可获得的最强方法论批评是“没有免费午餐”定理，该定理指出没有任何单一算法能解决所有问题。<sup>[7](https://www.mdpi.com/2227-7390/12/11/1708)</sup> 一篇2026年的系统综述总结了该领域的共识观点，即SO“在基准函数和实际应用上优于许多知名元启发式算法”，但针对基于CEC的比较方法的独立批判性评估尚未发表。<sup>[21](https://ideas.repec.org/a/spr/jcomop/v51y2026i2d10.1007_s10878-026-01403-w.html)</sup>

## References

1. [Fatma A. Hashim, Abdelazim G. Hussien (2022). Snake Optimizer: A novel meta-heuristic optimization algorithm. Knowledge-Based Systems.](https://doi.org/10.1016/j.knosys.2022.108320)
2. [MSO: A Modified Snake Optimizer for Engineering Applications (Biomimetics, MDPI)](https://www.mdpi.com/2313-7673/11/2/137)
3. [Snake Optimizer: A novel meta-heuristic optimization algorithm (bibliographic record)](https://scholarhub.vn/publication/Snake-Optimizer-A-novel-meta-heuristic-optimization-algorithm/cd121fa8-f74e-4ece-94a1-0c4272ace35f)
4. [An augmented Snake Optimizer for diseases and COVID-19 diagnosis](https://pmc.ncbi.nlm.nih.gov/articles/PMC9935299/)
5. [A Comprehensive Survey on Snake Optimizer and Its Performance Evaluation in Image Clustering Field (CMES)](https://www.techscience.com/CMES/v147n1/67137/html)
6. [New Evolutionary Selection Operators for Snake Optimizer (SCITEPRESS conference paper)](https://www.scitepress.org/Papers/2022/115243/115243.pdf)
7. [Improved Snake Optimizer Using Sobol Sequential Nonlinear Factors and Different Learning Strategies and Its Applications (SNDSO, Mathematics, MDPI)](https://www.mdpi.com/2227-7390/12/11/1708)
8. [R. Shine (2003). Reproductive strategies in snakes. Proceedings of the Royal Society B Biological Sciences.](https://doi.org/10.1098/rspb.2002.2307)
9. [Gaurav Dhiman, Vijay Kumar (2018). Emperor penguin optimizer: A bio-inspired algorithm for engineering problems. Knowledge-Based Systems.](https://doi.org/10.1016/j.knosys.2018.06.001)
10. [Mohd Herwan Sulaiman and colleagues (2019). Barnacles Mating Optimizer: A new bio-inspired algorithm for solving engineering optimization problems. Engineering Applications of Artificial Intelligence.](https://doi.org/10.1016/j.engappai.2019.103330)
11. [Ran Cheng, Yaochu Jin (2014). A Competitive Swarm Optimizer for Large Scale Optimization. IEEE Transactions on Cybernetics.](https://doi.org/10.1109/tcyb.2014.2322602)
12. [Jaza Mahmood Abdullah, Tarik Ahmed (2019). Fitness Dependent Optimizer: Inspired by the Bee Swarming Reproductive Process. IEEE Access.](https://doi.org/10.1109/access.2019.2907012)
13. [Essam H. Houssein and colleagues (2020). Lévy flight distribution: A new metaheuristic algorithm for solving engineering optimization problems. Engineering Applications of Artificial Intelligence.](https://doi.org/10.1016/j.engappai.2020.103731)
14. [Wenda Zheng, Yibo Ai, Weidong Zhang (2024). Improved Snake Optimizer Using Sobol Sequential Nonlinear Factors and Different Learning Strategies and Its Applications. Mathematics.](https://doi.org/10.3390/math12111708)
15. [Ibrahim Al-Shourbaji and colleagues (2022). An Efficient Parallel Reptile Search Algorithm and Snake Optimizer Approach for Feature Selection. Mathematics.](https://doi.org/10.3390/math10132351)
16. [Shi-Hui Zhang and colleagues (2025). MOSO: multi-objective snake optimizer with density estimation and grid indexing mechanism for edge computing task offloading and scheduling optimization. Cluster Computing.](https://doi.org/10.1007/s10586-024-04902-9)
17. [Estimation of photovoltaic parameters by dynamic updating and selecting a snake optimizer based on multi-directional optimization (Artificial Intelligence Review)](https://link.springer.com/article/10.1007/s10462-025-11272-0)
18. [Multi-task snake optimization algorithm for global optimization and planar kinematic arm control problem (PeerJ Computer Science)](https://peerj.com/articles/cs-2688/)
19. [Improved adaptive snake optimization algorithm with application to multi-UAV path planning (Transactions of the Institute of Measurement and Control)](https://sage.cnpereading.com/doi/10.1177/01423312241263637)
20. [Hybridization of the Snake Optimizer and Particle Swarm Optimization for continuous optimization problems (SO-PSO)](https://doi.org/10.1016/j.jestch.2025.102077)
21. [A systematic review of recent advances in snake optimizer algorithm (Journal of Combinatorial Optimization, abstract record)](https://ideas.repec.org/a/spr/jcomop/v51y2026i2d10.1007_s10878-026-01403-w.html)
22. [aimspress.com](https://www.aimspress.com/aimspress-data/mbe/2023/6/PDF/mbe-20-06-423.pdf)
23. [Improved Snake Optimization Algorithm for Global Optimization and Engineering Applications, Scientific Reports](https://www.nature.com/articles/s41598-025-01299-2)

---
*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/snake-optimizer

English original: https://www.edgepedia.org/snake-optimizer
