Author: Thomas Kueny, Eric Miller, Natasha Rice, Joseph Szczerba, David Wittmann (SysEn 5800 Fall 2020)

## Introduction

The Quadratic Assignment Problem, discovered by Koopmans and Beckmann in 1957, is a mathematical optimization module created to describe the location of invisible economic activities. An NP Complete problem, this model can be applied to many other optimization problems outside of the field of economics. It has been used to optimize backboards, Inter-plant Transportation, Hospital Transportation, Exam Scheduling, along with many other applications not described within this page.

## Theory, Methodology, and/or Algorithmic Discussions

### Computational Complexity

QAP belongs to the classification of problems known as NP-complete, thus being a computationally complex problem. QAP’s NP-completeness was proven by Sahni and Gonzalez in 1976, who state that of all combinatorial optimization problems, QAP is the “hardest of the hard”.[1]

Algorithmic Discussions

While an algorithm that can solve QAP in polynomial time is unlikely to exist, there are three primary methods for acquiring the optimal solution to a QAP problem:

1. Dynamic Program
2. Cutting Plane
3. Branch and Bound Procedures

The third method has been proven to be the most effective in solving QAP, although when n > 15, QAP begins to become virtually unsolvable.

## Numerical Example

### Distance and Flow Matrices

For each pair ${\displaystyle (i,j)}$, ${\displaystyle D_{i,j}}$ represents the distance between locations ${\displaystyle i}$ and ${\displaystyle j}$. ${\displaystyle F_{i,j}}$ represents the required flow (of supplies, products, etc.) between facilities ${\displaystyle i}$ and ${\displaystyle j}$ [2]. The optimal solution will be the arrangement of the 3 facilities in the 3 locations so that the total flow over distance is minimized. Intuitively, the product of distance and flow represents cost, and the objective is to minimize this cost. Ideally, two facilities with lots of flow (more product or supplies) between the two should be placed closer together than two facilities that rarely interact (low flow).

### Permutations

There are ${\displaystyle 3!=6}$ permutations of the 3 facilities in the 3 locations. The set of these permutations is typically denoted ${\displaystyle S_{3}}$. As an example, the permutation ${\displaystyle \phi =(321)}$ represents facility 3 being placed at location 1, facility 1 at location 2 and facility 2 at location 3. Each permutation can be assigned a permutation matrix. The permutation matrix of ${\displaystyle \phi }$ can be written as [3]

${\displaystyle X_{\phi }={\begin{bmatrix}0&0&1\\1&0&0\\0&1&0\end{bmatrix}}}$

The operation ${\displaystyle X_{\phi }DX_{\phi }^{T}}$ permutes the values of the distance matrix ${\displaystyle D_{i,j}}$ so that ${\displaystyle (X_{\phi }DX_{\phi }^{T})_{i,j}}$ represents the distance between facilities ${\displaystyle i}$ and ${\displaystyle j}$ if the facilities are arranged according to the permutation ${\displaystyle \phi }$. The cost function between facilities ${\displaystyle i}$ and ${\displaystyle j}$, after being permuted to their location, is ${\displaystyle F_{i,j}}$${\displaystyle (X_{\phi }DX_{\phi }^{T})_{i,j}}$ [4]. To find the total cost, sum over each ${\displaystyle i}$ and ${\displaystyle j}$ for the facilities arranged according to ${\displaystyle \phi }$.

### Inner Product

The inner product of two matrices ${\displaystyle A,B}$ is defined as ${\displaystyle =\sum _{i=1}^{n}\sum _{j=1}^{n}a_{i,j}b_{i,j}}$. The inner product ${\displaystyle =\sum _{i=1}^{n}\sum _{j=1}^{n}F_{i,j}(X_{\phi }DX_{\phi }^{T})_{i,j}}$ thus describes the total cost of assigning facilities [5] to locations according to ${\displaystyle \phi }$. The objective function to minimize cost can be written as ${\displaystyle }$.

