Next Article in Journal
Efficient Discretization of the Laplacian: Application to Moving Boundary Problems
Next Article in Special Issue
A Survey on Variable Neighborhood Search for Sustainable Logistics
Previous Article in Journal
Advanced Dynamic Vibration Control Algorithms of Materials Terfenol-D Si3N4 and SUS304 Plates/Cylindrical Shells with Velocity Feedback Control Law
Previous Article in Special Issue
AASA: A Priori Adaptive Splitting Algorithm for the Split Delivery Vehicle Routing Problem
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Simulated Annealing Algorithm for the Generalized Quadratic Assignment Problem

Department of Industrial & Management Systems Engineering, West Virginia University, 1306 Evansdale Drive, P.O. Box 6107, Morgantown, WV 26506, USA
*
Author to whom correspondence should be addressed.
Algorithms 2024, 17(12), 540; https://doi.org/10.3390/a17120540
Submission received: 27 October 2024 / Revised: 19 November 2024 / Accepted: 25 November 2024 / Published: 28 November 2024
(This article belongs to the Special Issue Heuristic Optimization Algorithms for Logistics)

Abstract

:
The generalized quadratic assignment problem (GQAP) involves assigning a set of facilities to a set of locations such that the sum of the assignment and transportation costs is minimized. Unlike the traditional one-to-one assignment problem, the GQAP is a many-to-one assignment problem. That is, multiple facilities can be assigned to each location without exceeding the capacity of the location. This research was motivated by the problem of assigning multiple facilities (e.g., machines or equipment) to locations at manufacturing plants. Another well-known application of the GQAP includes the assignment of facilities (i.e., containers) to locations (i.e., storage areas) in container yards. This paper presents simple but very effective approximation algorithms for solving real-world, large-size GQAP instances quickly without spending a lot of time setting the algorithm parameters, since there are few parameters to set. More specifically, a construction algorithm is used to generate an initial solution for the proposed problem, and the initial solution is improved using a simulated annealing algorithm. The performance of the proposed algorithms is tested with respect to solution quality and computation time on a set of test problems available in the literature. The results show the effectiveness of the proposed algorithms.

1. Introduction

Assignment problems have a wide range of real-world applications in different fields ranging from logistics, manufacturing, business, telecommunications, healthcare, etc., There are mainly two types of assignment problems: one-to-one and many-to-one. For example, consider the problem of assigning facilities to locations, while minimizing the sum of the assignment costs, such that each facility is assigned to a location, and each location is assigned to a facility. This problem is called a one-to-one assignment problem. In contrast, in a many-to-one assignment problem, multiple facilities may be assigned to each location without exceeding the capacities of the locations. This problem is called the generalized assignment problem. For real-life applications of the generalized assignment problem (GAP) in scheduling, timetabling, telecommunication, facility location, transportation, production planning, etc., see Oncan [1].
This research was motivated by the challenge of efficiently assigning facilities (e.g., equipment, machines) to locations within a manufacturing plant. Besides assigning multiple facilities to each location without exceeding the capacities of the locations, the objective was to minimize the sum of the assignment and transportation costs. The assignment costs consist of the cost of assigning or installing each machine to a location, and the transportation costs consist of the costs of moving materials processed on the machines between the machines. Since the transportation cost introduces a quadratic term in the objective function, as will be discussed below, this problem is called the generalized quadratic assignment problem (GQAP).
The GQAP was first introduced by Lee and Ma [2]. The authors considered the problem of assigning equipment to locations at different manufacturing sites. They presented a nonlinear mathematical model, three linearization methods, and a branch-and-bound algorithm to optimally solve the problem. Unal and Uysal [3] presented the first implementation of the GQAP to design the curriculum at a university. The authors presented a model for their problem. They linearized and solved their model using an exact algorithm within a solver. Guignard [4] applied an exact algorithm, which uses a reformulation linearization technique, to solve the cross-dock door assignment problem which is a special case of the GQAP. Other exact algorithms for solving the GQAP were presented by Hahn et al. [5], Pessoa et al. [6], and Fathollahi-Fard et al. [7]. Since the GQAP is a generalization of the QAP, which is NP-hard (Sahni and Gonzales [8]), the GQAP is NP-hard. Therefore, only small- to medium-size GQAP instances can be solved in reasonable computational time. Thus, approximation algorithms were designed for solving large-sized GQAP instances. Cordeau et al. [9] considered the GQAP application where containers were assigned to storage locations in a container yard. The authors presented a linearized model and a memetic algorithm (MA) which combined a genetic algorithm with tabu search (TS). Zou et al. [10] designed a global harmony search algorithm to solve the task assignment problem, which is a type of GQAP used to assign tasks to processors. Mateus et al. [11] proposed several greedy randomized adaptive search procedures (GRASPs) with path-relinking heuristic algorithms for the GQAP. McKendall and Li [12] presented several construction algorithms and a TS algorithm for the GQAP which considered assigning machines and equipment to locations in manufacturing plants. Mostafa [13] presented a TS and a simulated annealing (SA) algorithm for the GQAP. However, the SA algorithm was unable to obtain several of the best-known solutions on a set of test problems available in the literature with long average run times. Silva et al. [14] designed a parallel memetic iterated TS heuristic algorithm for the quadratic assignment problem and four of its variants, which included the GQAP. Besides presenting an exact algorithm (i.e., Benders reformulation) for the GQAP, Fathollahi-Fard et al. [7] proposed an adaptive large neighborhood search algorithm. Greistorfer et al. [15] designed a TS metaheuristic for the GQAP. The authors mentioned that the GQAP has been used to model several applications such as order picking, storage layout in warehouse management, relational database design, and scheduling activities in semiconductor wafer processing. As can be seen by this literature review, there are many diverse applications of the GQAP as it relates to real-world problems.
SA is a stochastic metaheuristic algorithm that uses the idea of the annealing process of solids to solve combinatorial optimization problems (COPs). Kirpatrick et al. [16] were the first to use SA to solve COPs. McKendall et al. [17] presented two SA heuristics to solve a dynamic QAP, called the dynamic facility layout problem. More recently, Huo et al. [18] presented an SA heuristic for a task assignment and path planning problem which is viewed as a three-dimensional vehicle routing problem. This problem is a generalization of the generalized assignment problem combined with multiple traveling salesperson problems. Dai et al. [19] developed an SA heuristic for a home health care location-routing problem with a mixed fleet of electric and conventional vehicles that considers battery swapping stations. Tole et al. [20] used an SA heuristic to solve a new variant of the bin-packing problem called the circular bin-packing problem with rectangular items. In addition, Ghotb et al. [21] developed an SA algorithm to schedule trucks and allocate truckloads to compatible trucks for transporting logs. As illustrated above, the SA algorithm has been successfully used to solve many different types of COPs. For more details on SA, see Laarhoven and Aarts [22], Siarry [23], or Delahaye et al. [24].
In this paper, the GQAP is considered which involves assigning a set of facilities (e.g., machines or equipment) to a set of locations such that the sum of the assignment and transportation costs is minimized. The facilities may be of different sizes, and the locations may have varying space capacities. In addition, multiple facilities may be assigned to each location whereas location capacities are not exceeded. The objective of this research is to present simple but very effective approximation algorithms for solving real-world, large-size GQAP instances quickly without spending a lot of time setting the algorithm parameters. As a result, a construction algorithm and an SA algorithm is presented for the proposed problem, since there are fewer parameters to set in the SA algorithm, compared to most of the other algorithms available in the GQAP literature. Furthermore, some other advantages of SA are as follows:
  • SA, a single solution algorithm, can find “good” solutions quickly compared to population-based algorithms for certain COPs (Delahaye et al. [24]). As indicated in Cordeau et al. [9] and in Silva et al. [14], constructing/finding a population of solutions, especially for tightly constrained GQAP instances, can be computationally costly.
  • SA can easily handle problems with complex objective functions and constraints (Siarry [23] and Delahaye et al. [24]).
  • SA is easier to implement quickly since it is easier to understand and code compared to many other algorithms (Laarhoven and Aarts [22], Siarry [23], and Delahaye et al. [24]).
