Quantum-Inspired Evolutionary Approach for the Quadratic Assignment Problem

The paper focuses on the opportunity of the application of the quantum-inspired evolutionary algorithm for determining minimal costs of the assignment in the quadratic assignment problem. The idea behind the paper is to present how the algorithm has to be adapted to this problem, including crossover and mutation operators and introducing quantum principles in particular procedures. The results have shown that the performance of our approach in terms of converging to the best solutions is satisfactory. Moreover, we have presented the results of the selected parameters of the approach on the quality of the obtained solutions.


Introduction
The quadratic assignment problem (QAP) is one of the most interesting and difficult combinatorial optimization problem. Due to its popularity, many publications have focused on the QAP problem to search for methods that are sufficient for practical applications. Some studies have focused on the applicability of the QAP to the solution of many various problems. There exist several problems which are specializations of this problem, like: graph partitioning and maximum clique problem, travelling salesman problem, graph isomorphism and graph packing problem [1]. The QAP problem has been shown to be N P-hard [2], hence several approaches have been used to solve this problem. Intensive studies on quadratic assignment problems produced many algorithms over the last few decades. For a survey on these methods, see [3,4]. It should be mentioned that the performance of the methods for solving the quadratic assignment problems depends on the complexity of the problems. Due to the computational complexity of the QAPs, exact methods can solve relatively small-sized instances from the QAP benchmark library (QAPLIB) with up to 30 locations. Therefore, to obtain near-optimal solutions, various heuristic and metaheuristic approaches have been developed, such as tabu search [5][6][7], simulated annealing [8,9], scatter search or swarm algorithms including ant colony optimization [10], particle swarm optimization [11,12] and bees algorithm [13,14]. One of the initiatives followed by many researchers is using evolutionary algorithms for solving quadratic assignment problems [3,[15][16][17][18]. Although these algorithms do not ensure obtaining optimum solutions, they produce good results in a reasonable computation time.
In this paper we focus on the quantum-inspired evolutionary algorithm (QIEA) that draws inspiration from evolutionary computing and quantum computing. It is worth mentioning that the harnessing of quantum computing to the study of various problems can take two forms. One may choose to adapt some principles of quantum computing in the classical existing approaches. Alternatively, a quantum mechanical hardware may be sought via the studies.
Although there are studies on the individual topics of the quadratic assignment problem and quantum-inspired evolutionary algorithms, we have found none that covers both of these two topics. The purpose of this paper is to demonstrate that QIEA for solving QAP is possible through the correct design of particular procedures. Therefore, we assumed that QIEA can be applied after its modification, concerning a representation of solutions to the proper choice of crossover operators and quantum gates. We incorporate a rich set of examples to illustrate the application of the different operators in our approach and to show that appropriate modifications are needed to ensure the admissibility of solutions and efficiency of our approach.
Moreover, to introduce the basics of the quantum computing and the quadratic assignment problem, we have endeavoured to provide some in-depth quantum-inspired evolutionary algorithm for solving QAPs. The organization of this paper is as follows: Section 2 provides an overview introducing QAP, with some examples of its applications. Due to considerable importance of the quadratic assignment problem, this section briefly describes the Koopmans-Beckmann model. Section 3 gives more insight into the quantum-inspired evolutionary algorithms. In order to cope with the application of this algorithm to solve the quadratic assignment problem, we present some adaptations of the algorithm such as an appropriate representation of a solution, the crossover operators, the involvement of a quantum gate, the mutation procedure and the local search (2-opt). In Section 4, we provide the results of conducted experiments with respect to our approach performance on selected instances. Much work focuses on the impact of various parameter settings. We tested the impact of the 2-opt probability and the gate's occurrence on the quality of the obtained solutions. The final section regards a discussion of the results and summarizes the conclusions.

Quadratic Assignment Problem
The QAP problem was introduced by Koopmans and Beckmann in 1957 as a mathematical model for the assignment of a set of economic activities to a set of locations, with taking into account the distance and flow between the facilities and the costs of placing a facility in a specific location.
Let us now define the three non-negative matrices D = [d ij ] n×n , F = [ f ij ] n×n , B = [b ij ] n×n for the given set N = 1, ..., n and permutation π as the solution to the QAP problem. Thus, π(i) ∈ N (i = 1, ..., n) corresponds to the index of the facility and the set N is the set of the location indexes to which the facilities are assigned.
Formally, the QAP problem can be formulated as follows: given distances between locations (matrix D), the flow (weight, number of connections) between pairs of facilities (matrix F), and the assignment cost of the facility m to the position n (matrix B), which in most cases is omitted. The solution of QAP (also denoted as QAP(F, D, B)) can be shown with the permutation form π = (π(1), . . . , π(n)) of the set of n elements (facilities). The aim of solving the Koopmans-Beckmann model is to find the permutation π * in the set of permutations Π, so that: The aim is to minimize the objective function f (π) which describes a global cost assignment of n facilities to n locations. Π is the set of permutations on the set N. In most cases the matrix D is symmetric (distance d ij between two locations i and j is the same as between j and i). Matrix F is symmetric if f ij is regarded as connections.
As mentioned in the previous section, Sahni and Gonzales [2] proved that QAP is strongly N P-hard by showing that the existence of a polynomial time algorithm for solving QAPs with the entries of the coefficient matrices belonging to {0,1,2} implies the existence of a polynomial time algorithm for an N P-hard decision problem (the Hamiltonian cycle problem).
Many researchers discussed and examined the quadratic assignment problem in respect of its practical use. They proposed its application for solving various real problems e.g., hospital lay-out [49], campus planning model [50], backboard wiring problem [51], and so on. Reviews on some practical applications of QAPs can be found in [4].

Quantum-Inspired Evolutionary Algorithms
By combining quantum computing with an evolutionary algorithm, Han and Kim [52] proposed the first quantum-inspired evolutionary algorithm (QIEA) with quantum coding of chromosomes and a quantum rotation gate as a variation operator to increase obtaining better solutions. Apart from rotation gates, more various quantum gates such as the NOT, AND, OR, NAND, Hadamard, can be applied to modify the state of a qubit [53]. We do not discuss all the gates for changing the probabilistic distribution of each individual. The interested reader is referred to the original literature [53]. Moreover, a comprehensive survey of studies over quantum-inspired evolutionary algorithms is provided in [48]. In this section, firstly we briefly describe the principles of quantum computing, the difference between the coding used for the standard and quantum algorithms, and the main components of our approach.

Principles of Quantum Computing: Quantum Bit and Quantum Gate
The quantum-inspired evolutionary algorithms use quantum bits (qubits, Q-bits) to represent individuals, quantum gates employed to operate on the Q-bits to create the next generation (offspring) by employing an observation process to connect the Q-bit representation with the optimization variables. The Q-bit individual can describe a linear superposition of the basis states in a search space probabilistically and its representation maintains the population diversity. It is represented by a vector in the Hilbert space with the basis states |0 and |1 . Therefore, the superposition |Ψ of the qubit is represented as follows: where α and β are numbers that specify the probability amplitudes of the corresponding states and satisfy the normalization condition |α| 2 + |β| 2 = 1. Hence, the values |α| 2 and |β| 2 give the probabilities that the Q-bit will render the '0' or '1' states, respectively. Generally speaking, a qubit is the smallest unit of information and is represented by a pair of numbers [αβ] T . If the qubit individual q is defined as a string of the n qubits, a system has n Q-bits and expresses the 2 n states as follows: The i th Q-bit is updated by applying the following quantum rotation gate (Q-gate) [53]: where ϕ is the Q-gate rotation angle defined as: and s(α, β) and ∆ϕ are the direction of quantum gates rotation (the sign of ϕ) and the magnitude of rotation angle of ϕ, respectively. The rotation Q-gate quantum operator is presented in Figure 1. The direction and the rotation angle are given in the look-up table (Table 1) according to [54], where f (x) and f (b) represent the fitness of the current chromosome and the fitness of the best individual, respectively. Table 1. Parameters in look-up table.
However, it should be remembered that the rotation Q-gate quantum operator has a disadvantage. The values in the look-up table can affect the algorithm performance. Note that the rotation angle has an effect on the convergence speed. One way to avoid this problem is to use an adaptive strategy as was shown in [55].

Quantum Evolution for the Quadratic Assignment Problem Algorithm
The proposed algorithm was built on the principles of the genetic algorithm and quantum mechanics. As we know, the efficient mechanisms of genetic algorithms make them useful for different combinatorial problems. The algorithm goes up to the pseudo-optimal solution by the population update based on the selection, crossover and mutation operators. By combining these genetic operators, we can implement various genetic algorithms. For surveys of the crossover operators and their investigation within genetic algorithms for solving QAPs, see [56].
The proposed Quantum Evolutionary Algorithm for QAP problem (Q 2 APA) algorithm uses the solution representation based on the qubits. It employs several types of the pseudo-genetic operators which operate on the permutation form of the solution. Before using this operator, the qubit form of the solution is decoded to the form of the permutation. The algorithm uses the following crossover operators designed for the permutation solution representation: PMX (partially matched crossover), OX (order crossover) and CX (cycle crossover).
The general structure of the Q 2 APA approach is illustrated in Figure 2. The implemented procedures which use the qubit representation of the permutation are marked with the gray colour. The main components of our approach are presented in detail in the following sections.

Algorithm Initialization and Selection
The InitPopulation procedure creates λ solutions in the form (4), where α k , β k are real values generated randomly with the uniform distribution and k = 1, 2, ..., (log 2 n + 1)n, where n denotes the problem size. In the algorithm, the selection procedure can take two forms. One may choose to adopt the roulette wheel method. Therefore, there will be more chromosomes that have the lower objective function value in the new generated population. For each chromosome in the population the fitness value f (π i ) of permutation π i is given as the difference between the worst solution obtained in the population and the value of the objective function. Alternatively, the ranking method may be sought. The solutions in the current generation are ranked in ascending order according to the value of the objective function. Then, based on the ranking, a function is built, the value of which determines the probability of choosing a given solution during the selection. There are two basic variants of these functions-the linear version and the non-linear one. In the paper, we assume that the probability of choosing a given solution p(π i ) to be a parent is based on the linear version of the ranking: where η max defines decrease in probability of the selection as the parent if the ranking of the solutions decreases and η min = 2 − η max , 1 ≤ η max ≤ 2.

Crossover Process
All solutions in the population are processed by the crossover operator. The set of the crossover operators contains a special type of the operators designed to the permutation crossover, such as: PMX, OX, CX. On the basis of the crossover of the two permutations (parents) the two valid permutations (siblings) can be obtained [57]. The first well-known crossover that has been applied in our approach is the PMX operator. It starts with a random choice of two crossover points in the parent permutations (the same in both parents). Genes located in such a part of the permutations are swapped (by mapping) between the parents. Other positions are rewritten if they are not present in the offspring permutations. If the conflict occurs, genes are replaced with the use of a mapping relationship.
While creating new solutions, the order crossover (OX) assumes a randomly selection of two cut points in two parent permutations and preserves the order of genes. The selected part of one parent chromosome between these points is copied to the offspring. The unassigned positions are sequentially supplemented and taken from the other parent in order, starting from the first gene after the second cut point. After reaching the end of the parent permutation, one performs additional assignments from the beginning of this parent until all genes have been considered.
During the CX operator all offspring genes are taken either from the first or second parent. All genes found in the same positions in both parents are assigned to the child's corresponding locations. Starting from the first or the randomly selected location that has not be included in the offspring yet, an element is randomly selected from both parents. Then, additional assignments are made to avoid random assignments. The next unassigned location is processed in the same way until all locations are included.

Mutation Procedure
Each solution in the population is represented by the tuple S ij = {P ij , Q ij }, where Q ij is the qubit representation of the solution while P ij is the observable state of the qubit, a permutation. The indexes i and j define the index of the population (iteration) and the index of solution in the population, respectively. Before application of the mutation operator, the solution has to be moved from the superposition state (Q ij ) to the observable state (P ij ) using the ObservableState procedure (see Algorithm 1).
Step 2. Replace each number d i in this way that the S d takes a permutation form. Return string S d which has a permutation form.
The mutation operator which generates a random permutation in the Hamming distance equals 2 by swapping two randomly selected elements in the permutation. It allows preventing the Q 2 APA algorithm from being trapped into the local optimum. To control exploration properties of our approach, the Q-gate operator using the quantum solution representation is used.
All the solutions generated using the Q-gate operator are improved using the 2-opt local optimization procedure which effectively examines n(n−1) 2 + 1 neighbourhood solutions. The mutation operator changes randomly a binary qubit value. Afterwards, this mutated solution in the qubit form is processed by the Rotation Q-Gate operator. In this paper we propose to control the size of the rotation angle of Q-gate. We assume that the angle ϕ is defined as a variable related to the generation number i (Figure 2). For example, the geometric reduction of the Q-gate angle expressed as ϕ · δ i can be used, where δ < 1. In the experiment, depending on the algorithm settings, the modified or original values from the look-up table are used (Table 1). Below, the code fragments in C# responsible for the quantum mutation and the standard rotation gate (according to

Detailed Q 2 APA Algorithm Flow
Once an initial population of quantum chromosomes is created, these are used to create a population of permutations. It should be mentioned that each solution is evaluated to give a level of its fitness. Upon their selection, the offspring solutions are formed by the multiple operators: crossover, mutation, Q-gate and 2-opt. The qubit state update is performed if the solution has been subject to changes resulting from the operation of the quantum gate operator or for this solution the occurrence of the conditions for the mutation has been met. However, after performing a crossover operation, the state of the qubits of the child solutions is not evaluated. Note that such an assessment (mostly in the early iterations of the algorithm) would cause that the solutions obtained through the crossover could lose the information obtained from the parents' solutions. Q-bit individuals are modified by applying the rotation Q-gate with probability p m . Then, the state of each qubit is checked in the best solution and compared to the state of the corresponding qubit in the solution obtained by the quantum gate. In the next step, the quantum chromosomes (the set Q ) are converted to permutations (the set Π ) by using Algorithm 1 and they are improved using the 2-opt procedure with the probability p LO (see Figure 2). Without the use of a quantum gate, the quantum idea of the algorithm is then manifested only during the creation of the initial population and the mutation.
Taking into account the described procedures, our algorithm's flow is shown in Figure 3, where b denotes the best solution found by the Q 2 APA algorithm during the evaluation process of the population, and b 1 , . . . ., b λ represent solutions for their two forms (the permutation and quantum), It is important to note that, at the beginning, the permutation forms of the solutions are evaluated using the mutation and the crossover operators. These operators do not affect the quantum state of the parents. On the basis of the offspring's permutation, the quantum representation of the solutions is created. When analyzing Figure 3, one can conclude that the solutions in the population are randomly changed (with the predefined probability) using the quantum rotation gate or/and the 2-opt procedure.

Experiments and Results
The aim of the proposed experiments is to test the possibility of using the quantum representation to improve the results obtained by the evolutionary algorithm for the QAP problem. We evaluate the performance of the Q 2 APA algorithm by testing it on the well-established benchmark instances from the QAPLIB, whose size is indicated in the instance name. Therefore, we tested it through a number of experiments on the QAP instances with the known reference solutions. As we know, the QAPLIB contains various instances of the QAPs, which stem from real-life problems (architecture, computer science, etc.) and the instances generated for testing problems with the special properties. The solution quality was taken into account to assess the performance of the algorithm. Therefore, we conducted many runs of the Q 2 APA on the 37 instances of varying complexity. For each test instance, we assume the same setting of parameters through 10 independent runs of the algorithm. For this purpose, we obtained the relative deviation (Dev) of the best found objective value ( f best , the best value of ten independent runs) by our approach from the best known value ( f re f ) reported in the QAPLIB as follows: Various crossover operators, gates and 2-opt probabilities will be discussed with a view to characterizing the results obtained from their application. As we know by choosing different values of parameters, there are different results one can obtain. Therefore, a question is if there is any particular value better than the others. In what follows, we will restrict attention to characterizing the best values of the Q 2 APA parameters resulting from their application.
The algorithm was implemented in C# programming language using Windows 10 operating system. The computer parameters used for calculations are presented in Table 2.

Impact of Different Crossover Operators
The first series of the experiments aimed at determining the best operator in the crossover process among the three operators: PMX, CX, OX (see Section 3.2.2). These crossover operators for creating offspring were tested on two groups of the instances stored in the QAPLIB. It should be noted that these experiments were conducted using other fixed parameters during all the iterations. In the experiments, the stopping criterion was the maximum number of the iterations which equals 1000. We used the mutation rate equalling 0.01, the probability crossover equalling 0.7, the population size equalling 350 individuals, the probability of 2-opt equalling 0.2. We applied the roulette and the ranking method for the population selection. We have found that the Q 2 APA with the PMX operator and the ranking method obtains the best results. Therefore, we recommend the choice of the PMX operator in other instances and the next experiments.

Impact of 2-opt Probability
Furthermore, we investigated what value of the 2-opt' probability was correct. In the tests, we assumed the following fixed parameters: the maximum number of iterations = 10,000, the mutation rate equalling 0.01, the probability crossover (PMX) equalling 0.7, the gate's probability equalling 0.7, the population size equalling 350 individuals. To determine the best value of the probability of the 2-opt procedure we conducted many experiments to assess the performance of the Q 2 APA algorithm. We used the BUR26 problems taken from the QAPLIB library to verify the impact of this parameter on the results of the Q 2 APA algorithm. The relative deviations (Dev) of the found solutions from the reference solutions for the different values of the 2-opt probability (p LO ) are summarized in Table 3. On the basis of these experiments, it should be noted that for instances BUR26, the best probability value is 0.4.

Impact of Gate's Probability
During experiments we were interested in testing several values of the gate's probability and finding the best one. Therefore, only this parameter varies while the others are fixed. In the experiments, each run of the Q 2 APA was terminated after 10,000 iterations. We used the mutation rate equalling 0.01, the probability crossover equalling 0.7, the population size equalling 350 individuals, the probability of the 2-opt equalling 0.4, and the ranking method for the population selection. The results of the Q 2 APA for all the considered instances (over the 10 consecutive runs for each instance), relating to the different values of the gate's probability are presented in Figure 4. One can see that increasing probability of the gate's occurrence (the value of the horizontal axis) can reduce Dev results.   Table 4 shows the selected results for one value of the gate's probability (0.8). The table is organized as follows: the first column contains the instance's name, the second column contains reference solutions, the third column presents the best initial solution. Two next columns f best and f best avr display the best solution and the average solution of the 10 independent runs found by the Q 2 APA. The iterations with the best solution and the average number of the iterations are given in the sixth and seventh columns. T avr defines the average execution time in milliseconds of the 10 runs of the algorithm. The last column contains the information on the relative deviation.
On the basis of the relative deviations of the solutions obtained (Table 4), it should be noted that for the four test instances (from the ESC* group) the Q 2 APA finds the reference solutions. In three cases (ESC32E, ESC32F, ESC32G), the reference solution was found through all the runs of the algorithm in the small numbers of the iterations. Note for the ESC32E and the EC32F that the optimal solutions were found in the first iteration. In the case of instances from the BUR* and LIPA*A groups the solutions are close to the best known solutions. For the analysed instances, the mean value of Dev (Dev av ) equals 15.12%. It leads to the conclusion that the results obtained with these fixed settings of the parameters for all instances are not good enough.

Best Results
In this section, the best results obtained to gain the overview on differences in the performance between the different parameter settings in the Q 2 APA algorithm were presented. These values can be vital to affect the convergence. For example, the experiments in the previous section indicated the influence of the probability of the gate's occurrence on the obtained solutions. Therefore, the different values of this parameter and the crossover probabilities through the experiments were used. All the experiments conducted in the context of the effect of the various crossover probabilities and the probability of the gate's occurrence are summarized in Table 5. Implementation of the variable parameter settings in the Q 2 APA algorithm improves its efficiency, but does not guarantee that the well-known reference solutions will be reached. It should be noted that for the 13 instances we obtained better results (cf. Table 4). For all the analysed instances, the mean value of Dev does not exceed 6.45%.
The selected course of the optimization process for the Q 2 APA algorithm for the BUR26A instance is illustrated in Figure 5. It shows the dependency between the objective function value for the best solution and the iteration number. The algorithm during optimization process improves the objective function value, no doubt.   Figure 6 shows the values of the median and the 5th, 25th, and 75th percentiles for the iterations. One can see a clear drop in all the values in the subsequent iterations. It should be noted that the variability of the results obtained is inevitable, because Q 2 APA is a stochastic algorithm. Figure 7 shows how the probability distribution (the probability mass function PMF) changed during the optimization process. In both cases (I = 100, I = 10,000) the optimization process starts with the normal distribution with the mean value about 5.9 × 10 6 . In the subsequent iterations the maximum of the PMF grows and moves towards the smaller values of the objective function, keeping the population relatively diverse.
The results obtained by the Q 2 APA algorithm are compared with the results obtained by the two other algorithms: the standard genetic algorithm (GA) and the genetic algorithm which cooperates with the simulation annealing algorithm (GASA) [58] for the same set of the QAP problem instances (see Table 5). The results of the Q 2 APA are much worse because the number of iterations executed by the GA and GASA is higher (from two to six times) than the number of iterations executed by the Q 2 APA in our experiments. As we mentioned, we tested the possibility of using the quantum representation in the construction of the approximation algorithms. It seems that the quantum representation can be successfully used in the scenarios where the effective exploration of the search space is required.

Conclusions
This paper proposed the Q 2 APA, the purpose of which was to solve the quadratic assignment problem using the quantum paradigm. We merely present a study about the quality of the obtained solutions with our adaptations. It should be mentioned that many valuable results were obtained with experiments involving various settings of the algorithm control parameters. Beside these, we involved the 2-opt for modification of solutions. It should be mentioned that the experiments were conducted to determine how the particular control parameter values influenced the performance of the implemented algorithm. As we know, a big value of the rotation angle can lead to premature convergence. In contrast, a small value can increase the chance of finding a better solution, but the convergence time increases.
Our experiments show that selecting the parameters' values can influence the results. The results might be better in the case of using their optimal settings, so we plan to take into account methods for parameter control and tunning. The implemented method does not include entropy that provides information regarding the spread of the solutions' values of objective function. Therefore, entropy adapted for use in combinatorial optimization problems including the QAP could improve diversity population, especially at later stage of the algorithm. The future research will be devoted to combining various local search procedures with the described framework. Moreover, one possibility for future work is the performance of GPU implementation for the described algorithm and using a larger number of the QAP instances with bigger size in tests.