Learning Solution-Aware Transformers for Efficiently Solving Quadratic Assignment Problem

Zhentao Tan, Yadong Mu

Abstract

The Quadratic Assignment Problem (QAP) is a fundamental yet notoriously difficult combinatorial optimization challenge. Traditional deep learning approaches often fail to scale due to the $O(n^4)$ complexity inherent in constructing association graphs. This paper introduces the Solution-Aware Transformer (SAWT), a reinforcement learning framework that utilizes a novel attention mechanism to integrate current solution states directly into the encoding process. By maintaining a manageable $O(n^2)$ complexity, SAWT achieves state-of-the-art performance on large-scale QAP instances, offering significant speedups over traditional heuristics while maintaining high solution quality.

Introduction

The Quadratic Assignment Problem (QAP) involves assigning $n$ facilities to $n$ locations to minimize a cost function based on facility flow and location distance. As a strongly NP-hard problem, QAP is significantly more challenging than other combinatorial tasks like the Traveling Salesman Problem (TSP). While traditional solvers like Gurobi and meta-heuristics like Tabu Search (TS) can find high-quality solutions, they often require prohibitive computation times as problem sizes grow.

Previous machine learning attempts have struggled with scalability. Most rely on association graphs to match nodes, which leads to a complexity of $O(n^4)$. This "complexity wall" typically limits these models to problems with fewer than 30 nodes. SAWT aims to break this barrier using a "Learn-to-Improve" (L2I) approach that iteratively refines an initial assignment.

Methodology: The Solution-Aware Transformer

SAWT departs from the standard association graph construction by encoding facilities and locations independently. This architectural choice keeps the computational complexity at $O(n^2)$, enabling the model to scale to instances with 100 or more nodes.

The overall architecture of the SAWT framework, featuring independent encoders for facilities and locations and a solution-aware decoder.

Key Innovations

  1. Independent Encoding: The model uses Graph Convolutional Networks (GCNs) and specialized Transformers to encode the structural features of facilities and locations separately.
  2. Solution-Aware Attention (SAWT-Att): Unlike static Transformers, SAWT injects the current assignment directly into the attention mechanism. This allows the model to dynamically adjust its focus based on the incumbent solution.
  3. Gradient Integration: The authors demonstrate that the attention modulation matrix is mathematically proportional to the objective function's gradient. This allows the Transformer to effectively "sense" the direction of cost reduction.
  4. Reinforcement Learning: The model is trained via the REINFORCE algorithm, learning to navigate the solution space through iterative swaps to minimize the total assignment cost.

Experimental Results

The model was evaluated on synthetic Koopmans-Beckmann instances (QAP10 to QAP100) and the QAPLIB benchmark, which contains real-world instances like hospital layouts and electronic module placement.

Performance comparison of SAWT against traditional solvers and other learning-based methods on QAP instances of varying sizes.

Performance and Scalability

SAWT demonstrated exceptional accuracy and speed. On QAP10 instances, it found the optimal solution 100% of the time. For larger QAP100 instances, SAWT achieved a significantly lower gap compared to other learning-based baselines. Most notably, SAWT provided a 5,350x speedup over traditional Tabu Search on QAP100 instances while remaining competitive in solution quality.

Generalization

The framework exhibits strong zero-shot generalization. A policy trained on 50-node problems (QAP50) outperformed models specifically trained on smaller sizes when tested on 100-node problems. This suggests that the solution-aware mechanism captures fundamental structural properties of the QAP that are invariant to problem size.

Limitations and Future Work

While SAWT excels on dense synthetic data, it shows sensitivity to sparsity in certain QAPLIB categories (e.g., "Chr" and "Ste"). This performance dip is attributed to the distribution shift between dense training data and sparse real-world matrices. Future research may explore meta-learning strategies to improve adaptation to diverse data distributions and extend the solution-aware architecture to other complex combinatorial optimization problems.

Summary updated

BibTeX
@inproceedings{tan2024learning,
  author = {Zhentao Tan and Yadong MU},
  title = {{Learning Solution-Aware Transformers for Efficiently Solving Quadratic Assignment Problem}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=bBkQ51PmjC},
}
Figure