---
title: Quadratic Assignment Problem (QAP)
url: https://www.emergentmind.com/topics/quadratic-assignment-problems-qap
type: topic
---

# Quadratic Assignment Problem (QAP)

The Quadratic Assignment Problem (QAP) is a central model in combinatorial optimization, representing a class of discrete, permutation-based assignment problems where cost depends bilinearly on an assignment through two weight matrices. QAPs model applications ranging from facility layout and electronic circuit design to protein structure and NMR assignment. First formally described by Koopmans and Beckmann (1957), QAP is among the most computationally challenging NP-hard problems: the search space is of factorial size, and no algorithm is known to solve general instances with $n > 36$ to optimality in reasonable time. Research in QAP has produced an array of methodologies, from mathematical programming and convex relaxation to metaheuristic and quantum approaches, each contributing to state-of-the-art understanding, lower bounds, and practical algorithms.

## 1. Mathematical Models and Formulations

The standard QAP is defined on $n$ facilities and $n$ locations, with $A \in \mathbb{R}^{n \times n}$ capturing flows or interactions between facilities, and $B \in \mathbb{R}^{n \times n}$ giving costs or distances between locations. The permutation $\pi \in S_n$ assigns each facility $i$ to location $\pi(i)$. The objective is to minimize the total assignment cost:
\[
\min_{\pi \in S_n} \sum_{i=1}^n \sum_{j=1}^n A_{ij}\; B_{\pi(i)\pi(j)}
\]
This can be re-expressed with assignment matrices or via 0-1 variables $x_{ik}$ representing facility $i$ assigned to location $k$, yielding a quadratic integer program:
\[
\min_{x} \sum_{i=1}^n \sum_{j=1}^n \sum_{k=1}^n \sum_{\ell=1}^n  A_{ij} B_{k\ell} x_{ik} x_{j\ell}
\]
subject to row and column sum constraints enforcing $x$ as a permutation matrix.

Special cases include the Traveling Salesman Problem (TSP), which can be represented within QAP via a specific choice of flow matrix $A$, and facility location problems as linearizations. QAP is a prototype for permutation-based optimization—its solution space is the set of all $n!$ permutations.

## 2. Computational Complexity and Hardness

QAP is classified as strongly NP-hard, with exact algorithms (e.g., branch-and-bound, branch-and-cut, and dynamic programming) becoming infeasible for $n > 36$ due to factorial complexity of the search space [1405.5050]. Statistical mechanical analysis reveals that for random instances, the optimal cost's asymptotic scaling is governed by the means and variances of $A$ and $B$ alone; deviations from the expected cost are of order $N^{3/2}$ rather than $N^2$, implying that global structure is difficult to exploit algorithmically in the large $n$ limit [1101.0779].

A key theoretical development is the QAP-SAT framework, which demonstrates a phase transition in satisfiability and computational effort as problem clause density crosses a critical threshold. The order-parameter $\lambda = m / (5.23\,n^{-0.760} m_1^{0.904})$ accurately predicts the hardest QAP instances, offering a mechanism for generating or identifying benchmark instances near the computational "phase transition" [2403.02783].

## 3. Convex Relaxations and Mathematical Programming Methods

### Reformulation Linearization Techniques (RLT)

RLT methods systematically relax and linearize the quadratic structure, creating increasingly tight linear programs at the expense of memory and computation. RLT-2, involving triple-indexed variables, delivers tight lower bounds for $n\leq 40$ when combined with memory-efficient, parallelized dual ascent and assignment schemes mapped onto GPU clusters [1510.02065, 1710.03732]. RLT-3, though tighter, requires extreme memory (up to 700GB for $n=30$) [1510.02065].

### Semidefinite and Doubly Nonnegative (DNN) Relaxations

Standard semidefinite relaxations (SDP) lift the problem to a rank-one constraint on a positive semidefinite matrix embedding permutation structure [2408.05942, 2409.08802]. These relaxations are tight for small $n$ or specially-structured input (e.g., signal-plus-small-noise, anti-symmetric cost structure), with exactness guaranteed under algebraic spectral conditions or systems of linear inequalities involving $A, B$ [2408.05942, 2409.08802]. Recent work provides verifiable, deterministic, and purely algebraic sufficient conditions for SDR exactness—whenever these hold, the global optimum is attained at a permutation matrix and the relaxation is tight [2408.05942, 2409.08802].

For larger and sparse QAPs, blockwise and clique-based SDPs exploit problem structure to reformulate the global PSD constraint as a set of smaller PSD blocks, greatly improving scalability ($O(n^4)$ vs $O(n^6)$ per iteration) with strong empirical lower bounds in real-world applications such as NMR spectral assignment [1703.09339].

### Rank-Constrained DNN and Difference-of-Convex (DC) Programming

A recent methodological advance is the reformulation of QAP as a rank-one doubly nonnegative (DNN) problem, where the solution matrix $Y = xx^\top$ is enforced to be both PSD and entrywise nonnegative [1908.04522]. By recasting the rank constraint as a difference-of-convex (DC) penalty ($\|Y\|_* - \|Y\|_2$), a proximal DC algorithm (Prox-DCA) generates a sequence of convex subproblems, each solvable via semi-proximal augmented Lagrangian (sPALM) or semismooth Newton methods. Theoretical guarantees establish convergence to stationary points; for large enough penalty parameter, optimal rank-one solutions are returned, delivering global optima in a majority of QAPLIB instances up to $n=60$ [1908.04522].

## 4. Metaheuristic, Heuristic, and Machine Learning Approaches

Due to intrinsic computational intractability, heuristics and metaheuristics (local and global search) are essential for QAPs of practical size ($n > 36$):

- **Local Search:** 2-opt exchanges and variants serve as foundational neighborhood moves. Improved versions with inversion, memory, or hybridization achieve strong solution quality and convergence [2307.11248, 2007.14885]. Tabu search, incorporating memory-based forbidden-move lists and aspiration criteria, balances quality and search breadth [1407.4863].

- **Simulated Annealing:** Efficient implementations leverage matrix incremental updates to reduce the per-iteration cost from $O(n^2)$ to $O(n)$ or lower, enabling runs with large iteration counts (on the order of $10^7–10^{10}$) and practical solution of QAPs with $n>1000$, especially when mapped to GPU architectures [1111.1353, 1208.2675].

- **Genetic and Evolutionary Algorithms:** Population-based, permutation-encoded GAs use specialized crossover (order, PMX) and swap/inversion mutations. Simple variants reach global or near-global optima for $n\leq 20$ [1405.5050]. Hybridizations, including PSO, grey wolf, and harmony search components, as well as hybrid GA-PSO frameworks, further enhance robustness and search diversity [2007.14885].

- **Estimation of Distribution Algorithms (EDAs):** Permutation-based EDAs, particularly those using kernelized Mallows models under the Hamming distance, outperform traditional EDAs and other native permutation-EDAs on 30 QAPLIB instances, offering a transparent and efficient probabilistic alternative [1910.08800].

- **Deep Reinforcement Learning:** Recent architectures based on pointer networks (

Source: https://www.emergentmind.com/topics/quadratic-assignment-problems-qap