Solving the Quadratic Assignment Problem by a Hybrid Algorithm

This paper presents a hybrid algorithm to solve the Quadratic Assignment Problem (QAP). The proposed algorithm involves using the Greedy Randomized Adaptive Search Procedure (GRASP) to obtain an initial solution, and then using a combined Simulated Annealing (SA) and Tabu Search (TS) algorithm to improve the solution. Experimental results  indicate that the hybrid algorithm is able to obtain good quality solutions for QAPLIB test problems within reasonable computation time.

The Quadratic Assignment Problem (QAP) is identified as the problem of finding a minimum cost allocation of facilities into locations, with the costs being the sum of all possible distance-flow products [1]. It is a combinatorial optimization problem that is first stated by Koopmans and Beckmann [2]. This problem belongs to the class of NP-hard problems and there is no ε-approximation algorithm for the QAP unless P=NP [3].
Both exact and heuristic methods have been used to solve the QAP. Exact algorithms, which include the branch-andbound, dynamic programming and cutting plane techniques, can only be used to solve small-size instances of the problem. Thus, many heuristics have been proposed by researchers to find optimal or near optimal solutions for the QAP. These heuristics range from simple iterative improvement procedures to metaheuristic implementations, such as Ant Colony Optimization [22,23], Genetic Algorithm [20,24,25], Tabu Search [21,26] and Simulated Annealing [13,27,28]. Loiola et al. [1] highlighted the development of hybrid algorithms for solving the QAP. These hybrid algorithms for the QAP include a combination of Tabu Search with Simulated Annealing as presented by Misevicius [29], while Youssef et al. [30] used Tabu Search, Simulated Annealing and fuzzy logic together to solve the QAP. This paper presents a new hybrid metaheuristic for the QAP. It involves three different algorithms: GRASP (Greedy Randomized Adaptive Search Procedure), Simulated Annealing (SA) and Tabu Search (TS). An extensive computational testing of this hybrid metaheuristic has been carried out with the benchmark instances in the QAPLIB, a well-known library of QAP instance [31].
The rest of this paper is organized as follows. In Section II, we provide a description of the problems considered in this paper. In Section III, the proposed hybrid algorithm is explained in detail. The computational results of applying the hybrid algorithm are presented in Section IV, and some concluding remarks are provided in Section V.

II. PROBLEM DESCRIPTION
The QAP can be described as the assignment of n facilities to n different locations. Given two n × n matrices, F = [f ij ] and D = [d kl ], where f ij is the flow between facilities i and j and d kl is the distance between locations k and l, the problem can be formulated as follows [1]: The objective function represents the total cost of assignment of all facilities to all locations, which is the product of the flow between facilities i and j and the distance between locations k and l. The constraints ensure that exactly n facilities are to be assigned to exactly n locations.
The QAP can also be represented as a permutation problem. Let f ij be the flow between facilities i and j and The QAP problem then becomes: is the set of all permutations of integers {1, 2, …, n}.
In this paper, a solution to the QAP is represented by the vector: denotes that facility i is assigned to location k.

III. THE PROPOSED ALGORITHM
The hybrid algorithm proposed in this paper comprises of two main phases: (1) construction, and (2) improvement. The GRASP algorithm is used to initialize a solution in the first phase, while a combined SA and TS (Algorithm SA-TS) is used to improve the solution in the second phase. Each phase is presented and described in detail below.

A. Construction Phase
In the construction phase, we build an initial solution by implementing part of the Greedy Randomized Adaptive Search Procedure (GRASP). The GRASP is a metaheuristic that combines constructive heuristics and local search [32]. It comprises of the two steps: solution construction and solution improvement.
In the first step, we construct an initial solution by adding one new element at a time. The process selection is initially started by building the candidate list, called restricted candidate list. An element is then picked randomly from the list. In our implementation, we only consider the first process to construct an initial solution. The construction process of GRASP is shown in Figure 1.
and   x be the largest integer smaller or equal to x.
sort them in increasing order and keep the smallest Select two elements from the candidate list randomly. (5) Calculate ik C , the cost of assigning facility i to location k, with respect to the already-made assignments, Γ : Set o = the number of unassigned facilities (7) Determine the   γo facility-location pairs having the smallest ik C values.
Select a facility-location pair   k i, randomly from the list generated in Step 7. (9) Update the set