The true objective cost function only uses the entries above the diagonal in the matrix comprised of elements ${\displaystyle F_{i,j}}$${\displaystyle (X_{\phi }DX_{\phi }^{T})_{i,j}}$.Since this matrix is symmetric with zeroes on the diagonal, dividing by 2 removes the double count of each element to give the correct cost value.

### QAP with 3 Facilities

Consider the QAP of placing 3 facilities in 3 locations. Let the distance and flow matrices be defined respectively as ${\displaystyle D={\begin{bmatrix}0&5&6\\5&0&3.6\\6&3.6&0\end{bmatrix}}}$, ${\textstyle F={\begin{bmatrix}0&10&3\\10&0&6.5\\3&6.5&0\end{bmatrix}}}$.

Let ${\displaystyle P}$ be the set of permutation matrices for ${\displaystyle S_{3}}$. The problem can be stated as follows:

${\displaystyle \min _{X\in P}}$.

The table lists the resulting cost function to place the facilities according to each permutation ${\displaystyle \phi \in S_{3}}$. Note that ${\displaystyle \phi =()}$ is the identity mapping where the number of the facility is the location number. Based on these results, ${\displaystyle \phi _{4}=(13)}$ is the arrangement of facilities that minimizes the cost function with a value of 86.5. Facility 1 should be placed at location 3, Facility 2 remains at location 2 and Facility 3 is placed at location 1.

 Permutation Cost ${\displaystyle \phi _{1}=}$ ( ) 91.4 ${\displaystyle \phi _{2}=(12)}$ 99.8 ${\displaystyle \phi _{3}=(23)}$ 98.4 ${\displaystyle \phi _{4}=(13)}$ 86.5 ${\displaystyle \phi _{5}=(123)}$ 103.3 ${\displaystyle \phi _{6}=(132)}$ 90
Optimal Solution for the example with facility/location pairings listed. Line thickness is representative of flow. Note that the closest locations (2,3) are assigned facilities (2,1) with the greatest flow between them. The two farthest locations (1,3) are assigned facilities (3,1) that have the lowest flow. Overall, this results in a minimized cost function.

## Applications

### Inter-plant Transportation Problem

The quadratic assignment problem was first introduced by Koopmans and Beckmann to address how economic decisions could be made to optimize the transportation costs of goods between both manufacturing plants and locations.[6] Factoring in the location of the each of the manufacturing plants as well as the volume of goods between locations to maximize revenue is what distinguishes this from other linear programming assignment problems like the Knapsack Problem.

### The Backboard Wiring Problem

As the quadratic assignment problem is focused on minimizing the cost of traveling from one location to another, it is an ideal approach determining placement of components in many modern electronics. Leon Steinberg proposed a QAP solution optimize the layout of elements on a blackboard by minimizing the total amount of wiring required.[7]

When defining the problem Steinberg states that we have a set of n elements

${\displaystyle E=\left\{E_{1},E_{2},...,E_{n}\right\}}$

as well as a set of r points

${\displaystyle P_{1},P_{2},...,P_{r}}$ where ${\displaystyle r\geq n}$

In his paper he derives the below formula:

${\displaystyle min\sum _{1\leq i\leq j\leq n}^{}C_{ij}(d_{s(i)s(j))})}$

${\displaystyle C_{ij}}$ represents the number of wires connecting components ${\displaystyle E_{i}}$ and ${\displaystyle E_{i}}$

${\displaystyle d_{s(i)s(j))}}$ is the length of wire needed to connect tow components if one is placed at ${\displaystyle P_{\alpha }}$ and the other is placed at ${\displaystyle P_{\beta }}$. If ${\displaystyle P_{\alpha }}$ has coordinates ${\displaystyle (x_{\alpha },y_{\alpha },z_{\alpha })}$ then ${\displaystyle d_{s(i)s(j))}}$ can be calculated by

${\displaystyle d_{s(i)s(j))}=\surd ({\bigl (}x_{\alpha }-x_{\beta }{\bigr )}^{2}+{\bigl (}y_{\alpha }-y_{\beta }{\bigr )}^{2}+{\bigl (}z_{\alpha }-z_{\beta }{\bigr )}^{2})}$