In this paper, mathematical models, a construction algorithm, and an SA algorithm are presented for the GQAP. In Section 2, the mathematical models are presented for the GQAP, and an illustrative example is solved using one of the proposed models. The construction algorithm and an SA algorithm for the GQAP is presented in Section 3. In Section 4, some computational results of the proposed solution methods, on a set of test problems taken from the literature, are given. Finally, Section 5 provides conclusions.

2. Mathematical Models

In this section, three mathematical models are presented for the GQAP. First, a nonlinear binary integer programming model is given. In order to obtain the global optimal solution for the problem, the model is linearized, and a mixed-integer linear programming model is introduced. Last, a combinatorial optimization problem model is presented for the GQAP.

2.1. Mathematical Programming Models

The GQAP is the problem of assigning a set of M facilities to a set of N locations, where M > N, such that the sum of the assignment and transportation costs is minimized. The assumptions of the GQAP are as follows.
  • One or more facilities may be assigned to each location such that the capacities of the locations are not exceeded.
  • The objective is to minimize the sum of the assignment and the transportation costs. The assignment costs consist of the cost of installing each facility (e.g., machine) to each location, and the transportation costs consist of the costs of moving materials processed on the machines between the machines.
  • The input data are deterministic and known. That is, the number of units of materials transported between facilities i and j (fij), the distances between locations k and l (dkl), the space requirement of each facility i (ri), the capacity of each location k (Ck), the costs of assigning or installing facility i to location k (aik), and the unit cost per distance unit of transporting materials between each pair of facility i at location k and facility j at location l (cijkl) are deterministic and known.
The mathematical programming formulation of the GQAP is given below and is an adaptation of the nonlinear programming model presented by Lee and Ma [2], but first the decision variables are defined as follows.
x i k = 1 ,   if   facility   i   is   assigned   to   location   k 0 ,   otherwise
Minimize   z = i = 1 M k = 1 N a i k x i k + i = 1 M j = 1 j i M k = 1 N l = 1 l k N c i j k l f i j d k l x i k x j l
Subject to
k = 1 N x i k = 1   i
i = 1 M r i x i k C k k
x i k = 0   o r   1   i ,   k
Objective function (1) minimizes the sum of the assignment and transportation costs. Constraints (2) ensures that each facility is assigned to exactly one location. Constraints (3) are used to ensure that the capacity of each location is not exceeded. Last, the restrictions on the variables are given in Constraint (4). Since the second term in Objective function (1), which is used to obtain total transportation cost, is nonlinear, the model above is a nonlinear binary integer programming model. To obtain the global optimal solution for the GQAP, the model is linearized by using a simple standard transformation by substituting wijkl for the term xikxjl. As a result, this gives the linearized objective function and the additional constraints.
Minimize z = i = 1 M k = 1 N a i k x i k + i = 1 M j = 1 j i M k = 1 N l = 1 l k N c i j k l f i j d k l w i j k l
w i j k l x i k + x j l 1   i , j i ,   k ,   l k
w i j k l 0   i , j i ,   k ,   l k
Therefore, the linearized mathematical model for the GQAP consists of Objective function (5) subject to Constraints (2)–(4) as well as Constraints (6) and (7). This yields a mixed-integer linear programming (MILP) model for the GQAP. Since the MILP model can only be used to solve small-size GQAP instances in reasonable computational time, a heuristic algorithm is needed to solve large-size GQAP instances, which will be discussed later. Next, a combinatorial optimization problem (COP) model is presented for the GQAP.

2.2. Combinatorial Optimization Problem Model

