Quantum Genetic Algorithm on Multilevel Quantum Systems

We present a new evolutionary algorithm on the basis of quantum computations technology for solving optimization problems. The algorithm is built using many-valued quantum logic concept, which is more prospective from the computing power’s point of view. We compare the suggested algorithm to the traditional quantum genetic algorithm to demonstrate its high effectiveness on the example of test function global optimization problems. The advantages can be observed in the running time, the convergence speed, and the solution precision.The proposed implementation for the algorithm of quantum gate operator has an adaptive nature and does not require a lookup table. The role and the influence mechanism of the quantum disaster operator on the proposed algorithm effectiveness are also analyzed.


Introduction
Quantum genetic algorithm (QGA) is a relatively new evolutionary algorithm, which combines the ideas of the quantum computations with the classical quantum genetic algorithms technology [1,2].The probabilistic mechanism of the quantum computations in conjunction with the evolutionary algorithm provides a global search for the solution with fast convergence and small population size.This algorithm is successfully applied to different science and engineering problems, which require approximate, close to the optimum, solutions after a minimum computation time [3][4][5][6].
The main QGA concepts were proposed by Narayanan and Moore [7].The basic unit of information in the quantum computations is a qubit, a quantum system, which may be in the |0⟩ basis state or the |1⟩ basis state.Quantum nature of the qubit lies in the superposition principle, under which the qubit generally is in a state, which is a linear combination of basis states: with a normalization condition: A measurement can be applied to the quantum bit, as well as to the classical bit, and the outcome of such measurement is a qubit in a single basis state.
An ordered set of  qubits constitutes a quantum chromosome.A state vector of such chromosome is a superposition of 2  basis states of the register | 1 ,  2 , . . .,  N ⟩,  1 ,  2 , . . .,  N = {0, 1}: All information about the system of qubits is determined by the state vector |⟩.The key issue in the QGA is the transformation of the initial state vector |⟩ to a certain new state |  ⟩ using a quantum gate operator.The information about the problem solution lies solely in the final state vector of the system |  ⟩.
Taking into consideration the small size of the population, in order to expand the search area QGA should be additionally complemented with operations, inherent in the classical genetic algorithm, such as quantum mutation operation or disaster operation [2].

Quantum Genetic Algorithm Based on
Qudits (QGA_n) In general case number of states of a quantum system is equal to n, the number of level in the multilevel quantum system.Recently much attention has been devoted to studies of possibility of using of the quantum systems for realization of quantum algorithms [8][9][10].
In contradiction to qubit, qudit is a quantum unit of information, which may be in any of  basis states |0⟩, |1⟩, |2⟩, . . .| − 1⟩ or in any superposition of those.The state of the qudit can be generally represented as follows: with a normalization constraint: Let us use the matrix representation for QGA n implementation: ) Taking into consideration (6), the state of the qudit can be presented in the following way: 2.1.Qudit Encoding.To realize QGA n quantum chromosome is considered as a set of independent qudits.For N=16, it can be represented as follows: q 1 ⟩     q 2 ⟩     q 3 ⟩     q 4 ⟩     q 5 ⟩     q 6 ⟩     q 7 ⟩     q 8 ⟩     q 9 ⟩     q 10 ⟩     q 11 ⟩     q 12 ⟩     q 13 ⟩     q 14 ⟩     q 15 ⟩     q 16 ⟩ (8) The state of the i-th qudit is determined by the amplitudes of probabilities For practical realization of QGA n with the help of classical computer it is convenient to represent the quantum chromosome which is composed by N qudits as shown in Table 1.
The initial state of the qudit holds no information about the problem or its solution, so the easiest way to initialize it is to set all probability state amplitudes    to be equal to one another [1].This means that as a result of the initialization each qudit is in the state: The length of the quantum chromosome  is determined by precision , search area [  ,   ], and number of quantum system basis states : For example, for  = 2, precision  = 10 −6 , and search area [−1, 1], the length of the quantum chromosome has to  if  <  then (7)  ←  (8) end if (9) end for (10) end for Algorithm 1: Qudit state measurement.be at least 21 qubits, for  = 3 -14 qutrits, and for  = 4 only 11 qudits are enough (Figure 1).It should be noted that as the size of the quantum chromosome decreases along with the  value growth, we also observe an increase in the size of the matrix, which is needed to represent a single individual or the whole population (Figure 2).