${\displaystyle s(x)}$ represents a particular placement of a component.

In his paper Steinberg a backboard with a 9 by 4 array, allowing for 36 potential positions for the 34 components that needed to be placed on the backboard. For the calculation he selected a random initial placement of s1 and chose a random family of 25 unconnected sets.

The initial placement of components is shown below:

The initial placement of components in the backboard from Steinberg's

After the initial placement of elements it took an additional 35 iterations to get us to our final optimized backboard layout. Leading to a total of 59 iterations and a final wire length of 4,969.440.

Final component position in Steinberg's Backboard optimization problem

### Hospital Layout

Building a new hospitals was a common event in 1977 when Alealid N Elshafei wrote his paper on "Hospital Layouts as a Quadratic Assignment Problem".[8]With high initial cost to construct the hospital and to staff it, it is important to ensure that it is operating as efficiently as possible. Elshafei's paper was commissioned to create a optimization formula to locate clinics within a building in such a way that minimizes the total distance that a patient travels within the hospital throughout the year. When doing a study of a major hospital in Cairo he determined that the Out-patient ward was acting as a bottle neck in the hospital and focused his efforts on optimizing the 17 departments there.

Elshafei identified the following QAP to determine where clinics should be placed:

${\displaystyle min\sum _{i,j}\sum _{k,q}f_{ik}d_{jq}y_{ij}y_{kq}}$

Such that ${\displaystyle \sum _{j\epsilon J}y_{ij}=1\forall i\epsilon I}$

${\displaystyle \sum _{i\epsilon I}y_{ij}=1\forall j\epsilon J}$

${\displaystyle y_{ij}{\begin{Bmatrix}1iffacilityiislocatedatj\\0otherwise\end{Bmatrix}}}$

${\displaystyle f_{ik}}$ is the yearly flow between facilities i and k

${\displaystyle d_{jq}}$ is the distance between the possible facility locations j and q

${\displaystyle I}$ is the initial set of facilities

${\displaystyle J}$ is the initial set of all locations

It can take a large amount of computational power to calculate the solution to a QAP problem, necessitating the use of a heuristic solution rather than using an optimizing algorithm. This approach is composed of two parts(Parts A and Part B). Part A that develops the initial layout of the hospital, this is done by following two strategies. Strategy 1 where we use a rank ${\displaystyle L_{i}}$ that designates the number of interactions facility ${\displaystyle i}$ has with with the other facilities. As well as ranking them in terms of ${\displaystyle R_{j}}$, which designates the sum of distances from j to all other locations. then we go through the list and find the facility with the greatest ${\displaystyle L_{i}}$ and the least ${\displaystyle R_{j}}$. Strategy 2 says that any step in the process we next place an unassigned facility that has the largest number of interactions with the most recently placed facility. Part B covers improving the initial solution developed in Part A, here at any step in the process we test weather the assignment is best of all of the facilities that are involved and make swaps where necessary until there are no more swaps to be made.

For the Cairo hospital with 17 clinics, and one receiving and recording room bringing us to a total of 18 facilities. By running the above optimization Elshafei was able to get the total distance per year down to 11,281,887 from a distance of 13,973,298 biased on the original hospital layout.

### Exam Scheduling System

The scheduling system uses matrices for Exams, Time Slots, and Rooms with the goal of reducing the rate of schedule conflicts. To accomplish this goal, the “examination with the highest cross faculty student is been prioritized in the schedule after which the examination with the highest number of cross program is considered and finally with the highest number of repeating student, at each stage group with the highest number of student are prioritized.”[9]

## References

1. Burkard R.E., Çela E., Pardalos P.M., Pitsoulis L.S. (1998) The Quadratic Assignment Problem. In: Du DZ., Pardalos P.M. (eds) Handbook of Combinatorial Optimization. Springer, Boston, MA. https://doi.org/10.1007/978-1-4613-0303-9_27