The GQAP is a type of COP because it’s solution can be represented as a finite set of locations, where locations may be repeated, since multiple facilities may be assigned to each location. More specifically, the solution, S, to the GQAP can be defined as follows where s(i) = k, which indicates that facility i is assigned to location k.
S = {s(1), s(2),, s(M)}
Since each facility i = 1, 2,…, M can be assigned to either location 1, 2,…, or N (i.e., s(i) = 1, 2,…, or N), there are NM possible solutions. However, many of the solutions may be infeasible because the capacity of one or more locations may be exceeded. For example, consider a solution S = {2, 1, 3, 3, 2} for a GQAP instance where five facilities (M = 5) are assigned to three locations (N = 3). In this solution, facilities 1 and 5 are assigned to location 2 (i.e., s(1) = s(5) = 2), facility 2 to location 1, and facilities 3 and 4 are assigned to location 3. Notice multiple facilities are assigned to locations 2 and 3. For the solution to be feasible, the capacity of each location must not be exceeded. This can be checked by using the capacity constraints below. For this GQAP instance, there are a total of 243 (35) solutions in which many may be infeasible. Nevertheless, using the same notation defined previously for the input data, the COP model for the GQAP consist of solution representation (8) and the following objective function and capacity constraints.
Minimize   T C ( S ) = i = 1 M a i s ( i ) + i = 1 M j = 1 j i M c i j s i s ( j ) f i j d s i s ( j )
Subject to
i   s . t .     s i = k r i C k     k
Equation (8) gives the assignment of facilities to locations. Objective function (9) is used to determine the minimum total cost (i.e., the sum of the assignment and transportation costs) of the solution, and Constraint (10) is used to check the feasibility of the solution. That is, it ensures that the capacity of each location is not exceeded.
The COP model above can be solved optimally using complete enumeration. In other words, the feasibility of all NM solutions can be checked using Constraint (10). Then, each feasible solution can be evaluated using Objective function (9), and the solution S* that gives the minimum total cost is the optimal solution. As with the MILP model presented in Section 2.1, only small-sized problems can be solved in reasonable computational time using the COP model and complete enumeration. Therefore, heuristic algorithms are developed for the GQAP using the COP model, but next an illustrative example is presented and is solved using the proposed MILP model.

2.3. Illustrative Example

Consider a GQAP where five facilities (e.g., machines) are assigned to three locations on the plant floor of a production department located in a manufacturing plant. The unit cost per distance unit of transporting materials between each pair of facilities is 2 (i.e., cijkl = 2 for all i, j, k, and l). See Table 1 below for the other input data for the small illustrative example. Specifically, the amounts of materials transported between facilities i and j (fij), the costs of assigning or installing facility i to location k (aik), the distances between locations k and l (dkl), the space requirement of each facility i (ri), and the capacity of each location k (Ck) are given in Table 1.
Using the MILP model presented above, which consists of Objective function (5) subject to Constraints (2)–(4) as well as Constraints (6) and (7), and the CPLEX 11.0 solver, the optimal solution is obtained for the illustrative example. Since the auxiliary variables, wijkl, were only used to linearize the GQAP model and does not provide any useful information, the values of these variables are not given. However, the nonzero values of the binary decision variables, xik, are x11 = x21 = x32 = x43 = x53 = 1 where the total cost of the solution (z*) is 17,800, which is the sum of 6800 (i.e., total assignment cost) and 11,000 (i.e., total transportation cost). More specifically, facilities 1 and 2 are assigned to location 1, facility 3 to location 2, and facilities 4 and 5 to location 3 which give the minimum total cost of 17,800. See display of optimal solution in Figure 1 below. The optimal solution was obtained in 0.14 s. However, as will be discussed in Section 4, the computational results section of the paper, computational time increases exponentially as the problem size increases. Therefore, heuristic algorithms are presented next using the COP model formulation.

3. Methods

In this section, heuristic algorithms are presented for the GQAP. First, a construction algorithm is presented, which is similar to one of the algorithms given in McKendall and Li [12] for the GQAP. Afterwards, a simple but effective SA algorithm is developed for the proposed problem. Recall that the objective of this research is to present simple but very effective approximation algorithms for solving real-world, large-size GQAP instances quickly without spending a lot of time setting the algorithm parameters.

3.1. Construction Algorithm

The flowchart and the pseudo-code for the construction algorithm (CA) are presented below for the GQAP in Figure 2 and Algorithm 1, respectively. This algorithm uses only the capacities of the locations (Ck) and the space requirement for each facility (ri) as input data as well as the solution representation defined in Equation (8) to construct a feasible solution S. In other words, the proposed CA does not attempt to construct solutions with respect to minimizing total cost but to construct feasible solutions for all situations, including tightly constrained GQAPs which may occur often in the real world. A GQAP instance is defined as tightly constrained when location utilization is high (i.e., more than 70%). In contrast, if the location utilization is low, say under 40%, the GQAP instance is defined as loosely constrained. Consider the illustrative example given above in Table 1. Since the facilities assigned to locations utilizes 81.8% (i.e., (90/110) × 100%) of total location capacity, this problem is considered to be tightly constrained. Again, in the development of CA, the goal was to ensure that initial feasible solutions are constructed for all types of GQAPs especially for tightly constrained problems. To achieve this goal, CA attempts to assign facilities requiring more space to the first location. However, if there is not enough space at the location, the next largest facility is considered and facilities are assigned until no other facility can be assigned to the location. Then, the largest facility that had not been assigned yet is assigned to the second location. This process is continued until all facilities are assigned to locations. The details of the algorithm are given below, but first, the definitions of the CA algorithm parameters are provided.
  • The additional notation used in CA are as follows.
  • Cap(k) = the remaining capacity of location k.
  • SetOfFac = vector of facilities sorted in descending order based on ri.
  • SetOfFac(p) = facility in the p-position of the vector SetOfFac.
  • s(i) = location assigned to facility i.
  • Remove(i) = function used to remove i from the vector SetOfFac.