Observation of Genes.
The solution of the problem is determined by the final state vector |  ⟩ and can be obtained using the quantum measurement.The outcome of such measurement is a qudit in one of the basis states.This is the classical representation of the quantum chromosome in the numeral system of base .
The following pseudocode for the chromosome state measurement can be suggested based on [11] (Algorithm 1).The result of applying the algorithm is the basis state  (0, 1, 2, . . .,  − 1) of the population individuals with probability (  1 ) 2 , (  2 ) 2 , . .., (   ) 2 ( ∈ {1, 2, . . ., }).The algorithm's concept can be illustrated using Table 2.As a result of the measurement each qudit of the chromosome is transformed into its classical representation in the corresponding numeral system, which is later used for calculating the fitness function.

Quantum Rotating Gates.
All the information about the problem and the algorithm for solving it lies in the quantum gate, so its algorithm is the key issue of any quantum genetic algorithm construction.It manipulates the probability amplitudes of the quantum states    , while ensuring the normalization constraint satisfaction.
The operator's conduct of work can be divided into two stages.The increase of the quantum state  probability amplitude, which is selected in accordance with the quantum gate algorithm, takes place during the first stage: Here  is an algorithm parameter, and its value lies in the area [0, 1] and needs to be refined in the result of the previous research.The state  is determined by the value of the classical representation of the best population individual, obtained during the previous iteration of the population evolution.
Expression ( 12) also ensures that    cannot be greater than 1 and implements its adaptive behavior.This is illustrated by Figure 3, which shows the dependency of the value Δ(   ) = (   )  −    .On the second stage, all the other state probability amplitudes need to be adjusted to satisfy the normalization constraint (5).In general, the application of the operator to one of the population individuals can be implemented in way shown in Algorithm 2.
Therefore, each new generation ensures the increase of the probability of generating individuals which are most similar to the best.
The algorithm's concept can be illustrated by the image given below.The vertical lines set the state probability amplitudes  best individual has, for example, a value  on the corresponding position, this is the only amplitude which is increased according to (11).So, only the probability amplitudes    , which correspond to the population best individual on the previous evolution stage, will increase.At the same time, probability amplitudes of the other states will decrease to satisfy the normalization constraint.
It is important that the described logic behind the quantum gate operator allows avoiding the need for the lookup table, which is one of the fundamental disadvantages of QGA.Therefore, quantum gate operator provides efficient local convergence of the algorithm to the optimal value with the smaller number of evaluations.Transition to quantum system of higher dimension leads to short in time transition from one state of quantum chromosome to another during the evolution.For instance, for transition from chromosome state corresponding to classical state representing 7 to classical state representing 8 it is (1) for  ∈ 1, . . .,  do (2) bestamp ←  -th value of the gene of best population individual for  ∈ 0, . . .,  − 1 do (7) if amp ̸ = bestamp then (8) end if (10) end for (11) end for Algorithm 2: Quantum gate operator.
(1) for  ∈ 1, . . .,  do (2) if the chromosome is not the best then (3) if disaster condition then (4) for  ∈ 1, . . .,  do end for (8) end if (9) end if (11) end for Algorithm 3: Quantum disaster.necessary to change the amplitudes of probabilities for 4 qubits: For n = 8 the reorientation of quantum states is going in frame of one qudits and as a result of the superposition principle is very effective: 2.4.Quantum Disaster Operation.If the search space is considerably large, the small size of the population can cause its premature convergence and high probability of falling into one of the local minimums.This issue is especially relevant during the optimization of functions with a complex topology and a big number of local minimums.The easiest mechanism for maintaining the population diversity is the quantum disaster operation [12].It can be summarized as initialization of some of the population individuals, except for the best one, with initial state (10).The operation "virtually" increases the size of the population but influences the local convergence speed of the algorithm, which will be demonstrated later.
In the simplest case, the quantum disaster operation can be implemented by the way shown in Algorithm 3.
Quantum chromosome is considered as a set of independent qudits (entanglement of quantum states is not considered).Namely, the result of the quantum disaster operation is transition of the state of quantum chromosome to the initial state (t=0) in which the probability amplitudes are equal to each other.