B. Improvement Phase
The initial solution generated by GRASP, initial_sol, is then improved in the improvement phase. The algorithm applied in this phase is a combined SA and TS algorithm (Algorithm SA-TS). While it is mainly based on Simulated Annealing [33], the main difference of the standard SA and the proposed SA lies in the additional elements or strategies added. Several features from Tabu Search, such as the tabu length, tabu list and the intensification strategy are incorporated in the algorithm for further improvement [34,35].
In order to improve the solution, a local search algorithm involving a partial sequential neighborhood search is also augmented. The basic idea of the search is to swap or exchange the locations of two facilities such that a better solution is derived. Assuming that If both matrices F and D are symmetric with a zero diagonal, the formula can be simplified as follows: Instead of selecting two facilities randomly as was commonly done in SA, we start by selecting one facility i randomly followed by examining all other potential pairswaps sequentially in the order     i j : j i,  . The selected move is the one with the best   j i, π, Δ value. The new permutation is then evaluated by the acceptance-rejection procedure in SA.
The tabu list contains pairs (i, j) that have been visited in the last length iterations. For a given iteration, if a pair (i, j) belongs to the tabu list, it is not allowed to accept the exchange of facilities i and j, unless this exchange gives an objective function value strictly better than the previous one (aspiration level criteria). At any temperature T, the neighborhood search is repeated until a certain number of iterations, inner_loop, has been performed.
The details of this procedure are summarized in Figure 2. If there is no improvement of the solution obtained within a certain number of iterations (limit), we apply an intensification strategy of Tabu Search. This strategy focuses the search once again starting from the best permutation obtained. Finally, the entire algorithm will be terminated if the total number of iterations of the outer loop reaches the preset maximum number of iterations, outer_loop.

A. Experimental Setup
The values of the parameters used in the computational experiments are determined experimentally to ensure a compromise between the computation time and the solution quality. They are summarized in Table I

B. Results
In order to evaluate the performance of our proposed algorithm, we decided to solve some benchmark problems from a library for research on the QAP (QAPLIB) which have been studied and solved by other researchers [31]. For each benchmark problem, the proposed algorithm was executed 20 times with different random seeds.
According to [37], the instances of QAPLIB can be classified into four classes: unstructured (randomly generated) instances, grid-based distance matrix and real-life instances and real-life-like instances. Due to the limitation of the target algorithm that can only solve symmetric instances with zero diagonal values, we only focus on some instances from three classes: unstructured (randomly generated) instances, grid-based distance matrix and real-life instances. Table II presents the instances selected from each class. The following tables summarize the average objective function value obtained and the best objective function value obtained for each class. The objective function values of the optimal/best known solutions given in Burkard et al. [31] are also presented for comparison purposes. The heading Φ 1 refers to the percentage deviation between the average objective function value of the solutions obtained and the best known/optimal solution, while the heading Φ 2 refers to the percentage deviation between the best objective function value of the solutions obtained and the best known/optimal solution. The values for Φ 1 and Φ 2 are computed as follows: Table III, IV and V summarize the computational results of problem instances in the first class. From Table III, we notice that the average gaps of the solutions are less than or equal to 0.40%. For each problem instance, the hybrid algorithm is again able to obtain the best known/optimal solutions. The value of Φ 1 is not more than 0.03% for rou problem instances (Table IV).
As shown in Table V, for the tai type benchmarks, the performance of the proposed algorithm is still acceptable with values of Φ 1 and Φ 2 are not more than 3.72% and 3.58%, respectively. For larger problem instances (with n > 20), the best known/optimal solutions cannot be found. It is likely that with greater number of iterations, the outcome may improve with possibility of obtaining the best known/optimal solutions for some of instances. The computational results for the second class (grid-based distance matrix) are summarized in Tables VI, VII and VIII.  Table VI is a summary of the results for the nug problem instances. The results indicate that these problem instances do not pose much difficulty for the proposed hybrid algorithm to obtain good solutions as the values of Φ 1 are not more than 0.02%. All the best known/optimal solutions can be obtained within reasonable computation time, with the optimal solution to the largest problem instance, nug30, being obtained within 15 minutes.
Tables VII and VIII show the results of testing on scr and sko problem instances. The values of Φ 1 are 0% for scr problem instances, while the maximum value of Φ 1 is only 0.18% for sko problem instances. For sko49 and sko56, the values of Φ 2 are about 0.1% from the optimal/best known solution. The longest CPU time required to obtain the solution is about 3 hours for sko56. Finally, Table IX and X summarize the results of testing on the third class (real-life instances). Table IX summarizes the computational results for chr problem instances. The difficulty level in solving the chr problem instances is considered significant [25]. On the whole, the proposed hybrid algorithm is able to find solutions with values of Φ 1 not exceeding 1.50% from the known optimum. For all problem instances, the best known/optimal solutions are also obtained.
Tables X summarizes the results of testing on kra problem instances. The average gaps of the solutions are less than 0.75%. For each problem instance, the hybrid algorithm is again able to obtain the best known/optimal solutions.
In summary, we observe that the proposed hybrid algorithm is able to obtain very good or optimal solutions to benchmark problem instances drawn from the QAPLIB. The computation time required to do so is also reasonable especially for problem instances with modest size.

V. CONCLUSIONS
In this paper, a hybrid algorithm that combines GRASP, Simulated Annealing and Tabu Search is proposed to solve the QAP. The proposed algorithm for solving the QAP is able to obtain the optimal or best known solutions for problem instances drawn from the QAPLIB.
There are several issues for future research. First, in the proposed hybrid algorithm, the Tabu Search framework has been designed primarily with short term memory. As part of future research work, the possibility of implementing other Tabu Search strategies, such as long term memory and diversification strategy, within the hybrid algorithm will be considered. Second, different types of hybridization with other metaheuristics, such as the genetic algorithm and ant colony optimization algorithm, can also be investigated. Third, the application of the proposed hybrid algorithm to solve other optimization problems is another area of future research, such as Quadratic Semi Assignment Problem (QSAP).