# 二次分配问题

二次分配问题（quadratic assignment problem, QAP）是一个组合优化问题：须将 n 个设施分配到 n 个位置，每个位置一个设施，使得总成本最小化——总成本按所有设施对的流量乘以距离之和计算。该问题由恰林·C·库普曼斯（Tjalling C. Koopmans）与马丁·J·贝克曼（Martin J. Beckmann）于 1957 年提出，作为经济区位决策的数学模型，被视为组合优化中最难的问题之一：它是 NP 难的、难以近似，且某些规模为 36 和 64 的特殊结构 QAP 实例已被精确求解并证明最优<sup>[25](https://pmc.ncbi.nlm.nih.gov/articles/PMC7844628/)</sup>。

| 关键事实 | 详情 |
|---|---|
| 起源 | 由库普曼斯与贝克曼（1957）在《计量经济学》（*Econometrica*）25(1)，第 53–76 页提出，作为经济活动选址的模型<sup>[1](https://www.sciencedirect.com/science/article/pii/S0377221705008337)</sup><sup> • </sup><sup>[2](https://www.columbia.edu/~md3405/Working_Paper_9_Complete.pdf)</sup> |
| 目标 | 在排列 p 上最小化 a\_ij · b\_p(i),p(j) 之和，其中 A 为设施间的流量矩阵，B 为位置间的距离矩阵<sup>[3](https://qaplib.mgi.polymtl.ca/)</sup> |
| 复杂度 | 强 NP 难，且寻找近似解同样困难；一个多项式时间 ε-近似将意味着 P = NP（萨尼与冈萨雷斯，1976）<sup>[4](https://ufdcimages.uflib.ufl.edu/AA/00/03/83/10/00001/algorithmsfornon00pits.pdf)</sup><sup> • </sup><sup>[5](https://www.sciencedirect.com/science/article/pii/S0377221720309814)</sup> |
| 精确求解前沿 | 尚不知有任何方法能精确求解规模大于 30 的 QAP 实例，而旅行商问题对数百或数千个位置的实例均可精确求解<sup>[6](https://arxiv.org/abs/2310.01604)</sup> |
| 基准库 | QAPLIB 于 1991 年首次发布，提供统一的测试平台；求解规模 n = 25 的实例仍被认为在计算上并非易事<sup>[7](https://doi.org/10.7488/ds/3428)</sup> |
| 主要应用 | 设施布局：将校园建筑、医院科室或制造工厂分配到场地，以最小化流量运输<sup>[1](https://www.sciencedirect.com/science/article/pii/S0377221705008337)</sup> |

## 形式化表述

在库普曼斯–贝克曼表述中，每个设施被指定到恰好一个位置，每个位置恰好容纳一个设施。位置间的距离、设施间的需求流量，以及一般情形下设施到位置的分配成本均为已知。一个分配方案的成本是所有可能距离–流量乘积之和，QAP 即是在此度量下寻找最小成本分配<sup>[1](https://www.sciencedirect.com/science/article/pii/S0377221705008337)</sup>。

QAPLIB 给出纯二次形式，实例数据由整数 n 和两个 n × n 矩阵 A、B 组成，一为流量矩阵，一为距离矩阵。目标为

\[ \min_{p} \sum_{i=1}^{n} \sum_{j=1}^{n} a_{ij} \cdot b_{p(i),\,p(j)} \]

其中 p 是一个排列<sup>[3](https://qaplib.mgi.polymtl.ca/)</sup>。二次项正是 QAP 区别于线性分配问题之处——后者存在多项式时间解法；分配对之间的交互成本使二次推广成为 NP 难<sup>[8](https://www.nature.com/nature-index/topics/l4/combinatorial-optimization-techniques-for-assignment-problems)</sup>。

## 起源

库普曼斯与贝克曼在《分配问题与经济活动的区位》（《计量经济学》，25(1)，1957）中提出该问题，经由耶鲁大学考尔斯经济学研究基金会发表，处理的是带工厂间运输成本的工厂选址分配<sup>[2](https://www.columbia.edu/~md3405/Working_Paper_9_Complete.pdf)</sup><sup> • </sup><sup>[9](https://books.google.com/books/about/Assignment_Problems_and_the_Location_of.html?id=Kjs24p57FxgC)</sup>。此后该问题持续受到关注：一项综述发现自 1999 年以来发表的文献超过 100 篇，此后又有多部专著和综述文章问世<sup>[1](https://www.sciencedirect.com/science/article/pii/S0377221705008337)</sup>。

## 应用

**设施布局**是最常见的应用。迪基与霍普金斯（Dickey and Hopkins，1972）将 QAP 用于大学校园建筑的分配，埃尔沙费伊（Elshafei，1977）用于医院规划，博斯（Bos，1993）用于森林公园问题；本贾法尔（Benjaafar，2002）提出了以最小化在制品（WIP）为目标的设施布局表述，并表明基于 WIP 的表述所得到的布局可能与常规 QAP 表述有显著差异<sup>[1](https://www.sciencedirect.com/science/article/pii/S0377221705008337)</sup>。

埃尔沙费伊的医院论文将医院科室的位置安排形式化，以最小化患者行走的总距离，讨论了实际考量，并给出了一个启发式方法及其计算实验结果<sup>[10](https://www.tandfonline.com/doi/abs/10.1057/jors.1977.29)</sup>。医院布局至今仍是活跃的 QAP 应用场景：2021 年的一项研究将既有医院的改造表述为 QAP，采用从建筑空间网络计算出的测地、可步行距离，在面向建筑师的 CAD 环境中实现了启发式迭代局部搜索求解器，并在三维真实测试案例上演示了该方法<sup>[11](https://repository.tudelft.nl/record/uuid%3A2d1d3c0f-18ae-42a0-a379-e698f5586400)</sup>。

**其他有记载的应用**包括：底板布线，斯坦伯格（Steinberg，1961）用 QAP 最小化元件间的连接；经济问题（赫夫利，1972，1980）；警察岗亭、超市和学校的选址（弗朗西斯与怀特，1974）；调度（杰弗里翁与格雷夫斯，1976）；打字机键盘与控制面板设计（波拉切克等，1976）；考古学（克拉鲁普与普鲁赞，1978）；统计分析（休伯特，1987）；反应化学（福斯伯格等，1994）；以及数值分析（布鲁斯科与斯塔尔，2000）<sup>[1](https://www.sciencedirect.com/science/article/pii/S0377221705008337)</sup>。在电子领域，超大规模集成电路（VLSI）单元布局被表述为 QAP，通过放置模块使相连模块间的总加权欧几里得距离最小<sup>[12](https://research-portal.uea.ac.uk/en/publications/quadratic-assignment-algorithm-that-takes-module-size-into-accoun/)</sup>，IBM 1976 年的布局研究考察了将布局问题转化为 IC 封装、卡和 LSI 电路的相关 QAP<sup>[13](https://research.ibm.com/publications/some-experimental-results-on-placement-techniques)</sup>。

QAP 还充当一种通用的建模语言：旅行商问题、最大团问题、图划分问题和最小反馈弧集问题均可表述为 QAP<sup>[14](https://link.springer.com/book/10.1007/978-1-4757-2787-6)</sup>。

## 计算难度

QAP 是强 NP 难的，甚至寻找 ε-近似解也很困难，其意义在于：一个多项式时间的 ε-近似算法将意味着 P = NP（萨尼与冈萨雷斯，1976）<sup>[4](https://ufdcimages.uflib.ufl.edu/AA/00/03/83/10/00001/algorithmsfornon00pits.pdf)</sup>。在实践中，该问题在中等规模以上即被视为难以处理：为库普曼斯–贝克曼形式设计的精确算法只能处理小规模问题，最好情况约为 n = 40，而大于 30 的一般实例一直抗拒精确求解，尽管某些规模为 36 和 64 的特殊结构实例已被精确求解<sup>[6](https://arxiv.org/abs/2310.01604)</sup><sup> • </sup><sup>[15](https://www.sciencedirect.com/science/article/pii/S030505482400176X)</sup><sup> • </sup><sup>[25](https://pmc.ncbi.nlm.nih.gov/articles/PMC7844628/)</sup>。这与旅行商问题形成对比——现代整数规划对数百或数千个位置的实例均可求解至最优<sup>[6](https://arxiv.org/abs/2310.01604)</sup>。

## 求解方法

**精确方法**依赖于由下界支撑的分支定界搜索。综述按数学来源对 QAP 表述进行分类，并讨论用于为精确算法和启发式算法定义下界的理论资源<sup>[1](https://www.sciencedirect.com/science/article/pii/S0377221705008337)</sup>。由于目标是二次的，大量工作投入线性化：通过拆分系数矩阵 A 或 B 构建混合整数线性规划表述<sup>[16](https://www.sciencedirect.com/science/article/abs/pii/S0305054812000433)</sup>，线性化之间的比较表明，例如亚当斯与约翰逊线性化的线性松弛包含于夏与袁的线性松弛之中<sup>[17](https://arxiv.org/abs/1710.02472)</sup>。半定松弛是另一类精确求解工具；它们在许多实例中计算全局最优解，并被用作枚举过程内的子程序，近期工作给出了输入矩阵上的确定性线性不等式条件，在这些条件下这些松弛是精确的<sup>[18](https://arxiv.org/abs/2409.08802)</sup>。

**启发式与元启发式**承担了大部分实际负荷。近似策略分为构造性初始放置——逐步构建解——和迭代改进（爬山法）——精化初始安排；模拟退火可视为迭代方法的一个变体<sup>[19](https://www.sciencedirect.com/science/article/pii/S0926580599000059)</sup>。元启发式被描述为 QAP 最有效、最广泛使用的方法之一，在精确方法无法运作的情况下，能在短时间内给出良好的解质量<sup>[20](https://ideas.repec.org/a/ids/ijores/v57y2026i1p105-134.html)</sup>。在 QAPLIB 实例上报告的性能包括：模拟退火找到 40 个已知最佳解中的 26 个，蚂蚁系统 44 个中的 33 个，贪婪遗传算法 87 个中的 58 个，混合遗传算法 130 个中的 84 个，与已知最佳值的平均偏差在 0.17% 至 0.99% 之间<sup>[21](https://www.aimsciences.org/article/doi/10.3934/jimo.2018041)</sup>。

**基于学习的求解器**是近期的补充。一种使用双指针网络的深度强化学习方法，在合成实例上用 A2C 训练，产生的样本外解与高品质局部搜索基线的平均偏差在 7.5% 以内，并在 1.2% 的实例上优于该基线，且无需针对特定实例重新训练<sup>[6](https://arxiv.org/abs/2310.01604)</sup>。一种通过强化学习训练的两阶段图指针网络在 QAPLIB 和 TSPlib 基准上提供了半最优解<sup>[22](https://arxiv.org/abs/2404.00539)</sup>。专用硬件也在发挥作用：一个存内计算框架将可行空间局部搜索启发式与基于忆阻器的模拟伊辛硬件协同设计，利用大规模并行邻域评估，因为将 QAP 这类受约束问题映射到 QUBO 表述会引入开销并限制并行性<sup>[23](https://arxiv.org/abs/2503.09676)</sup>。

## 在 QAPLIB 上的基准测试

QAPLIB 建立于 1991 年，旨在提供一个统一的测试平台，收录了当时其作者伯卡德、切拉、卡里施和伦德尔所能获取的几乎所有 QAP 实例<sup>[7](https://doi.org/10.7488/ds/3428)</sup>。存档库包含 136 个实例和 111 个解，数据文件列出 n、A 和 B；已知最佳目标值附有该解是最优还是启发式导出的说明，启发式包括蚂蚁系统和遗传混合方法<sup>[3](https://qaplib.mgi.polymtl.ca/)</sup>。实例家族以其作者命名，如纽金特、埃尔沙费伊、斯坦伯格、塔亚尔、哈德利和克拉鲁普<sup>[3](https://qaplib.mgi.polymtl.ca/)</sup>。公开排行榜跟踪这些实例上的目标值；例如，tai12a 的最优值为 224,416，tai35b 为 283,315,443<sup>[24](https://www.sota2.com/research/sota/quadratic-assignment-problem-on-qaplib)</sup>。

## QAP 为何难以取得进展

QAP 与其线性兄弟之间的差距来自目标的结构。在线性分配问题中，每个设施的成本仅取决于它自己的位置，因此问题可分解，存在多项式算法。在 QAP 中，放置一个设施的成本取决于所有其他设施所在的位置，通过流量–距离乘积起作用，因此不存在这样的分解<sup>[8](https://www.nature.com/nature-index/topics/l4/combinatorial-optimization-techniques-for-assignment-problems)</sup>。加之排列空间的组合规模，这使 QAP 成为精确求解器、元启发式以及近期基于学习和硬件加速的优化器的标准压力测试<sup>[5](https://www.sciencedirect.com/science/article/pii/S0377221720309814)</sup><sup> • </sup><sup>[23](https://arxiv.org/abs/2503.09676)</sup>。

## References

1. [Loiola, de Abreu, Boaventura-Netto, Hahn and Querido (2007). A survey for the quadratic assignment problem. European Journal of Operational Research.](https://www.sciencedirect.com/science/article/pii/S0377221705008337)
2. [Assignment Problems and the Location of Economic Activities, Koopmans and Beckmann, Econometrica 25(1), 1957 (citation context)](https://www.columbia.edu/~md3405/Working_Paper_9_Complete.pdf)
3. [QAPLIB - A Quadratic Assignment Problem Library, Problem Instances and Solutions](https://qaplib.mgi.polymtl.ca/)
4. [Algorithms for nonlinear assignment problems (Pitsoulis), University of Florida](https://ufdcimages.uflib.ufl.edu/AA/00/03/83/10/00001/algorithmsfornon00pits.pdf)
5. [Erdoğan et al. (2021). Quadratic assignment problem variants: A survey and an effective parallel memetic iterated tabu search. EJOR.](https://www.sciencedirect.com/science/article/pii/S0377221720309814)
6. [Bagga and Delarue (2023). Solving the Quadratic Assignment Problem using Deep Reinforcement Learning. arXiv:2310.01604.](https://arxiv.org/abs/2310.01604)
7. [Burkard, Çela, Karisch, Rendl, Anjos and Hahn (2022). QAPLIB - A Quadratic Assignment Problem Library, dataset.](https://doi.org/10.7488/ds/3428)
8. [Combinatorial Optimization Techniques for Assignment Problems, Nature Index topic page](https://www.nature.com/nature-index/topics/l4/combinatorial-optimization-techniques-for-assignment-problems)
9. [Assignment Problems and the Location of Economic Activities, Koopmans and Beckmann, Cowles Foundation, 1957 (Google Books record)](https://books.google.com/books/about/Assignment_Problems_and_the_Location_of.html?id=Kjs24p57FxgC)
10. [Elshafei (1977). Hospital Layout as a Quadratic Assignment Problem. Journal of the Operational Research Society 28(1), 167–179.](https://www.tandfonline.com/doi/abs/10.1057/jors.1977.29)
11. [Cubukcuoglu et al. (2021). Hospital layout design renovation as a Quadratic Assignment Problem with geodesic distances. TU Delft Repository.](https://repository.tudelft.nl/record/uuid%3A2d1d3c0f-18ae-42a0-a379-e698f5586400)
12. [Quadratic assignment algorithm that takes module size into account, University of East Anglia](https://research-portal.uea.ac.uk/en/publications/quadratic-assignment-algorithm-that-takes-module-size-into-accoun/)
13. [Hanan, Wolff and Agule (1976). Some experimental results on placement techniques. DAC 1976, IBM Research.](https://research.ibm.com/publications/some-experimental-results-on-placement-techniques)
14. [Çela. The Quadratic Assignment Problem: Theory and Algorithms. Springer.](https://link.springer.com/book/10.1007/978-1-4757-2787-6)
15. [Experimental analysis of algorithms for the independent quadratic assignment problem. Computers & Operations Research 168 (2024).](https://www.sciencedirect.com/science/article/pii/S030505482400176X)
16. [New linearizations of quadratic assignment problems. Computers & Operations Research.](https://www.sciencedirect.com/science/article/abs/pii/S0305054812000433)
17. [The quadratic assignment problem: the linearization of Xia and Yuan is weaker than the linearization of Adams and Johnson. arXiv:1710.02472.](https://arxiv.org/abs/1710.02472)
18. [Chen and Soh (2024). Exactness Conditions for Semidefinite Relaxations of the Quadratic Assignment Problem. arXiv:2409.08802.](https://arxiv.org/abs/2409.08802)
19. [Meller and Gau (1996). Automated facilities layout: past, present and future. Automation in Construction.](https://www.sciencedirect.com/science/article/pii/S0926580599000059)
20. [Abdul-Rahman et al. (2026). Metaheuristic approaches for quadratic assignment problem: recent advancements and potential path. International Journal of Operational Research 57(1).](https://ideas.repec.org/a/ids/ijores/v57y2026i1p105-134.html)
21. [A parallel water flow algorithm with local search for solving the quadratic assignment problem. Journal of Industrial and Management Optimization.](https://www.aimsciences.org/article/doi/10.3934/jimo.2018041)
22. [Iida and Yasudo (2024). Solving the QAP by Two-Stage Graph Pointer Networks and Reinforcement Learning. arXiv:2404.00539.](https://arxiv.org/abs/2404.00539)
23. [Im et al. (2025). Hardware-Compatible Single-Shot Feasible-Space Heuristics for Solving the Quadratic Assignment Problem. arXiv:2503.09676.](https://arxiv.org/abs/2503.09676)
24. [Quadratic Assignment Problem on QAPLIB benchmark leaderboard, SOTA2 Research](https://www.sota2.com/research/sota/quadratic-assignment-problem-on-qaplib)
25. [pmc.ncbi.nlm.nih.gov](https://pmc.ncbi.nlm.nih.gov/articles/PMC7844628/)

---
*Initially written Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › General discrete mathematics and discrete structures › Combinatorics

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/quadratic-assignment-problem

English original: https://www.edgepedia.org/quadratic-assignment-problem