Simulation Test
QGA n based on qudits system is implemented using C++ programming language, and the simulations are performed on the Intel Celeron CPU G1840 2.80GHz, 4.0 GB RAM.
The set of functions used for QGA testing in the paper is conventional for the analyzed class of algorithms [12,13].The paper only includes the optimization results of functions, which are considered difficult for the algorithm and allow estimating the influence of the dimension of quantum system n on the algorithm efficiency, which is the main subject of the paper.
If we utilize test functions of smaller number of variables (less than 3), we obtain almost exact results.It does not give the possibility of estimating the influence of the dimension of quantum system on the QGA efficiency (that is the reason for such results not being included in the paper).
A number of numerical optimization problems with a fundamentally different topology in the optimum area were analyzed to illustrate the algorithm design.The following test functions, taken from virtual library of Simulation Experiments in Simon Fraser University, were used.

Trid Function
The function has no local minimums except for the global one at Levy Function where The function has several local minimums and one global minimum at The function is complex and has many local minimums and one global minimum The function is complex and has many periodically located minimums, which are proportional to the single global minimum  5 ( * ) = 0 (30) at  * = (0, 0, . . ., 0) The choice of the listed functions is prompted by the following considerations: (i)  1 is monotonic and has a single global minimum, so it makes it possible to assess the efficiency of the local convergence of the algorithm and the influence of the quantum disaster operation

Optimization and Results
The following simulation parameters were used for QGA n practical implementation: number of variables in the test functions  = 6; size of the population  = 50; number of iterations over time  = 500; precision  = 1 ⋅ 10 −6 .For  = 2 and the standard population size  = 10 the global optimum values are close to the exact solution, and in the context of statistical distribution of the obtained results because of the quantum disaster operation it is not possible to evaluate the search capacity of QGA n.

The Choice of 𝜇
Parameter.The value of parameter  determines the evolution of the quantum system and has a key role in the algorithm.It also determines the balance between the global (quantum observation operation) and local (quantum gate) search for the solution specification.
To choose the optimal  value we need to estimate its influence on the average fitness of the best population individual.The evaluation of the parameters is listed as the average result over 1000 QGA n runs, if not specified otherwise.Its characteristic behavior in dependency of  parameter is presented in Figure 4 for the example of  1 function optimization.It is typical, and the position of the minimum depends on the function topology.It is important that the dimension of quantum system has practically no influence on the optimal  value.
Optimal values of the  parameter, obtained for the test functions, are listed in Table 3.
It can be observed that without the quantum disaster operation the optimal value of  parameter for all the test functions lies in a quite narrow range of values.Taking into account the weak dependency of  V on , value  ≈ 0.015 can be considered completely acceptable for all functions.
In case of applying the quantum disaster operation a single optimal value cannot be offered, and the parameter has to be chosen separately for each of the functions.