Algorithm 1: CA(Ck, ri)
1: Initialize Ck and ri
2: Construct SetOfFac by sorting facilities in descending order based on ri (break ties by lower i)
3: k ← 1                //k is the location index for vector Ck
4: while kN and SetOfFac ≠ {} do    //{} is the empty set
5:Cap(k)Ck
6:p ← 1               //p is the position index in SetOfFac
7:repeat
8:iSetOfFac(p)          // i is the facility number in position p in SetOfFac
9:if riCap(k) then
10:s(i)k
11:Cap(k)Cap(k) – ri
12:Remove(i)          // Remove facility i from SetOfFac
13:else
14:pp + 1
15:end if
16:until Cap(k) < ri* do        // i* = SetOfFac(Last) (i.e., facility in last position in SetOfFac)
17:kk + 1
18: end while
19: return S              // S = {s(1), s(2), …, s(M)}
To illustrate CA in Algorithm 1 for the illustrative example presented in Table 1, the input arguments are initialized (line 1) where ri = {20, 10, 30, 10, 20} and Ck = {30, 30, 50}. Next, the vector SetOfFac = {3, 1, 5, 2, 4} is generated (line 2). As stated previously, the facility which requires the most space (i.e., r3 = 30) is put in first. After putting facility 3 in the first position, notice the next largest space requirement is 20 for facilities 1 and 5. Priority is given to the lower number facility; therefore, facilities 1 and 5 are put in the second and third positions, respectively. Then, facilities 2 and 4. Once the vector SetOfFac is obtained, facilities are assigned to locations based on their order in this set (lines 3–18). More specifically, first facility i in the first position (p = 1) in SetOfFac is assigned to location k (k = 1), s(3) = 1, since there is enough capacity (lines 3–10). Then, the capacity of the location is updated, Cap(1) = 30–30 = 0 (line 11), and facility 3 is removed from the set where SetOfFac = {1, 5, 2, 4} (line 12). Since Cap(1) = 0 < 10 = r4 (line 16), the next location, k = 2, is considered (line 17). At the next iteration (iteration 2), the first facility i in the first position (p = 1) in SetOfFac is assigned to location 2, s(1) = 2, since there is enough capacity (lines 5–10). The capacity for location 2 is updated, Cap(2) = 30 − 20 = 10 (line 11) and facility 1 is removed where SetOfFac = {5, 2, 4} (line 12). Since the condition Cap(2) = 10 ≤ 10 = r4 is satisfied (line 16), at the next iteration (iteration 3), an attempt to assign facility 5 to location 2 is made but abandoned due to insufficient capacity, i.e., the condition r5 = 20 ≤ 10 = Cap(2) does not hold (lines 8–9). Therefore, the position index p is increased (line 14), and at the next iteration (iteration 4), facility 2 is assigned to location 2, s(2) = 2, and is removed from the set where SetOfFac = {5, 4} (lines 8–12). Since there is no more capacity available at location 2 (line 16), the next location is considered (line 17). This process is continued, and after two more iterations, solution S is provided, where S = {2, 2, 1, 3, 3} (line 19). Using Objective function (9), the total cost of the solution S, TC(S) = 18,600, is obtained where total assignment cost and total transportation costs are 6400 and 12,200, respectively. Recall that the optimal solution obtained using the MILP model for the GQAP was displayed in Figure 1 and can be represented as S* = {1, 1, 2, 3, 3} where TC(S*) = 17,800.
As stated earlier, the goal of CA is to ensure that initial feasible solutions are constructed for all types of GQAPs including tightly constrained problems. Once a solution is generated, an improvement algorithm, which will be discussed below, is used to obtain a better solution, perhaps a “good” local optimum. The proposed improvement algorithm consists of an SA algorithm and a local search algorithm. Next, an SA algorithm is presented for the GQAP.

3.2. Simulated Annealing Algorithm

As stated earlier, the objective of this research is to present simple but very effective approximation algorithms for solving real-world, large-size GQAP instances quickly without spending a lot of time setting the algorithm parameters. Therefore, an SA algorithm is developed for the GQAP, since it requires setting fewer algorithm parameters, compared to many of the other algorithms available in the literature. Furthermore, it is easier to implement (i.e., understand and code) compared to other algorithms.
The proposed SA heuristic algorithm is a direct application of SA to the GQAP, and it attempts to solve the COP model given in Equations (9) and (10) using the solution representation in Equation (8). Unlike complete enumeration which considers all possible NM solutions, SA considers exploring different areas of the solution space effectively, since it is computationally intractable to explore the entire solution space even when N (number of locations) and M (number of facilities) are relatively small. For example, if M = 15 and N = 10, there are 1.0 × 1015 possible solutions.
In summary, the proposed SA algorithm explores areas of the solution space as follows. Given an initial solution S0, solutions near this solution (i.e., in the neighborhood of solution S0) are explored by performing an operation (or move) on S0. There are two types of moves.
  • Shift move consists of changing the assigned location of a facility to a different location. For example, in a solution S0, an assignment which assigns facility i to location k (i.e., s(i) = k) is changed where facility i is reassigned to a different location k’ (i.e., s(i) = k’) which gives the neighboring solution S;
  • Swap move consists of exchanging the assigned locations of two facilities assigned to different locations (e.g., in a solution S0, s(i) = k and s(j) = l are changed to s(i) = l and s(j) = k which gives the neighboring solution S).
