Implementing Quantum Genetic Algorithms: A Solution Based On Grover's Algorithm
Implementing Quantum Genetic Algorithms: A Solution Based On Grover's Algorithm
Implementing Quantum Genetic Algorithms: A Solution Based On Grover's Algorithm
71
as it is a superposed basis state within the quantum state are already available as superposed, renders the techniques
of the individual register. This creates incentives for imple- used for generating new individuals as useless. Figure 1
menting QGAs; as stated in [6] there is no coherent idea as (b) reflects this situation, by showing a simpler model; this
of how to implement QGAs. is the reason why the algorithm created according to this
model was called ”Reduced Quantum Genetic Algorithm”
1.1 Motivation (RQGA).
qubits are used to represent the chromosome (i.e. individ-
2N −1
ual encoding). The assessment is then applied on all the 1
|ψr i = cx,r |x, r (4)
superposed individuals, therefore generating a fitness regis- P (r) x=0
ter, which consists of a superposition of all the fitness val-
ues. The selection is applied on all the superposed individ- Due to the fact that an individual cannot have more than
uals, available within the quantum chromosome, by making one fitness, it is obvious that, if individual u has a fitness
use of Grover’s algorithm. The fact that all the individuals value v, then cu,y = 0 for all y = v.
72
Generation (usually random)
Generation
(the entire population)
Figure 1: A comparison between the classical evolutionary strategy and the quantum genetic algorithm
approach that is presented in this paper.
The QGA, as described in [23], is presented in the follow- • In quantum computation true random numbers can
ing pseudo code: be generated. It was proven that a GA with a true
random number generator will outperform a pseudo-
Genetic Algorithm Running on a Quantum Com- random solution, which is the only possibility in clas-
puter (QGA) sical computation [22].
1. For i := 1 to m prepare |φindividual
i as superpositions The questions that remain open are:
of individuals and compute the corresponding fitness pair
register |ρfi itness (the outcome will be a state representing a) How would the crossover operator in quantum compu-
a superposition of fitness values). tation be built?
2. Measure all fitness registers. b) How would the fitness function on a quantum com-
3. Repeat puter be implemented?
(a) Selection according to the m measured fitness values. c) How could the correlation be maintained between the
(b) Crossover and mutation are employed in order to pre- individual register (superposed) basis states and the
pare a new population (setting the m individual reg- (superposed) fitness values from the fitness register?
isters).
(c) For the new population, the corresponding fitness val-
Although the advantages appear to be substantial, one
ues will be computed and then stored in the fitness can easily argue that the power of quantum computation is
registers. not sufficiently used by this approach. However, some of the
(d) Measure all fitness registers. open questions have been addressed in reference [6]. Giraldi
et al. developed a mathematical formalism in order to avoid
Until the condition for termination is satisfied. misinterpretations regarding question c). The question b)
Reference [6] provides analysis and critique for the above is also addressed by defining quantum genetic operators.
presented algorithm. The identified advantages of using The proposed formalism establishes the necessary correla-
QGAs over the classical GAs, which are drawn from the tion between the fitness and the individual registers, which
quantum computational features, are: – it is argued – cannot be accomplished with the QGA con-
struction provided in [23]. Question a) still remains open
• Due to the superposition of individuals (i.e. basis according to reference [6].
states) that is stored in the individual register, the
building block [6] could be crossed not by just one in- 2.2 Mathematical Formalism
dividual, but by a superposition of exponentially many The QGA formalism uses m quantum register pairs (N -
individuals. Thus, the selection of a new population qubit individual register and M -qubit fitness register, as pre-
is made with the contribution of many building blocks sented in Section 2.1). Also, in order to achieve proper corre-
for subsequent populations. lation between the individual and its fitness value, the fitness
73
function must be chosen so that it is a ”quantum function” 3. THE SOLUTION: A NEW APPROACH
as defined by [17], hence a pseudo-classical operator with An observation concerning the individual-fitness quantum
a corresponding Boolean function: f : {0, 1}N → {0, 1}M , register pair is that all the possible valid individuals (n) can
Uf : |x ⊗ |0 → |x ⊗ |f (x) if |x is a basis state. be encoded in the same quantum state superposition, which
When acting on a superposition, the unitary operator cor- has a total of 2N possible basis states (n ≤ 2N ). If a method
responding to function f will dictate the following mapping: of measuring the highest fitness value from the fitness reg-
ister can be figured out, then the measurement of the indi-
2N −1 2N −1 2N −1
vidual register will yield that corresponding individual (or
Uf : ax |x⊗|0 → ax |x⊗|f (x) = ax |x, f (x) one of them, if several have the same highest fitness value).
x=0 x=0 x=0
Approaching the QGAs in this manner renders some ge-
(5) netic operators as no longer necessary, as long as finding the
An important aspect regarding the pseudo-classical Boolean maximum has an efficient solution. This effectively leads to
functions is that they are universal (i.e. any computational solving problem β.
function can be represented in such a form), and are eas- Because the individual is encoded on N qubits, we have a
ily implemented as gate networks [2]. In fact, due to their total of 2N basis states which can participate in the super-
universality, Boolean functions form the backbone of the position. It is possible that not all of these basis states will
classical computation’s circuit model. encode valid individuals (problem α); the proposed method
The QGA algorithm, after adopting Giraldi’s formalism relies on defining some constrains regarding the fitness func-
can be rewritten as in the pseudo-code from below. tion and the fitness value format, without losing the gener-
ality of the solution. We will consider the fitness function as
a Boolean pseudo-classical unitary operator Uf (character-
ized by f : {0, 1}N → {0, 1}M ) which can be also applied to
Genetic Algorithm Running on a Quantum Com-
puter (QGA) with proper formalism non-valid individuals. The fitness value space {0, 1}M can
be split, so that a distinct subspace is allocated to the fit-
{0, 1}N → {0, 1}M ). For i := 1 to m do |ψ2i = Uff it |ψ1i = from efficient quantum algorithms for finding the maximum
√1 n−1 [1][5]. Finding the best fitness value is equivalent to mark-
u=0 |uind
i ⊗ |ff it (u)fi it .
n ing the highest classical state that is superposed in the fit-
3. For i := 1 to m measure the fitness registers, obtaining the ness register state or, in other words, the highest basis state
by measurement): |ψ3i = √1
post-measurement states (we suppose that |yi is obtained
ind
v∈{0,1,...,n−1} |vi ⊗
with non-zero amplitude. Basically, the proposed method-
ology relies on reducing the highest fitness value problem to
ki
Grover’s algorithm. In order to do so, special oracle and
|yfi it with ki values in {0, . . . , n − 1} to satisfy ff it (v) = y.
fitness value format are defined. Section 3.1 presents the
4. Repeat quantum algorithm for finding the maximum [1], Section 3.2
a. Selection according to the m measured fitness values presents details for oracle implementation and fitness regis-
|yi . ter structure, while Section 3.1.2 provides our adaptation of
the algorithm in order to find the best value in the fitness
b. Crossover and mutation are employed in order to pre-
pare a new population (setting the m individual reg-
register.
isters |uind
i ). 3.1 Computing the Maximum
c. For the new population, the corresponding fitness val- This subsection analyzes the available quantum method-
ues will be computed and then stored in the fitness
ologies for finding the maximum, and provides a modified
registers(|ff it (u)fi it ).
version of the original algorithm [1][5], in order to meet the
d. Measure all fitness registers specific QGA demands.
Until the condition for termination is satisfied.
3.1.1 The Initial Algorithm
Besides the necessary formalism, reference [6] also pro- The quantum algorithms for minimum/maximum finding
vides some insight regarding the implementation of the ge- [1][5] are inspired from the classical ”bubble sort” algorithm,
√
netic operators in the quantum computational environment. but their complexity in quantum version [3] is O ( n).
These considerations lead towards two main implementation Such an algorithm takes an unsorted table of m elements
problems: as input, in order to return the index of the maximum value
element. By adopting the formalism from [1], we have a pool
α) the number of all valid individuals is not always a P [i] of m elements (i = 0.. (m − 1)) which will be processed
power of 2, which is the total number of basis states; in order to obtain the index k of the maximum element
(P [k]). In order to meet our demands, Grover’s algorithm
β) crossover implementation is a difficult task, and re- uses a specially designed oracle that ”marks” all the basis
quires a thorough investigation, including quantum com- states that are greater than some given value P [j] (within
putation architectural aspects [18]. the pool):
74
Oj (i) =
1 if P [i] > P [j]
(6)
3. For j := 0 to s − 1 set the value corresponding to the index
|ψ2j = P |ψ1j = √1m m−1 index
i=0 |ij ⊗ |P [i]value
j ;
0 otherwise 4. For j := 0 to s − 1 loop
We notice that the oracle works with the pool indices as (a) Apply the oracle on the value register Õmax (P [i]).
parameters. Also, there is no indication as to how the pool Therefore, if |P [i]value
j > max then the correspond-
is represented. The oracle just ”knows” the answer to the ing basis states are marked;
following question: ”is P [i] bigger than P [j] ?” Therefore, (b) Use Grover’s algorithm for finding marked states in
the resulting algorithm will have the form of the following the value register after applying the oracle. As pointed
pseudo code: out in reference [16], we find one of the marked basis
states |p = |P [i]value
j , with P [i] − max > 0;
Quantum Algorithm for finding the maximum from (c) max := p;
an unsorted table of m elements
5. Having the highest value in the |•value
s−1 register, we mea-
1. Initialize k := random number; 0 ≤ k ≤ m − 1 as the sure the |•index
s−1 register in order to obtain the correspond-
2. Repeat O
√
starting index of this search;
ing individual (or one of the corresponding individuals).
m times
a. Set two quantum registers as |ψ = √1m m−1
3.2 The Oracle
i=0 |i|k;
the first register is a superposition of all indices; The oracle implementation must be made so that the
problems mentioned in reference [6], namely α) and β) from
b. Use Grover’s algorithm for finding marked states from
the first register (i.e. those which make Ok (i) = 1); Subsection 2.2, are dealt with. This subsection presents the
envisaged solutions.
c. Measure the first register. The outcome will be one of
the basis states which are indices for values > P [k].
Let the measurement result be x. Make k := x;
3.2.1 Problem α: The Solution
In order to deal with problem α), we have to adopt a con-
3. Return k as result. It is the index of the maximum.
straint, which does not restrict the generality of the fitness
The complexity analysis performed in [1] reveals the fact functions. We consider the ordinary fitness function ff it
that√this algorithm will find the index of the maximum in (which applies only on the valid individuals) ff it : {0, 1}N →
13.6 m steps, with an error rate smaller than 12 . {0, 1}M , which is Boolean (and therefore universal), with a
straightforward correspondence to the unitary representa-
3.1.2 The Modified Algorithm
tion Uff it [16][17]. The modified fitness function will accept
In the initial algorithm, a quantum form for the pool of invalid individuals (see Appendix A for details) as argu-
elements is not necessary. However, for the specific QGA- ment, and the returned values will belong to distinct areas,
related purposes, we need to maintain the correlation be- corresponding to valid or invalid individuals. This can be
tween the individual register (corresponding to the indices) achieved by defining ffmodit : {0, 1}
N
→ {0, 1}M +1 as:
and the fitness register (corresponding to the fitness values).
Therefore, a maximum finding algorithm – that is usable in
the desired, genetic algorithm context – must have a quan- ffmod
0 × {0, 1}Mif x is a non-valid individual
it (x) ∈
tum (i.e. basis state superposition) state for representing 1 × {0, 1}Mif x is a valid individual
the values, which in turn has to be correlated appropriately (8)
with the quantum register representing the indices. The fitness values are encoded by the qubits in a modified
This means that the oracle will operate on the values reg- fitness register, which has a (M + 1)-qubit size. The valid
ister, where its input data is available. Hence, the oracle individuals always produce fitness values with the most sig-
expression from Equation 6 will be modified accordingly: nificant qubit being ’1’; a ’0’ value for the most significant
qubit in the fitness register indicates the correspondence to
1 if x > y a non-valid individual, as presented in Figure 2 (where the
Õy (x) = (7) quantum state matrix representation is used).
0 otherwise
In Equation 7, x, y ∈ N and are encoded by the super- 3.2.2 Solving Problem β : Building the Appropriate
posed basis states√from the values register. Also, because a Oracle
number of s ∈ O ( m) steps have to be run in order to com- Our approach avoids solving problem β directly. Instead,
plete the algorithm, it is required that s index-value quan- it concerns the definition of an appropriate (i.e. application
tum register pairs be prepared. Each register pair, except specific) oracle, starting from Equation 7 and the algorithm
the last one used, generates a partial maximum search solu- from Subsection 3.1.2.
tion. The modified quantum maximum finding algorithm is We propose a solution that uses two’s complement number
presented in the following pseudocode: representation [19] for marking the states that have a value
greater than a given l ∈ N, l > 0. As a consequence, the
Quantum Algorithm for finding the maximum from fitness register will have the form from Figure 3.
an unsorted table of m elements, which is repre- The oracle processes all the fitness register qubits except
sented as a quantum state the most significant one (v), which indicates if the value rep-
1. Initialize k := random integer with 0 ≤ k ≤ m − 1; max := resented by the other qubits belongs to a valid individual or
P [k] ; not. All the value qubits (fM . . . f0 ) from the fitness register
2. For j := 0 to s − 1 set the pair registers as
|ψ1j = √1m m−1 index
i=0 |ij ⊗ |0value
j ;
encode two’s complement positive integers as fitness values.
The oracle adds − (l + 1) to the fitness register, therefore the
75
00...00 x 00...00
00...01
x
x invalid
area
x
x - invalid individual
amplitude
01...10
01...11
10...00
X - valid individual
amplitude
x 10...01
x valid
x
area
11...10
11...11 x Uf
11...11
Figure 2: The basics of fitness function construction: when it is applied to valid individuals it produces a
value in the valid area (upper half: |10 . . . 00 . . . |11 . . . 11) of the fitness register, whereas when applied to
invalid individuals, the corresponding values in the fitness register will always be in the invalid area (lower
half: |00 . . . 00 . . . |01 . . . 11).
basis states (from the state output by the quantum adder (due to the complexity analysis provided in [1]) pair registers
[30]) greater than l will always have f M = 0 (see the oracle (individual-fitness), where the individual register is on N
implementation from Figure 4.) qubits, and the fitness register on M + 2 qubits. Also, it can
For the solution given in Figure 4 we used 2 negation be said that m ”quantum selection steps” are required by
gates (denoted with ’x’) and one XOR gate [2] [2][16], in this algorithm.
order to change the phase of the corresponding superposed
basis states. The architectures for the quantum arithmetic
circuits, the adder/subtractor for our particular case, are
Reduced Quantum Genetic Algorithm
presented in references [7] and [30]. After marking the cor-
responding basis states (by shifting their amplitudes), their
value is restored by adding l + 1. Only the qubits containing |ψ1i = √1
1. For i := 0 to m − 1 set the pair registers as
2N −1
u=0 |uind
i ⊗ |0fi it ;
2N
the result of the arithmetic function (f 0 . . . f M ) are used 2. For i := 0 to m − 1 compute the unitary operation corre-
by the Grover iteration circuit [8][16] in order to find one of
the marked basis states.
sponding to fitness computation
|ψ2i = Uff it |ψ1i = √1
2N −1
|uind
i ⊗ |ff it (u)fi it ;
The Grover iterations that are actually applied to the 2N u=0
f M . . . f 0 register comply with the Grover algorithm ver- 3. max := randominteger, so that 2M +1 ≤ max ≤ 2M +2 −1;
sion defined by reference [4], in order to find one of the
marked solutions, without any a priori knowledge about the
4. For i := 0 to m − 1 loop
(a) Apply the oracle Õmax ff it (u) . Therefore, if
number of solutions. |ff it (u)fi it > max then the corresponding |ff it (u)fi it
Although the oracle uses two’s complement addition (which basis states are marked;
means that we will have to change the fitness values in (b) Use Grover iterations for finding marked states in the
the superposition), the correlation between the individual fitness register after applying the oracle. We find one
and the fitness registers is not destroyed, because the ad- of the marked basis states |p = |ff it (u)fi it , with
dition is a pseudo-classical permutation function [17][30]. ff it (u) max ≥ 0;
The Grover iteration will find as a marked basis state |p = (c) max := p;
|f M . . . f 0 , with p ∈ N, f M , . . . , f 0 ∈ {0, 1} which is
given by |p = −|q for |q = |fM . . . f0 , with fM , . . . , f0 ∈ 5. Having the highest fitness value in the |•fm−1
it
register, we
{0, 1} = B. measure the |•indm−1 register in order to obtain the corre-
The algorithm listed below is inspired from the quantum sponding individual (or one of the corresponding individu-
maximum algorithm from Section 3.1. The initial max value als, if there is more than one solution).
must obey the 2M +1 ≤ max ≤ 2M +2 −1 requirement, so that The measurement of the individual corresponding to the
the search for the highest fitness value will take place only √ best fitness value is possible due to the fact that the corre-
in the valid fitness area. We have a number of m ∈ O ( n) lation with the first (individual) register was not destroyed
76
valid qubit
v fM fM-1 fM-2 f0
fitness value qubits (two's complement)
Figure 3: The format of the fitness register, for the oracle implementation based on a two’s complement
approach.
l+1
o0 o0
oM oM
Quantum Quantum
Two's f '0 Two's
f0 f ''0
Complement Complement Used by
f 'M-1
fM-1 Subtractor Adder f ''M-1 Grover's
iteration
f 'M
fM x x f ''M circuit
v v
fitness register
0
Oracle
oracle workspace
Figure 4: Oracle implementation for a fitness register having the structure from Figure 3.
77
(only controlled not and Hadamard gates were used [16][17]). ficient if the maximum finding procedure can be refined to a
Grover’s algorithm, interpreted as prescribed by reference logarithmic complexity or replaced by one of Hogg’s search
[4], is a method of augmenting the amplitude of oracle marked algorithms. This consequence has the potential of broaden-
basis states, and it works even if the number of such states ing the area of computational problems where the quantum
is not known in advance. solutions outperform the classical ones, and can also act as
counterbalance to the rising skepticism with regard to the ef-
3.2.3 Complexity Assessment fectiveness of Grover’s search applications [31]. At the same
The fact that the complexity√of the original quantum max- time, implementing RQGAs creates incentives for strength-
imum finding algorithm is O ( n) Grover iterations [1] and ening the connection between classical evolvable hardware
our proposed algorithm is an adaptation that does not in- and quantum programmable gate arrays [21], with potential
crease the number of steps, may not be enough to achieve results in adaptive system design and fault tolerance [29].
an efficient algorithm design. The search space for the mod-
ified version of maximum finding has a n = 2N size, and
therefore a logarithmic search mechanism must be refined. 5. REFERENCES
The solution can be a search based on Hogg’s algorithms [1] A. Ahuja and S. Kapoor. A quantum algorithm for
[11] or a better (logarithmic) version of the maximum find- finding the maximum. ArXiv:quant-ph/9911082, 1999.
ing procedure. The drawback concerning the usage of Hogg’s [2] A. Barenco, C. H. Bennett, R. Cleve, D. P. Vincenzo,
algorithms is that we do not have reliable complexity assess- N. Margolus, P. Shor, T. Sleator, J. Smolin, and
ments even if it is claimed that these algorithms are efficient H. Weinfurter. Elementary gates for quantum
[12]. computation. Phys. Rev., A(52):3457–3467, 1995.
However, in our approach, as well as for the quantum max- [3] E. Bernstein and U. Vazirani. Quantum complexity
imum finding algorithm, the initial state (that is processed theory. SIAM J. Computing, 26(5):141173, 1997.
with Grover iterations) is an equally weighted superposition,
[4] M. Boyer, G. Brassard, P. Hoyer, and A. Tapp. Tight
therefore none of them will require extra Grover iteration
bounds on quantum searching. Fortsch. Phys - Prog.
steps in order to properly augment their amplitude.
Phys., 46(4-5):493–505, 1998.
[5] C. Durr and P. Hoyer. A quantum algorithm for
4. CONCLUSIONS finding the minimum. ArXiv:quant-ph/9607014, 1996.
This paper has described a new methodology for running [6] G. Giraldi, R. Portugal, and R. Thess. Genetic
Genetic Algorithms on a Quantum Computer, called Re- algorithms and quantum computation.
duced Quantum Genetic Algorithm or RQGA. This method ArXiv:cs.NE/0403003, 2004.
takes advantage of the quantum computation features, so [7] P. Gossett. Quantum carry-save arithmetic.
that all the possible chromosome binary representations can quant-ph/9808061, 1998.
be encoded in just one individual quantum register. This [8] L. Grover. Quantum mechanics helps in searching for
register is correlated with its pair (fitness) register, which a needle in a haystack. Phys. Rev. Lett., 79:325–328,
contains a superposition of all corresponding fitness val- 1997.
ues. Due to quantum mechanical properties, measuring the [9] K.-H. Han and J.-H. Kim. Genetic quantum algorithm
highest fitness value in the fitness register leads to a post- and its application to combinatorial optimization
measurement state of the corresponding individual register
problem. In Proc. of the 2000 Congress on
that contains superposed basis state(s) encoding the indi-
Evolutionary Computation.
vidual(s) with the highest fitness. citeseer.nj.nec.com/han00genetic.html, 2000.
Therefore, the initial problem (See section 2.1) is reduced
[10] K.-H. Han and J.-H. Kim. Quantum-inspired
to finding the best fitness value, without destroying the
evolutionary algorithm for a class of combinatorial
individual-fitness register correlation. This objective is met
optimization. IEEE Transactions on Evolutionary
by adapting an existing quantum algorithm for finding the
Computation, 6(6):580–593, 2002.
maximum [1][5]. Without loosing the generality of the so-
lution, the adaptation requires that a specific structure be [11] T. Hogg. Highly structured searches with quantum
adopted for the fitness register, and a special oracle be de- computers. Phys. Rev. Lett., 80:2473–2476, 1998.
fined by employing two’s complement integer representa- [12] A. Leier and W. Banzhaf. Evolving hogg’s quantum
tion. As a result, the problem of finding the highest fitness algorithm using linear-tree gp. In Proc. Genetic and
value can be solved by Grover’s algorithm without employ- Evolutionary Computation Conference (GECCO),
ing variation genetic operators. Therefore, it can be con- pages 390–400, 2003.
cluded that the search strategy itself is different for RQGAs [13] M. Lukac, M. Perkowski, H. Goi, M. Pivtoraiko, H.-Y.
in comparison with the classical GAs: the special Oracle and Chung, K. Chung, H. Jeech, K. Byung-Guk, and
the Grover iterations perform successive quantum selection K. Yong-Duk. Evolutionary approach to quantum and
steps. However, with all the genetic interpretation, the con- reversible circuits synthesis. Artificial Intelligence
clusion is that in quantum computation the original genetic Review, 20(3-4):361–417, 2003.
search strategy becomes unnecessary. [14] D. Mange, M. Sipper, A. Stauffer, and G. Tempesti.
By using the complexity analysis from [1](performed for Toward robust integrated circuits: The embryonics
the quantum maximum finding algorithm), and by noticing approach. Proc. IEEE, 88(4):516–541, 2000.
the fact that our algorithm is built around a modified ver- [15] A. Narayanan and M. Moore. Quantum-inspired
sion of maximum finding (without changing the number of genetic algorithms. In Proc. International Conference
required Grover iterations), we concluded that the Reduced on Evolutionary Computation (ICEC-96), pages
Quantum Genetic Algorithms have the potential of being ef- 61–66. IEEE, 1996.
78
[16] M. A. Nielsen and I. L. Chuang. Quantum APPENDIX
Computation and Quantum Information. Cambridge
University Press, Cambridge, 2000. A. RQGA EXAMPLE
[17] B. Omer. Quantum programming in QCL. Technical In this section we will examine an example of how the
Report, Institute of Information Systems, Technical genetic algorithms will run according to the algorithm de-
University of Vienna, Vienna, 2000. scribed in Section 3.2.2 (Reduced Quantum Genetic Algo-
[18] M. Oskin, F. Chong, and I. Chuang. A practical rithm). Therefore we will take into consideration a typical
architecture for reliable quantum computers. IEEE problem for the genetic approach.
Computer, 35(1):79–87, 2002.
Problem: A person has a backpack with a maximum ca-
[19] B. Parhami. Computer Arithmetic. Algorithms and
pacity of 10 kilograms. There are 4 items with the following
Hardware Designs. Oxford University Press, Oxford,
characteristics: item I1 having 7 kg and a value of 40 $, item
2000.
I2 (4 kg, 100 $), item I3 (2 kg, 50 $), and item I4 (3 kg, 30
[20] L. Prodan, M. Udrescu, and M. Vlăduţiu. $). Which items would this person load in his backpack so
Self-repairing embryonic memory arrays. In Proc. that in order to maximize their overall value?
IEEE NASA/DoD Conference on Evolvable Hardware,
Seattle, pages 130–137, 2004. Solution: The classical genetic approach will have as chro-
[21] L. Prodan, M. Udrescu, and M. Vlăduţiu. mosome a 4-bit code, where each ’1’ bit means that the cor-
Survivability of embryonic memories: Analysis and responding item is present in the backpack. For instance,
design principles. In Proc. IEEE NASA/DoD a 1001 code indicates that the backpack contains items I1
Conference on Evolvable Hardware (EH’05), pages and I4 . In the quantum version, the chromosome encoding
280–289, 2005. will have all the 4-qubit classical values (see Table 1) as su-
[22] B. Rylander, T. Soule, and J. Foster. Computational perposed basis states, which represent valid and invalid (i.e.
complexity, genetic programming, and implications. In the items will add up to more than 10 kg) individuals.
Proc. 4th EuroGP, pages 348–360, 2001.
[23] B. Rylander, T. Soule, J. Foster, and J. Alves-Foss. |ψ1i = 1 15
|uind
⊗ |0fi it =
4 u=0
i
Quantum evolutionary programming. In Proceedings |0000 + |0001
of the Genetic and Evolutionary Computation
+|0010 + |0011
Conference (GECCO-2001), pages 1005–1011, 2001. +|0100 + |0101
[24] P. W. Shor. Algorithms for quantum computation: +|0110 + |0111 (9)
1
Discrete logarithms and factoring. In Proc. 35th = ⊗ |0000000000
+|1000 + |1001
4
Symposium on Foundations of Computer Science, +|1010 + |1011
pages 124–134, 1994. +|1100 + |1101
[25] L. Spector. Automatic Quantum Computer +|1110 + |1111
Programming: A Genetic Programming Approach.
Kluwer Academic Publishers, Boston, 2004.
[26] L. Spector, H. Barnum, and H. Bernstein. Genetic I1 I2 I3 I4 Value [ $ ] mass [kg] Validity
programming for quantum computers. In Genetic 0 0 0 0 0 0 valid
Programming 1998: Proceedings of the Third Annual 0 0 0 1 30 3 valid
Conference, Madison, Wisconsin, pages 365–373, 1998. 0 0 1 0 50 2 valid
[27] L. Spector, H. Barnum, H. Bernstein, and N. Swamy. 0 0 1 1 80 5 valid
Quantum computing applications of genetic 0 1 0 0 100 4 valid
programming. Advances in Genetic Programming, 0 1 0 1 130 7 valid
3(7):135–160, 1998. 0 1 1 0 150 6 valid
[28] L. Spector, H. Barnum, H. Bernstein, and N. Swamy. 0 1 1 1 180 9 valid
Finding a better-than-classical quantum and/or 1 0 0 0 40 7 valid
algorithm using genetic programming. In Proceedings 1 0 0 1 70 10 valid
of 1999 Congress of Evolutionary Computation, 1 0 1 0 90 9 valid
Piscataway, NJ, pages 2239–2246. IEEE, 1999. 1 0 1 1 120 12 invalid
[29] M. Udrescu, L. Prodan, and M. Vlăduţiu. Improving 1 1 0 0 140 11 invalid
quantum circuit dependability with reconfigurable 1 1 0 1 170 14 invalid
quantum gate arrays. In Proceedings 2nd ACM 1 1 1 0 190 13 invalid
Conference on Computing Frontiers, pages 133–144.
1 1 1 1 220 16 invalid
Ischia, Italy, May 2005.
[30] V. Vedral, A. Barenco, and A. Ekert. uantum
networks for elementary arithmetic operations. Table 1: All the chromosome binary combinations,
quant-ph/9511018, 1996. valid and invalid, with the corresponding fitness val-
[31] G. Viamontes, I. Markov, and J. P. Hayes. Is quantum ues.
search practical? In International Workshop on Logic
and Synthesis, pages 478–485, 2004. The fitness function that we will apply, would be an arith-
metic function according to the requirements formulated in
Section 2.2. The fitness formula, given in Equation 10,
contains two variables, the chromosome value val and the
79
chromosome mass m; also two constants are used, the total
added value of all items (valt = 220) and the maximum al-
|0000 ⊗ |1110101011
lowed package mass (mmax = 10). For any chromosome x,
+|0001 ⊗ |1111001001
the fitness function is given by:
+|0010 ⊗ |1111011101
|φind
i means that we use the Uff it basis state permutation, +|1111 ⊗ |1110101010
obtaining the state presented in Equation 11. (12)
|0000 ⊗ |1000000000
+|0001 ⊗ |1000011110
+|0010 ⊗ |1000110010
+|0011 ⊗ |1001010000
+|1001 ⊗ |1001000110
−|1010 ⊗ |1001011010
+|0100 ⊗ |1001100100
+|0110 ⊗ |1010010110
1 +|0111 ⊗ |1010110100 +|1101 ⊗ |0111001101
|ψ2i = |φind
⊗ |ρfi it = +|1110 ⊗ |0111100001
i
4 +|1000 ⊗ |1000101000
+|1001 ⊗ |1001000110 +|1111 ⊗ |0111111111
+|1010 ⊗ |1001011010
(13)
+|1101 ⊗ |0111001101
+|1110 ⊗ |0111100001
+|1111 ⊗ |0111111111
presented in Equation 14, where the amplitudes a0 , a1 , a2 , a3 ,
a8 , a9 , a11 , a12 , . . . a15 ≈ 0 and |a4 |2 + |a5 |2 + |a6 |2 + |a7 |2 +
|a10 |2 ≈ 1.
(11)
The fitness values of the invalid individuals are negative
numbers (all least significant 9 bits of the fitness values rep- a0 |0000 ⊗ |1000000000
+a1 |0001 ⊗ |1000011110
resent 2’s complement numbers), with the most significant
+a2 |0010 ⊗ |1000110010
bit being dedicated to indicating the validity of the corre- +a3 |0011 ⊗ |1001010000
sponding chromosome (0 means invalid, 1 indicates a valid +a4 |0100 ⊗ |1001100100
individual), see Section 3.2.2 for details.
+a5 |0101 ⊗ |1010000010
The next step of the Reduced Quantum Genetic Algo- +a6 |0110 ⊗ |1010010110
rithm is to apply the oracle over the first pair of individual- +a7 |0111 ⊗ |1010110100
|ψ50 = |φind
fitness registers. According to the Reduced Quantum Ge- ⊗ |ρf0 it =
0 +a8 |1000 ⊗ |1000101000
netic Algorithm, we have to get a random value for variable +a9 |1001 ⊗ |1001000110
max. Suppose that the yielded value for max is 84, then the
+a10 |1010 ⊗ |1001011010
state of the |ψ0 register at this point is given in Equation +a11 |1011 ⊗ |0110011011
12 and 13: |ψ30 is the pair registers state after applying the +a12 |1100 ⊗ |0110101111
subtractor and phase-shift part of the oracle, while |ψ40 is
the state obtained after applying the entire oracle, includ- +a13 |1101 ⊗ |0111001101
+a14 |1110 ⊗ |0111100001
+a15 |1111 ⊗ |0111111111
ing the adder part (see Figure 4 from Section 3.2.2). One
observation linked to the details presented in Section 3.2.2 (14)
is that the phase shift (i.e. amplitude ai becomes −ai ) is Therefore, if the fitness register of |ψ0 is measured after
triggered by a ’0’ value of the 2nd bit from the left in the applying Grover iterations, then we will get (with a high
fitness register. probability) one of the following basis states (of the right-
80
most 10 qubits of |ψ50 ): |1001100100, |1010000010,
|1010010110, |1010110100. Suppose that |1010000010 (+
a0 |0000 ⊗ |1000000000
130 if we convert this value in decimal) is measured. In +a1 |0001 ⊗ |1000011110
the individual register we will have |0101; also the new +a2 |0010 ⊗ |1000110010
max := 130.
+a3 |0011 ⊗ |1001010000
The next algorithm iteration will involve the next individual- +a4 |0100 ⊗ |1001100100
fitness pair registers (|ψ1 = |ρind
1 ⊗|φ1 ), by subsequently
f it
+a5 |0101 ⊗ |1010000010
setting states |ψ1 (oracle – subtractor and phase-shift), |ψ41
3
+a6 |0110 ⊗ |1010010110
(oracle – adder), and |ψ51 (Grover iterations): +a7 |0111 ⊗ |1010110100
|ψ51 = |φind
⊗ |ρf1 it =
1 +a8 |1000 ⊗ |1000101000
+a9 |1001 ⊗ |1001000110
+a10 |1010 ⊗ |1001011010
+a11 |1011 ⊗ |0110011011
+a12 |1100 ⊗ |0110101111
+a13 |1101 ⊗ |0111001101
+a14 |1110 ⊗ |0111100001
+a15 |1111 ⊗ |0111111111
(17)
After applying the Grover algorithm over the fitness regis-
|0000 ⊗ |1101111101 ter (rightmost 10 qubits) of |φf1 it from |ψ41 , we will get state
+|0001 ⊗ |1110011011 |ψ51 , as presented in Equation 17, where the amplitudes
+|0010 ⊗ |1110101111 a0 , a1 , a2 , a3 , a4 , a5 , a8 , a9 , . . . , a15 ≈ 0 and |a6 |2 + |a7 |2 ≈ 1.
+|0011 ⊗ |1111001101
Therefore, if we measure the fitness register of |ψ51 after
+|0100 ⊗ |1111100001 applying Grover iterations, then we will measure (with a
+|0101 ⊗ |1111111111
high probability) one of the following basis states (of the
−|0110 ⊗ |1000010011 rightmost 10 qubits of |ψ51 ): |1010010110, |1010110100.
1 −|0111 ⊗ |1000110001 Suppose that we measure |1010110100 (+ 180 in decimal).
|ψ31 = |φind ⊗ |ρf1 it =
1
4 +|1000 ⊗ |1110100101 In the individual register we will have |0111, which is also
+|1001 ⊗ |1111000011
+|1010 ⊗ |1111010111 the solution for our problem.
+|1111 ⊗ |0101111100
(15)
|0000 ⊗ |1000000000
+|0001 ⊗ |1000011110
+|0010 ⊗ |1000110010
+|0011 ⊗ |1001010000
+|0100 ⊗ |1001100100
+|0101 ⊗ |1010000010
−|0110 ⊗ |1010010110
1 −|0111 ⊗ |1010110100
|ψ41 = |φind
⊗ |ρf1 it =
1
4 +|1000 ⊗ |1000101000
+|1001 ⊗ |1001000110
+|1010 ⊗ |1001011010
+|1011 ⊗ |0110011011
+|1100 ⊗ |0110101111
+|1101 ⊗ |0111001101
+|1110 ⊗ |0111100001
+|1111 ⊗ |0111111111
(16)
81