Implementation of iterative local search (ILS) for the quadratic assignment problem

The quadratic assignment problem (QAP) is one of the hardest NPhard problems and problems with a dimension of 20 or more can be difficult to solve using exact methods. The QAP has a set of facilities and a set of locations. The goal is to assign each facility to a location such that the product of the flow between pairs of facilities and the distance between them are minimized. Sometimes there is also a cost associated with assigning a facility to a location. In this work, I solve the QAP using a population based iterative local search with open source code in C++. Results show that the code is able to solve all nug instances to optimality, thereby proving that the algorithm is capable of solving larger problems for which optimum solutions are not known.


Introduction
The quadratic assignment problem is an assignment problem in which each facility in a set of m facilities (say manufacturing plants) as to be assigned to a location in a set of m locations. Each pair of facilities has a flow of material between them. Each pair of locations has a distance between them. The objective (cost) function is to minimize the product of the flow and the distance, thus favoring facility assigments to locations such that high flow facilities are placed closer together.
Let F be the set of facilities and let L be the set of locations. Let f : F → L be the assignment function. Then the cost to minimize is: Because of the product in the cost function, the optimization objective is quadratic (nonlinear). Thus, linear methods cannot be applied to this problem. Please see [1] for a mathematical overview of the quadratic assignment problem.
Iterated local search (also called iterative local search) (ILS) is an iterative method that performs local improvement on the current best solution. Local search methods can get trapped in local minima, and so ILS performs perturbation on the current solution (even if the objective is worsened).
[2] provides a survey of iterated local search methods. [3] and [4] are applications of local search, metaheuristics and ILS to the QAP. In this work, I use a randomly initialized population of solutions (like a genetic algorithm) and perform perturbation on the entire population. The algorithm always caches the global best solution as iterations progress. The C++ code for our algorithm is available in our git repository at [5] at the following URL: https://github.com/shah314/cilsassignment

Population based ILS for QAP
We apply iterated local search to the QAP, but our implementation is different in that we perform ILS on a population of solutions. The advantage of this approach is that special attention can be given to the global best solution in the population. Local search with random restart is similar to this work, but we found a population based approach to achieve good results.
We use 10000 iterations and a population size of 5. If there is no improvement for 10 consecutive iterations, we perturb the entire population by randomly permuting the assignments. Local improvement does a 2-opt random permutation on each of the solutions in the population. As in simulated annealing [6], it is possible to accept worse solution with a small probability. Also, we implement 3-opt and 4-opt methods but we did not find it significantly advantageous. These k-opt methods are highly successful for the traveling salesman problem (TSP) (assuming a complete graph). It is known that the TSP and QAP are isomorphic problems and one can easily reduce to the other. Both are NP-hard problems for which approximation algorithms don't exist at a constant factor of the optimal solution.

Results
We run or algorithm on the nug instances first described in [7]. We find that the C++ code in our git repository [5] is able to find the optimum solution to all of the nug instances. Results are shown in table 1.

Conclusion
In this work we described a population based iterative local search algorithm as applied to the quadratic assignment problem. We also provided open source C++ code which implements the algorithm. We find that the algorithm is able to solve to optimality, all nug [7] instance in a short amount of time. This proves that the algorithm might also solve to optimality, very large instances for which optimum solutions are not known. The algorithm, as implemented in C++, is quite fast. Though, parameters can be controlled in the code (like the number of iterations etc.). We find that 2-opt permutation moves are the most beneficial, though further experiments with 3-opt and 4-opt moves can be conducted.