The proposed SA algorithm randomly selects only one move to perform at each iteration. If a move produces an infeasible solution based on location capacity constraints (10) in the COP model, then another randomly generated move is selected until the move produces a feasible solution S. The solution S is accepted as the new solution S0 if either the solution S is better than solution S0 (i.e., TC(S) < TC(S0)) or the solution S is not better than S0 given a certain condition. In the latter case, the solution S is accepted as the new solution S0 if a randomly generated number between zero and one (i.e., rand(0, 1)) is less than the probability p, the probability of accepting a non-improving solution S where p is given as follows.
p = exp(−∆TC/T)
Note, ∆TC = TC(S0)TC(S), T is the current temperature and exp is the exponential function. When the temperature T is high, which is at the beginning of the search, the probability p of accepting a worse solution S as the new S0 is high, which allows the search to jump to different areas of the solution space. This allows the algorithm to search the solution space without quickly converging to a poor local optimum. After a certain number of iterations, NT, at the current temperature T, the temperature is reduced using the following equation where 0 < α < 1. Note, α is called the cooling ratio.
T = α × T
For a slow reduction in temperature T, consider α ≥ 0.90. However, when the temperature T is low, the probability p of accepting a worse solution S as the new S0 is low, which allows the search to search the neighborhood of S0 more thoroughly in search of a local optimum. This increases the chances of allowing the algorithm to possibly converge to a good local optimum.
Because the SA algorithm is a stochastic algorithm, it does not always produce a local optimum especially for complex, large-size problems. In other words, the best solution S* produced by the SA algorithm may not be a local optimum (i.e., there exists a solution S in the neighborhood of solution S* that is obtained by either a Shift move or a Swap move which gives a lower total cost, TC(S) < TC(S*)). As a result, a steepest descent (local search) algorithm is implemented to ensure that the best solution obtained is a local optimum. In order for this to happen, the entire neighborhoods of the Shift move and Swap move are explored. There are a total of M(N − 1) possible solutions in the Shift neighborhood of a solution S*, and a total of M(M − 1)/2 possible solutions in the Swap neighborhood of a solution S*. All the feasible solutions in these neighborhoods are considered, and the best feasible solution S is compared against the current S* (i.e., it is either TC(S) < TC(S*) or ∆TC > 0?). If S is better than S*, set S as best new solution S*, and repeat the process until there is no improvement in S*. The steps for the steepest decent (local search) algorithm are as follows.
  • Given solution S* and cost of solution TC(S*);
  • Find all feasible solutions in the Shift and Swap neighborhoods of S*;
  • Pick the best feasible solution S with respect to total cost, TC(S). If TC(S) < TC(S*), set S* = S and TC(S*) = TC(S), and go to Step 2. Else, terminate algorithm and return local optimum S* and its cost TC(S*).
The flowchart and the pseudo-code of the SA algorithm is given below in Figure 3 and Algorithm 2, respectively. The additional notation used in Algorithm 2 are as follows.
  • TC = TC(S0) − TC(S)
  • T0 = initial temperature.
  • α = cooling ratio where 0 < α < 1. Consider α ≥ 0.90 for slow reduction of temperature.
  • T = current temperature where temperature is reduced using the cooling scheduling given in Equation (12).
  • min_T = minimum temperature used in stopping criterion. Stop if T > min_T.
  • NT = number of iterations at each temperature T.
  • p = probability of accepting a worse (non-improving) neighboring solution S. See Equation (11).
  • p′= probability of accepting non-improving solution S at initial temperature T.
  • rand(0, 1) = a random real number between zero and one.
  • LocalSearch(S*, TC(S*)) = function used to perform steepest descent algorithm.
Algorithm 2: SA(T0, min_T, NT, α)
1: Initialize T0, min_T, NT, and α
2: S0CA(Ck, ri)
3: Compute TC(S0) using Objective function (9) of COP model
4: S*S0, TC(S*)TC(S0)  // update best solution S* and its cost
5: n ← 0, TT0  //initialize iteration counter n at each temperature and temperature T
6: while Tmin_T do
7:Randomly generate move and obtain neighboring solution S
8:Check if S is feasible using Constraint (10) of COP model
9:if S is feasible then
10:TCTC(S0)TC(S)
11:if ∆TC > 0 or p = exp(−TC/T) > rand(0, 1) then
12:S0S
13:if TC(S0) < TC(S*)
14:S*S0, TC(S*)TC(S0)  // update best solution S* and its cost
15:end if
16:end if
17:nn + 1
18:if n = Nt then
19:n ← 0, Tα×T  // update iteration counter n and temperature T
20:end if
21:end if
22: end while
23: S*LocalSearch(S*, TC(S*))
24: return S*and TC(S*)    // return best solution S* and its costs
As stated earlier, the time it takes to set the proposed SA algorithm parameters (i.e., T0, min_T, NT, and α) is much less compared to most of the heuristic algorithms available in the literature. The algorithm parameters were obtained either theoretically or experimentally. More specifically, the cooling ratio, α, and minimum temperature, min_T, were obtained experimentally. In other words, based on preliminary experiments, it was decided to set α = 0.99 and min_T = 0.01. However, the initial temperature T0 was obtained theoretically using Equation (11). Replacing T with T0 and manipulating Equation (11), the following equation is obtained for the initial temperature, where ln is the natural logarithm function.
T0 = −∆TC/ln(p′)
If the probability of accepting a neighboring solution S with a cost of y% above the cost of the initial solution S0 is p′, then ∆TC = yTC(S0) and the following equation is obtained.
T0 = −yTC(S0)/ln(p′)
Recall, TC(S0) is the total cost of the initial solution S0 obtained from the construction algorithm presented in Algorithm 1. For setting the initial temperature To, it was decided to accept solutions with a cost of 10% above the cost of the initial solution S0 (i.e., set y = 0.10) and p′ was considered to take on the values 0.6, 0.7, 0.8, and 0.9. Based on preliminary experiments, it was decided to set p′ = 0.9. Based on y = 0.10 and p′ = 0.90, there is a 90% chance of selecting a solution S, at the initial temperature T0, that is 10% above the cost of the initial solution S0. Now, the number of iterations to be performed at each temperature T, NT, is based on the number of possible solutions in the Shift and Swap neighborhoods, which are M(N − 1) and M(M − 1)/2, respectively, as discussed earlier. Therefore, it was decided to set NT according to the following equation where q is a percent of the total number of possible solutions in the neighborhoods of S0.
N T = q [ M N 1 + M ( M 1 ) / 2 ]
In other words, NT is q% of the total number of possible solutions in the neighborhoods of S0, rounded above to the nearest integer. It was decided to consider q = 40%, 50%, 60%, 70%, 80%, 90%. After preliminary experiments, it was decided to set q = 50%.
It is important to note, that the preliminary experiments used to experimentally determine the SA algorithm parameters are based on solving several different types of GQAP instances that are loosely, medium, and tightly constrained as discussed in Section 3.1. These GQAP instances belong to a set of test problems taken from the literature. Next, the performance of the proposed SA algorithm on these set of test problems is presented and compared against the state-of-the-art heuristic algorithms available in the literature for the GQAP.