4.2.
QGA n Effectiveness Evaluation.The majority of the quantum algorithms use similar primary ideas and approaches, which are based on the qubit representation of the population [14].Therefore the proposed algorithm is compared to the traditional quantum genetic algorithm: it corresponds to the case with the dimension of quantum system  = 2.
The effectiveness evaluation of the proposed algorithm is performed by two main criteria.The first is running time for a standard set of input parameters.For illustrative purposes, we will limit the quantum systems with  = 20 inclusive.There are no principal restrictions for the transition to manyvalued quantum logic with  > 20.The results of such research on the example of  1 function are given in Figures 5 and 6.In general, the average running time is essentially independent of the test function and the existence or absence of the quantum disaster operation and is determined by the size of the search area with all the other parameters remaining unchanged.Here and throughout the probability of the quantum disaster is assumed to be equal to 1 for the whole population except for the best individual.Taking into account the considerable range of the outcomes in different algorithm runs, in this case the fitness of the best individual  V is listed as the average result over 100 QGA n runs.
As can be seen from Figure 7, on the early stages of the evolution, up to the 200-th generation, quantum disaster operation accelerates the evolution of the population to the optimal value.However, on the final stages, it has a negative impact.Simulation studies show that a simple removal of one individual from the evolutionary process through the quantum disaster operation cannot explain the deterioration of the local convergence of the algorithm.For example, population size reduction of one individual, to  = 49, causes a change in the obtained results, which is not bigger than 5-10 percent.The rest 90 percent of the deterioration are caused by the influence of the quantum disaster operation during the whole previous development history of the population in general.
The presence of local minimums significantly changes the overall picture of the dimension of quantum system influence on the search efficiency.This is proven by the results of  2 function optimization results, listed on Figure 8.The positive role of the quantum disaster operation should be acknowledged in this case.Periodical peaks can be observed in the functional dependency.They are most likely caused by "interference" of the periodical typology of the reviewed function and the discreet nature of the dimension of quantum system.This issue is not a subject of this paper and will be studies separately.
Statistical results, including the best result Best, the average result  V , the worst result Worst, and the standard deviation   , retrieved during  3 − 5 test functions optimization, are listed in Tables 4-6.All dates are obtained averaging over 100 QGA n runs.Figures 9-11 illustrate the characteristic dynamics of the evolutionary process of the population over time for functions with a complex topology.
As we consider the presented results, two points can be observed: (i) the chosen maximum time of the evolution  = 500 is not always enough for the population to finish the relaxation to the optimal value; (ii) utilization of the quantum disaster operation in case of a test function with complex topology causes a significant acceleration of the evolutionary process on the early stages of the evolution, approximately within the first 200 iterations over time.

Figure 1 :
Figure 1: Length of the quantum chromosome N as a function of dimension of quantum system n.

Figure 2 :
Figure 2: Influence of the dimension of quantum system n on the size of the matrix, which is required for representing one population individual.

𝑘 1 ,Figure 3 :
Figure 3: Change of the probability amplitude of the quantum state Δ in dependency of    with  = 0.1.

Figure 4 :
Figure 4: Average fitness of the best population individual F avr as a function of  parameter.Quantum disaster operation not applied.

Figure 5 :Figure 6 :
Figure 5: Average running time of the algorithm t avr in dependency of the dimension of quantum system n.

Figure 7
Figure 7 illustrates the convergence speed of QGA n for  1 function with and without the quantum disaster operation.Here and throughout the probability of the quantum disaster is assumed to be equal to 1 for the whole population except for the best individual.Taking into account the considerable range of the outcomes in different algorithm runs, in this case the fitness of the best individual  V is listed as the average result over 100 QGA n runs.As can be seen from Figure7, on the early stages of the evolution, up to the 200-th generation, quantum disaster operation accelerates the evolution of the population to the optimal value.However, on the final stages, it has a negative impact.Simulation studies show that a simple removal of one individual from the evolutionary process through the quantum disaster operation cannot explain the deterioration

Figure 7 :Figure 8 :
Figure 7: Average population evolution over time for function F 1 with n=6.

Figure 9 :
Figure 9: Time-averaged population evolution for function F 3 with n=6.

Figure 10 :
Figure 10: Time-averaged population evolution for function F 4 with n=6.

Figure 11 :
Figure 11: Time-averaged population evolution for function F 5 with n=6.

Table 3 :
Optimal values of the  parameter. 3 ,  4 , and  5 have many local minimums surrounding the single global minimum, so they make it possible to assess the capacity of the algorithm's global search.The differences in the functions topology and the local minimums distribution make it possible to assess the influence of the dimension of quantum system n on the abilities of the population getting out of the local minimums, because the population inevitably falls into the local optimal solution during the evolutionary process.

Table 4 :
Test functions F 3 optimization results.

Table 5 :
Test functions F 4 optimization results.

Table 6 :
Test functions F 5 optimization results.