# Lin–Kernighan启发式算法

**Lin–Kernighan启发式算法**（LK）是一种用于对称旅行商问题的局部搜索算法，由贝尔电话实验室的林申（Shen Lin）与布莱恩·W·克尼根（Brian W. Kernighan）于1973年发表，其特点是通过反复交换数量可变的边而非固定数量的边来改进巡回路线<sup>[1](https://pubsonline.informs.org/doi/10.1287/opre.21.2.498)</sup>。它被视为求解TSP最成功的启发式算法之一，且在发表数十年后仍保持着TSP局部搜索的顶尖水平<sup>[2](https://www.sciencedirect.com/science/article/abs/pii/S0377221710005485)</sup>。其后续发展——尤其是赫尔斯高恩的LKH实现——是该问题及其变体最强大的实用工具之一<sup>[3](https://www.sciencedirect.com/science/article/pii/S0305054826000614)</sup>。

| 关键事实 | 详情 |
|---|---|
| 原始文献 | 林申与布莱恩·W·克尼根，《一种求解旅行商问题的有效启发式算法》，《运筹学》21(2):498–516，1973<sup>[1](https://pubsonline.informs.org/doi/10.1287/opre.21.2.498)</sup> |
| 核心思想 | 变深度搜索：每一步选择一个k值可变的k-opt移动，沿交替环在增益准则引导下交换边<sup>[4](https://arxiv.org/abs/2502.00316)</sup><sup> • </sup><sup>[3](https://www.sciencedirect.com/science/article/pii/S0305054826000614)</sup> |
| 1973年结果 | 对所有测试问题（最多110个城市）均得到最优解；运行时间约按n<sup>2</sup>增长，100城市算例在GE635上耗时不到25秒<sup>[1](https://pubsonline.informs.org/doi/10.1287/opre.21.2.498)</sup> |
| 解的质量 | 在随机欧几里得实例上，LK相对Held–Karp下界的平均超出量约为2.0%，而2-opt约为4.9%，3-opt约为3.0%<sup>[5](https://www.ac.tuwien.ac.at/files/pub/wachter_15.pdf)</sup> |
| 领先实现 | LKH（赫尔斯高恩，2000）；LKH-3将该方法扩展到约40种TSP及车辆路径问题的变体<sup>[6](https://arxiv.org/abs/2501.04072)</sup> |
| 推广 | 变深度搜索机制已被表述为一种与问题无关的搜索算法，可应用于TSP之外的领域<sup>[4](https://arxiv.org/abs/2502.00316)</sup> |

## 变深度思想

固定k的局部搜索方法——如2-opt（移除巡回路线上的两条边，将由此得到的两条路径以另一种方式重新连接），或3-opt（移除三条边）——只考察某一预定规模的移动。Lin–Kernighan过程则执行k值可变的k-opt移动：每一步构造一个待从当前巡回路线中移除的边集X和一个用于替换的边集Y，沿交替环每次加入一对边，仅当累积增益准则得到满足时才接受该交换<sup>[3](https://www.sciencedirect.com/science/article/pii/S0305054826000614)</sup><sup> • </sup><sup>[7](https://iridia.ulb.ac.be/~stuetzle/Teaching/HO/Slides/Lecture3.pdf)</sup>。由于深度k是动态选取而非预先固定的，该算法能够达到任何固定小k所无法表达的改进。

克尼根与林将同一底层机制——称为变深度搜索——应用于图划分问题，形成了独立的Kernighan–Lin算法。尽管两种算法针对不同问题，它们共享这一与问题无关的机制，后来的工作将其推广为一个超越二者的搜索框架<sup>[4](https://arxiv.org/abs/2502.00316)</sup>。

## 1973年的原始结果

1973年的论文报告了一种用于生成对称TSP最优解与近优解的高效方法，并指出该通用方法被认为在组合优化中具有广泛的适用性。在当时文献中出现的经典问题以及随机生成的最多110个城市的测试问题上，该方法对所有测试问题均产生了最优解。运行时间约按n<sup>2</sup>增长；以绝对数值而言，一个典型的100城市问题在GE635计算机上单个算例耗时不到25秒，而以95%以上置信度获得最优解约需三分钟<sup>[1](https://pubsonline.informs.org/doi/10.1287/opre.21.2.498)</sup>。

## 解的质量与成本

后来的基准测试表明，LK在巡回路线质量上明显优于较简单的交换启发式算法。在节点数从10<sup>2</sup>到10<sup>6</sup>的随机欧几里得实例上，LK相对Held–Karp下界（一种标准质量标尺）的平均超出量在所有规模上都保持在2.0附近，而2-opt约为4.9，3-opt约为3.0<sup>[5](https://www.ac.tuwien.ac.at/files/pub/wachter_15.pdf)</sup>。这种质量以运行时间为代价：在一项针对10至30个站点的小规模实例的比较中，LK的执行时间随规模急剧上升，从10个站点时的0.024秒增至30个站点时的412.8秒，而2-opt在30个站点时为0.011秒，3-opt为0.109秒<sup>[8](https://personales.upv.es/thinkmind/dl/conferences/geoprocessing/geoprocessing_2013/geoprocessing_2013_7_40_30146.pdf)</sup>。一份复杂度结果综述指出，Lin–Kernighan算法的平均时间复杂度以O(n<sup>2.2</sup>)为上界<sup>[9](https://digital.library.adelaide.edu.au/server/api/core/bitstreams/f93c9432-fd8d-4340-b4a0-302b596ae70c/content)</sup>。

高效实现依赖于特殊的数据结构以及存储和更新潜在可用移动的候选列表；一项针对1,000至1,000,000个节点问题的大规模测试系列发现，基于此类技术构建的茎-环弹出链算法优于所有受测的LK过程实现<sup>[10](https://www.sciencedirect.com/science/article/abs/pii/S0305054805001942)</sup>。

## 理论保证

LK是一种启发式算法，其在度量实例上的最坏情况行为直到最近才被量化。对于任意不小于3的固定k，k-opt算法在度量TSP上的近似比为O(n<sup>1/k</sup>)，且在Erdős围长猜想成立的前提下有匹配下界Ω(n<sup>1/k</sup>)；无条件地，匹配界对k = 3、4、6成立，而已知下界为Ω(n<sup>2/(3k−3)</sup>)。这些上界也适用于Lin–Kernighan算法在适当参数下的参数化推广<sup>[11](https://arxiv.org/abs/1909.12755)</sup>。

## LKH与现代后裔

LK发展最充分的变体是赫尔斯高恩的Lin–Kernighan–Helsgaun启发式算法（LKH），首次发表于2000年<sup>[3](https://www.sciencedirect.com/science/article/pii/S0305054826000614)</sup>。LKH-2给出了LK框架内k-opt的一种高效实现<sup>[12](https://www2.seas.gwu.edu/~simhaweb/champalg/tsp/papers/Helsgaun2.pdf)</sup>，LKH-3将该方法扩展到约40种TSP及车辆路径问题的变体<sup>[6](https://arxiv.org/abs/2501.04072)</sup>。一个独特的要素是α-近邻度，一种由最小1-树（生成树加一条额外边的最小权重版本）导出的候选边选取度量；最优路径通常包含最小1-树70%至80%的边，这使1-树成为判断哪些边值得关注的合适指南<sup>[13](https://link.springer.com/article/10.1016/j.jksuci.2023.101723)</sup>。

85,900个城市的pla85900基准的纪录历史显示了这一家族的作用。首个记录值142,514,146由[大卫·S·约翰逊](https://www.edgepedia.org/zh/david-s-johnson)于1991年6月7日以迭代Lin-Kernighan方法创下；凯尔德·赫尔斯高恩的LKH于1998年以142,416,327夺下纪录并多次刷新，于2004年5月2日达到142,382,641，其间Concorde的巡回路线合并与混合方法也曾持有中间纪录<sup>[14](https://www.math.uwaterloo.ca/tsp/pla85900/heur/heur.htm)</sup>。

LK也被用于精确求解器内部。基于整数规划的求解器Concorde将Lin–Kernighan启发式算法的一种链式变体用作其起始启发式；在小规模度量实例上，该起始启发式几乎在所有情况下都能找到最优巡回路线，因此后续的整数规划只需证明最优性<sup>[3](https://www.sciencedirect.com/science/article/pii/S0305054826000614)</sup>。

## 超越普通TSP的应用

该启发式算法已被适配到问题变体。对于广义旅行商问题（GTSP）——其中顶点被分组为簇，每簇须访问一个顶点——卡拉佩强与古京描述了原始启发式算法并提出了若干适配方案；他们的LK适配重现了原方法的成功，其变体在解质量与运行时间的广泛权衡范围内优于所有其他受比较的启发式算法，使LK成为他们比较中GTSP局部搜索的顶尖方法<sup>[2](https://www.sciencedirect.com/science/article/abs/pii/S0377221710005485)</sup>。基于LKH的方法也已与强化学习结合：变策略强化LKH（VSR-LKH）融入[Q学习](https://www.edgepedia.org/zh/q-learning)、Sarsa和蒙特卡洛方法来引导搜索<sup>[15](https://arxiv.org/abs/2207.03876)</sup>，NeuroLKH则将深度学习模型与LKH启发式算法耦合<sup>[16](https://ijca.phdfocus.com/archives/volume187/issue113/comparative-study-of-traveling-salesman-problem-solvers-exact-heuristic-and-learning-based-methods/)</sup>。

## References

1. [S. Lin, B. W. Kernighan (1973). An Effective Heuristic Algorithm for the Traveling-Salesman Problem. Operations Research 21(2):498–516.](https://pubsonline.informs.org/doi/10.1287/opre.21.2.498)
2. [D. Karapetyan, G. Gutin (2010). Lin–Kernighan heuristic adaptations for the generalized traveling salesman problem. European Journal of Operational Research.](https://www.sciencedirect.com/science/article/abs/pii/S0377221710005485)
3. [A speed-up for Helsgaun's TSP heuristic by relaxing the positive gain criterion. Computers & Operations Research.](https://www.sciencedirect.com/science/article/pii/S0305054826000614)
4. [A. Dasdan (2025). The Kernighan-Lin Search Algorithm. arXiv:2502.00316.](https://arxiv.org/abs/2502.00316)
5. [M. Wächter et al. The 2-Opt/3-Opt local search or Lin Kernighan Algorithm (comparison tables). TU Wien.](https://www.ac.tuwien.ac.at/files/pub/wachter_15.pdf)
6. [Multi-armed Bandit and Backbone boost Lin-Kernighan-Helsgaun Algorithm for the Traveling Salesman Problems. arXiv:2501.04072.](https://arxiv.org/abs/2501.04072)
7. [Heuristic Optimization, Lecture 3: Lin-Kernighan algorithm. IRIDIA, Université Libre de Bruxelles.](https://iridia.ulb.ac.be/~stuetzle/Teaching/HO/Slides/Lecture3.pdf)
8. [Improvement heuristics comparison (2-OPT, 3-OPT, Lin and Kernighan). THINKmind Geoprocessing 2013.](https://personales.upv.es/thinkmind/dl/conferences/geoprocessing/geoprocessing_2013/geoprocessing_2013_7_40_30146.pdf)
9. [Diversity Optimization and Parameterized Analysis of Heuristic Search Methods for Combinatorial Optimization Problems. University of Adelaide thesis.](https://digital.library.adelaide.edu.au/server/api/core/bitstreams/f93c9432-fd8d-4340-b4a0-302b596ae70c/content)
10. [Implementation analysis of efficient heuristic algorithms for the traveling salesman problem. Computers & Operations Research 33(4):1154–1172, 2006.](https://www.sciencedirect.com/science/article/abs/pii/S0305054805001942)
11. [X. Zhong (2019, rev. 2024). On the Approximation Ratio of the k-Opt and Lin-Kernighan Algorithm. arXiv:1909.12755.](https://arxiv.org/abs/1909.12755)
12. [K. Helsgaun (2009). An effective implementation of k-opt in LKH-2. Mathematical Programming Computation 1:119–163.](https://www2.seas.gwu.edu/~simhaweb/champalg/tsp/papers/Helsgaun2.pdf)
13. [Discovering Lin-Kernighan-Helsgaun heuristic for routing optimization using self-supervised reinforcement learning. Journal of King Saud University – Computer and Information Sciences, 2023.](https://link.springer.com/article/10.1016/j.jksuci.2023.101723)
14. [15-Year Race for Better Tours (pla85900 records). TSP page, University of Waterloo.](https://www.math.uwaterloo.ca/tsp/pla85900/heur/heur.htm)
15. [Reinforced Lin-Kernighan-Helsgaun Algorithms for the Traveling Salesman Problems. arXiv:2207.03876.](https://arxiv.org/abs/2207.03876)
16. [Comparative Study of Traveling Salesman Problem Solvers: Exact, Heuristic, and Learning-Based Methods. International Journal of Computer Applications.](https://ijca.phdfocus.com/archives/volume187/issue113/comparative-study-of-traveling-salesman-problem-solvers-exact-heuristic-and-learning-based-methods/)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods › Graph and network algorithms › Hard graph problems and heuristics

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/lin-kernighan-heuristic

English original: https://www.edgepedia.org/lin-kernighan-heuristic