4. Computational Results

A set of test problems taken from Cordeau et al. [9] is used to evaluate the performance of the proposed SA algorithm, given in Algorithm 2, using the construction algorithm presented in Algorithm 1 in Section 3. The authors labeled the GQAP instances using the notation M-N-U where M = number of facilities, N = number of locations, and U = location utilization as defined earlier. The set of test problems contain twenty-one GQAP instances with 20, 30, 35, 40, and 50 facilities (i.e., M = 20, 30, 35, 40, and 50) and with locations ranging from 6 to 20 (i.e., N = 6, 7, 8, 9, 10, 15, and 20). Additionally, the location utilizations, as discussed in Section 3.1, for these instances ranges between 35% and 95% (i.e., U = 35, 55, 65, 75, and 95). In all experiments, a PC (equipped with Microsoft Windows 10, an Intel Core processor i7 with a CPU speed of 2.90 GHz and 16 GB of RAM) was used to solve the test problems, and the proposed construction algorithm and SA heuristic were coded using Matlab.
First, an attempt was made to solve the smaller-size test problems (e.g., 30-07-75 and 20-15-35) using the MILP model presented in Section 2.1, which consists of Objective function (5) subject to Constraints (2)–(4) as well as Constraints (6) and (7). Using the MILP model and the CPLEX 11.0 solver, the optimal solutions were not obtained for any of the test problems. More specifically, low quality, feasible solutions were obtained after running the problems for over four hours, since CPLEX uses a type of branch-and-bound algorithm which uses and stores a search tree. As the search continues over long periods of time, the search tree grows and consumes a lot of the computer’s RAM. Once it uses up most of the computer’s RAM, the CPLEX solver shutdowns. However, there are exact algorithms available in the literature that can solve small-size problems. For example, Pessoa et al. [6] proposed two exact algorithms for the GQAP which uses a branch-and-bound scheme with a Lagrangean relaxation procedure over a reformulation–linearization technique. The authors were able to solve instances with up to 35 facilities in up to a few days of running time. As a result, heuristic algorithms are needed to solve medium- to large-size GQAP instances.
The performance of the proposed SA heuristic for all the test problems taken from Cordeau et al. [9] is given below in Table 2. The costs of the initial solutions obtained from the construction algorithm (Algorithm 1) are given in column 2. Since each instance was solved 50 times, the maximum (Max), average (Avg), and minimum (Min) total costs of the best solutions found are presented in columns 3–5, and the computational times (in seconds) are given in columns 7–9. The best-known solution (BKS) available in the literature for each problem instance is shown in column 6. It is important to note that since many of the state-of-the-art algorithms for the GQAP terminate their search once the BKS is found, this stopping criterion is utilized for the proposed SA algorithm. However, if the BKS is not obtained, then the proposed stopping criterion available in Algorithm 2 is used to terminate the search. Notice in Table 2 that the proposed SA algorithm obtained the BKS for all instances. However, the tightly constrained instance 30-20-95 required more computational time than all the other instances.
As discussed in Section 1, several heuristic algorithms are available in the literature for solving the GQAP. The state-of-the-art algorithms are the MA presented by Cordeau et al. [9], GRASP with path-relinking (GRASP-PR) algorithms presented by Mateus et al. [11], the TS algorithm presented by McKendall and Li [12], and the parallel memetic iterated TS (PMITS) heuristic algorithm presented by Silva et al. [14]. Although the last algorithm uses more computing power by using parallel computing (a CPU with 40 cores), the proposed SA algorithm is competitive as can be seen in Table 3 below. Note, Cordeau et al. [9] did not terminate their MA once they obtained the BKS. Therefore, their run times are larger.
In Table 3, the average run times are given in minutes for all the state-of-the art algorithms and the proposed SA algorithm. The average times for the other algorithms are times reported in the literature. All the heuristic algorithms obtained the BKS for each of the instances except for TS algorithm. It was unable to obtain the BKS for only instance 30-20-95 (see asterisk “*” with average run time). In addition, it is noticed that the PMITS heuristic algorithm solved all the instances, on average, in less than 0.1 min, except for instance 30-20-95, where it took 9 min on average. Silva et al. [14] stated that this is because this instance is tightly constrained, around a third of the time PMITS spent attempting to construct the initial population of feasible solutions. As a result, the proposed SA algorithm has an overall less total average run time of 0.3 min for each instance compared to 0.4 min for PMITS. It is important to note that it is impossible to accurately compare the computation times of these heuristic algorithms, since they were solved in different computing environments using different programming languages, etc. Nevertheless, the results show the effectiveness of the proposed SA algorithm with respect to both solution quality and computation time.

5. Conclusions

In this paper, the GQAP is considered which involves assigning a set of facilities (e.g., machines and equipment) to a set of locations (e.g., on the plant floor of a manufacturing plant) such that the sum of the assignment and transportation costs is minimized. The facilities may be of different sizes, and the locations may have varying capacities where multiple facilities may be assigned to each location without exceeding the space capacity of the locations. A construction algorithm and an SA algorithm were presented for the GQAP. The proposed SA algorithm consists of a basic but effective SA approach with a steepest descent (local search) algorithm. The advantages of the algorithm are it is easier to implement (i.e., understand and code) and requires setting fewer heuristic algorithm parameters, compared to most of the other algorithms available in the literature. The effectiveness of the proposed SA algorithm was illustrated through conducting computational experiments on a set of test problems available in the GQAP literature. The proposed SA algorithm performed very well compared to the performances of the four state-of-the-art heuristic algorithms available in the literature. It was able to find the best-known solution (BKS) for each GQAP instance using up very little computation time. The following recommendations are given for future research. Consider developing other possible heuristic algorithms such as population-based algorithms (e.g., bat, gray wolf optimization, monarch butterfly optimization, particle swarm optimization, and genetic algorithms) for the GQAP. Another possibility consists of extending the GQAP by considering the stochastic nature of the problem (e.g., units of materials flowing between facilities are stochastic) and develop efficient heuristic algorithms for the problem.

