Place the facilities
The quadratic assignment problem asks where to put facilities so that the ones that exchange the most material sit closest together. (For its linear cousin, where each pair’s cost stands alone, match the boxes.) Here are seven small ones to solve by hand, Nugent’s problems from nug05 to nug15, and the big one, nug30, to play with (its story is told in nug30, again). The first one shown is nug08: eight facilities and eight locations on a 2 by 4 grid.
The cost
Some pairs of facilities exchange material; the flow between them runs from 1 to 10. Moving it costs flow times distance, and distance is counted in city blocks along the grid. The cost of an assignment is that product summed over every pair. QAPLIB counts each pair twice, once in each direction, so the totals here match its published values.
On nug08 there are 8! = 40,320 ways to place the facilities. A random one, which the button deals out, costs 308 on average and the worst costs 404. The best costs 214, and four assignments reach it: one layout and its three mirror images on the grid. Each step up in size multiplies the count: nug15 has 15! ≈ 1.3 × 1012 assignments.
Greedy and optimal
Greedy () puts the facility with the most total flow on a central location. Then, one at a time, it takes the facility with the most flow to those already placed and puts it on the free location where it adds the least cost, without ever reconsidering a choice. Optimal () places the facilities as in the best assignment. Greedy finds the optimum on nug06 and nug07 and misses it by 14% on nug15:
| Problem | Grid | Optimum | Greedy | Gap |
|---|---|---|---|---|
| nug05 | 2 × 3 less one | 50 | 62 | 24.0% |
| nug06 | 2 × 3 | 86 | 86 | optimal |
| nug07 | 2 × 4 less one | 148 | 148 | optimal |
| nug08 | 2 × 4 | 214 | 228 | 6.5% |
| nug12 | 3 × 4 | 578 | 610 | 5.5% |
| nug14 | 3 × 5 less one | 1014 | 1108 | 9.3% |
| nug15 | 3 × 5 | 1150 | 1314 | 14.3% |
| nug30 | 5 × 6 | 6124 | 6882 | 12.4% |
Closing that last gap is the hard part. For eight facilities or fewer, enumerating every assignment proves the optimum. For 12 to 15 the optima are QAPLIB’s, and the branch-and-bound solver behind the recorded runs proves each one again in under two seconds. For nug30 there are about 2.65 × 1032 assignments, and proving the best one took a week on hundreds of machines in 2000.
The nugxx problems are from Nugent, Vollmann and Ruml (1968), as distributed in QAPLIB. Their distances are exactly the city-block distances of the grids drawn here.