The quadratic assignment problem (QAP) is one of the most difficult combinatorial optimization problems. One of the most powerful and commonly used heuristics to obtain approximations to the optimal solution of the QAP is simulated annealing (SA). We present an efficient implementation of the SA heuristic which performs more than 100 times faster then existing implementations for large problem sizes and a large number of SA iterations.
Deep Dive into An efficient implementation of the simulated annealing heuristic for the quadratic assignment problem.
The quadratic assignment problem (QAP) is one of the most difficult combinatorial optimization problems. One of the most powerful and commonly used heuristics to obtain approximations to the optimal solution of the QAP is simulated annealing (SA). We present an efficient implementation of the SA heuristic which performs more than 100 times faster then existing implementations for large problem sizes and a large number of SA iterations.
Originally formulated by Koopmans and Beckmann (1957), the QAP is NP-hard and is considered to be one of the most difficult problems to be solved optimally. It was defined in the following context: A set of N facilities are to be located at N locations. The quantity of materials which flow between facilities i and j is A ij and the distance between locations i and j is B ij . The problem is to assign to each location a single facility so as to minimize (or maximize) the cost
where p(i) represents the location to which i is assigned.
The QAP formulation has since been applied to such diverse problems as the optimal assignment of classes to classrooms (Dickey and Hopkins, 1972), design of DNA microarrays (de Carvalho and Rahmann, 2006), cross species gene analysis (Kolar, et al., 2008), creation of hospital layouts (Elshafei, 1977), and assignment of components to locations on circuit boards (Steinberg, 1961).
Email address: gerryp@bu.edu (Gerald Paul ) In addition to being important in its own right, the QAP includes such other combinatorial optimization problems as the traveling salesman problem and graph partitioning as special cases.
There is an extensive literature that addresses the QAP and which is reviewed in Pardalos et al. (1994), Cela (1998), Anstreicher (2003), Loiola et al. (2007), James et al. (2009) and Burkhard et al. (2009). The QAP is exceedingly hard to solve optimally. With the exception of specially constructed cases, optimal algorithms have solved only relatively small instances with N ≤ 36. Various heuristic approaches have been developed and applied to problems typically of size N ≈ 100 or less. By contrast, a travelling salesman problem consisting of almost 25,000 towns in Sweden has been solved exactly (Applegate et al., 2007).
The simulated annealing heuristic was first applied to the QAP by Burkhard and Rendl (1984) and was refined by Connolly (1990). The heuristic consists of swapping locations of two facilities. Proposed swaps can either be determined randomly or selected according to some sequential enumeration of all possible swaps. For each proposed swap, δ, the change in cost for the potential swap, is calcu-lated. The swap is made if δ is negative or if e -δ/T > r, where T is an analog of temperature in physical systems that is slowly decreased according to a specified cooling schedule after each iteration and r is a uniformly distributed random variable between 0 and 1. Randomly making moves which increase the cost is done to help escape from local minima.
In traditional implementations of the heuristic, the cost of making a swap is calculated from scratch when the swap is considered in order to determine if the swap should be made. The computational complexity of this calculation is O(N ); and if the SA run is composed of I iterations, the complexity is O(IN ). We can write the time needed to execute I iterations as
where c 0 is a constant.
The approach we take here is to attempt to reduce the complexity by maintaining a matrix ∆ of costs of each possible swap. This approach is motivated by the work of Taillard (1991), who applied a similar approach in the application of another heuristic, tabu search, to the QAP. Our ∆-matrix approach is as follows:
(a) Initialize by creating a matrix ∆(p, u, v) containing the cost of swapping u and v for all u and v, given a current assignment p.
(b) In each iteration, retrieve the cost ∆(p, r, s) of the proposed swap (r, s).
(c) If the proposed swap is not made in a given iteration, go to (b).
(d) If the proposed swap is made in a given iteration, update ∆(p, u, v) to reflect the swap costs given the new permutation and go to (b).
(e) End after I iterations.
The number of iterations in which a swap is performed divided by the total number of iterations is known as the acceptance rate a(I).
The computational complexity of our approach has the following contributions.
(i) Retrieving the value of ∆(p, r, s) is of complexity O(1).
(ii) Assuming an acceptance rate, a(I), the matrix ∆(p, r, s) must be updated a(I)I times. The complexity of updating ∆(p, u, v) is O(N 2 ) as described in Appendix A.
Thus the complexity of our approach is
and we can write the CPU time of our approach t ∆ as
where c 1 and c 2 are constants. The performance improvement factor of our approach relative to the traditional approach is then
for large N . From Eq. ( 2) we see that the performance improvement is critically dependent on the acceptance rate a(I). The constants c 0 and c 1 are independent of the problem instance, depending only on the SA implementation; for our implementation c 0 /c 1 ≈ 1/3. For our approach to be beneficial, F must have a value > 1 and thus a(I) must satisfy a(I) 1/3N.
(3)
It is useful to consider an instantaneous acceptance rate, ã(i), defined as the number of swaps performed in a window of iterations around iteration i divided by the size of the window. Our numerical experiments indicate that ã(i) decreases with in
…(Full text truncated)…
This content is AI-processed based on ArXiv data.