Author Contributions

Conceptualization, A.M. and Y.D.; methodology, A.M. and Y.D.; software, Y.D.; validation, A.M. and Y.D.; formal analysis, A.M.; writing—original draft preparation, A.M.; writing—review and editing, A.M. and Y.D.; visualization, A.M.; supervision, A.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Acknowledgments

We would like to thank the anonymous reviewers for their constructive comments.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Öncan, T. A Survey of the Generalized Assignment Problem and Its Applications. INFOR Inf. Syst. Oper. Res. 2007, 45, 123–141. [Google Scholar] [CrossRef]
  2. Lee, C.G.; Ma, Z. The generalized quadratic assignment problem. In Research Report, Department of Mechanical and Industrial Engineering; University of Toronto: Toronto, ON, Canada, 2004. [Google Scholar]
  3. Ünal, Y.Z.; Uysal, Ö. A new mixed integer programming model for curriculum balancing: Application to a Turkish university. Eur. J. Oper. Res. 2014, 238, 339–347. [Google Scholar] [CrossRef]
  4. Guignard, M. Strong RLT1 bounds from decomposable Lagrangean relaxation for some quadratic 0–1 optimization problems with linear constraints. Ann. Oper. Res. 2020, 286, 173–200. [Google Scholar] [CrossRef]
  5. Hahn, P.M.; Kim, B.J.; Guignard, M.; Smith, J.M.; Zhu, Y.R. An algorithm for the generalized quadratic assignment problem. Comput. Optim. Appl. 2008, 40, 351–372. [Google Scholar] [CrossRef]
  6. Pessoa, A.A.; Hahn, P.M.; Guignard, M.; Zhu, Y.R. Algorithms for the generalized quadratic assignment problem combining Lagrangean decomposition and the Reformulation-Linearization Technique. Eur. J. Oper. Res. 2010, 206, 54–63. [Google Scholar] [CrossRef]
  7. Fathollahi-Fard, A.M.; Wong, K.Y.; Aljuaid, M. An efficient adaptive large neighborhood search algorithm based on heuristics and reformulations for the generalized quadratic assignment problem. Eng. Appl. Artif. Intell. 2023, 126, 106802. [Google Scholar] [CrossRef]
  8. Sahni, S.; Gonzalez, T. P-complete approximation problems. J. ACM 1976, 23, 555–565. [Google Scholar] [CrossRef]
  9. Cordeau, J.F.; Gaudioso, M.; Laporte, G.; Moccia, L. A memetic heuristic for the generalized quadratic assignment problem. INFORMS J. Comput. 2006, 18, 433–443. [Google Scholar] [CrossRef]
  10. Zou, D.; Gao, L.; Li, S.; Wu, J.; Wang, X. A novel global harmony search algorithm for task assignment problem. J. Syst. Softw. 2010, 83, 1678–1688. [Google Scholar] [CrossRef]
  11. Mateus, G.R.; Resende, M.G.; Silva, R.M. GRASP with path-relinking for the generalized quadratic assignment problem. J. Heuristics 2011, 17, 527–565. [Google Scholar] [CrossRef]
  12. McKendall, A.; Li, C. A tabu search heuristic for a generalized quadratic assignment problem. J. Ind. Prod. Eng. 2017, 34, 221–231. [Google Scholar] [CrossRef]
  13. Mostafa, R. Metaheuristics for the Generalized Quadratic Assignment Problem. Master’s Thesis, West Virginia University, Morgantown, WV, USA, July 2020. Available online: https://researchrepository.wvu.edu/etd/7717 (accessed on 27 October 2024).
  14. Silva, A.; Coelho, L.C.; Darvish, M. Quadratic assignment problem variants: A survey and an effective parallel memetic iterated tabu search. Eur. J. Oper. Res. 2021, 292, 1066–1084. [Google Scholar] [CrossRef]
  15. Greistorfer, P.; Staněk, R.; Maniezzo, V. A Tabu Search Matheuristic for the Generalized Quadratic Assignment Problem. In Metaheuristics International Conference; Springer International Publishing: Cham, Switzerland, 2022. [Google Scholar] [CrossRef]
  16. Kirpatrick, S.; Gelatt, C.D.; Vecchi, M.P. Optimization by simulated annealing. Science 1983, 220, 671–680. [Google Scholar] [CrossRef]
  17. McKendall, A.R.; Shang, J.; Kuppusamy, S. Simulated annealing heuristics for the dynamic facility layout problem. Comput. Oper. Res. 2006, 33, 2431–2444. [Google Scholar] [CrossRef]
  18. Huo, L.; Zhu, J.; Wu, G.; Li, Z. A novel simulated annealing based strategy for balanced UAV task assignment and path planning. Sensors 2020, 20, 4769. [Google Scholar] [CrossRef]
  19. Dai, Z.; Zhang, Z.; Chen, M. The home health care location-routing problem with a mixed fleet and battery swapping stations using a competitive simulated annealing algorithm. Expert Syst. Appl. 2023, 228, 120374. [Google Scholar] [CrossRef]
  20. Tole, K.; Moqa, R.; Zheng, J.; He, K. A simulated annealing approach for the circle bin packing problem with rectangular items. Comput. Ind. Eng. 2023, 176, 109004. [Google Scholar] [CrossRef]
  21. Ghotb, S.; Sowlati, T.; Mortyn, J. Scheduling of log logistics using a metaheuristic approach. Expert Syst. Appl. 2024, 238, 122008. [Google Scholar] [CrossRef]
  22. van Laarhoven, P.J.M.; Aarts, E.H.L. Simulated Annealing: Theory and Applications, 1st ed.; D. Reidel Publishing Company: Dordrecht, The Netherlands, 1987. [Google Scholar]
  23. Siarry, P. Simulated Annealing. In Metaheuristics; Siarry, P., Ed.; Springer International Publishing: Cham, Switzerland, 2016; pp. 19–50. [Google Scholar]
  24. Delahaye, D.; Chaimatanan, S.; Mongeau, M. Simulated Annealing: From Basics to Applications. In Handbook of Metaheuristics; Gendreau, M., Potvin, J.Y., Eds.; International Series in Operations Research & Management Science; Springer International Publishing: Cham, Switzerland, 2019; Volume 272, pp. 1–35. [Google Scholar] [CrossRef]
Figure 1. Optimal Assignment for Small GQAP Illustrative Example.
Figure 1. Optimal Assignment for Small GQAP Illustrative Example.
Algorithms 17 00540 g001
Figure 2. Flowchart of the construction algorithm.
Figure 2. Flowchart of the construction algorithm.
Algorithms 17 00540 g002
Figure 3. Flowchart of the simulated annealing algorithm.
Figure 3. Flowchart of the simulated annealing algorithm.
Algorithms 17 00540 g003
Table 1. Input data for small illustrative example.
Table 1. Input data for small illustrative example.
fij12345aik123dkl123
10100502001100018001400102050
200100002160010001200220030
30005003120018002000350300
400001004200012001400Ck303050
5000005140020001000
ri2010301020
Table 2. Summary of results of proposed SA algorithm on set of test problems.
Table 2. Summary of results of proposed SA algorithm on set of test problems.
InstanceSolutionTime (s)
InitialMaxAvgMinBKSMaxAvgMin
20-15-353,296,3391,554,9041,497,611.91,471,8961,471,8966.84.51
20-15-553,811,1561,752,0351,739,005.91,723,6381,723,6386.451.5
20-15-753,697,9042,000,5191,965,217.51,953,1881,953,18811.38.12.2
30-06-958,502,8345,192,9685,164,120.35,160,9205,160,92015.18.93.2
30-07-756,972,9534,442,1434,390,408.34,383,9234,383,9238.13.71.5
30-08-557,756,7993,501,6953,501,6953,501,6953,501,6951.61.51.3
30-10-657,446,4083,708,7683,640,528.83,620,9593,620,95910.88.51.9
30-20-356,564,7453,762,5103,564,370.73,379,3593,379,35914.911.62.8
30-20-558,921,9663,755,8593,622,121.43,593,1053,593,10517.8123.9
30-20-758,146,8034,291,9424,110,134.94,050,9384,050,93828.123.35.6
30-20-958,627,5696,108,7715,893,437.85,710,6455,710,645121.5107.725.9
35-15-3510,150,1944,515,7314,470,900.94,456,6704,456,67012.410.92.8
35-15-5510,790,0174,793,7704,679,438.84,639,1284,639,12814.911.53.3
35-15-7512,170,1356,450,2896,344,300.96,301,7236,301,72324.3185.1
35-15-9512,581,6146,988,5546,833,884.36,670,2646,670,26467.458.616.5
40-07-7512,467,4507,481,7567,420,285.27,405,7937,405,79311.46.42.4
40-09-9514,780,9117,856,5447,763,270.27,667,7197,667,71935.729.69.4
40-10-6515,547,3707,298,1037,270,402.37,265,5597,265,559146.73
50-10-6525,416,36410,623,76810,530,33410,513,02910,513,02918.910.64.8
50-10-7521,806,54511,458,17211,302,423.711,217,50311,217,50332.225.45.1
50-10-9523,195,08513,133,21312,947,121.612,845,59812,845,59851.937.412.5
Average11,078,626.75,746,286.45,650,048.35,596,821.55,596,821.52519.55.5
Table 3. Comparison of proposed SA algorithm with state-of-the art algorithms.
Table 3. Comparison of proposed SA algorithm with state-of-the art algorithms.
InstanceBKSTime (min)
Memetic [9]GRASP-PR [11]TS [12]PMITS [14]SA
20-15-351,471,8961.60.1000.1
20-15-551,723,6381.70000.1
20-15-751,953,1881.704.200.1
30-06-955,160,9201.90000.1
30-07-754,383,9232.60.1000.1
30-08-553,501,6951.60000
30-10-653,620,9593.520.100.1
30-20-353,379,3599.41.332.800.2
30-20-553,593,1057.70.424.600.2
30-20-754,050,9388.70.7000.4
30-20-955,710,64544.2926.30.2 *91.8
35-15-354,456,6707.65.126.800.2
35-15-554,639,1286.40.4000.2
35-15-756,301,7236.61.1000.3
35-15-956,670,26414.425.9001
40-07-757,405,79331000.1
40-09-957,667,7191970.10.10.5
40-10-657,265,55940.3000.1
50-10-6510,513,0298.40.4000.2
50-10-7511,217,50310.123.10.100.4
50-10-9512,845,59820.91.50.400.6
Average5,596,821.58.847.54.30.40.3
* Did not obtain the BKS.
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

McKendall, A.; Dhungel, Y. A Simulated Annealing Algorithm for the Generalized Quadratic Assignment Problem. Algorithms 2024, 17, 540. https://doi.org/10.3390/a17120540

AMA Style

McKendall A, Dhungel Y. A Simulated Annealing Algorithm for the Generalized Quadratic Assignment Problem. Algorithms. 2024; 17(12):540. https://doi.org/10.3390/a17120540

Chicago/Turabian Style

McKendall, Alan, and Yugesh Dhungel. 2024. "A Simulated Annealing Algorithm for the Generalized Quadratic Assignment Problem" Algorithms 17, no. 12: 540. https://doi.org/10.3390/a17120540

APA Style

McKendall, A., & Dhungel, Y. (2024). A Simulated Annealing Algorithm for the Generalized Quadratic Assignment Problem. Algorithms, 17(12), 540. https://doi.org/10.3390/a17120540

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop