k Largest Elements via Adiabatic Quantum Computing

51 downloads 0 Views 6MB Size Report
Adiabatic Quantum Computing. Christian Bauckhage and Eduardo Brito. Fraunhofer Center for Machine Learning, Germany. Fraunhofer IAIS, St. Augustin, ...
k Largest Elements via Adiabatic Quantum Computing Christian Bauckhage and Eduardo Brito Fraunhofer Center for Machine Learning, Germany Fraunhofer IAIS, St. Augustin, Germany B-IT, University of Bonn, Bonn, Germany

Abstract—We devise an Ising model for the problem of finding the k largest elements of a set of real numbers. Using adiabatic quantum computing, the effort to solve this model is independent of the choice of k. In other words, adiabatic quantum computing can find the k > 1 largest elements in the same time it needs to find the k = 1 largest element.

The set {s1 , s2 , . . . , sn } thus forms a proper subset of the set {−1, +1}n of all the 2n bipolar vectors in n dimensions. A crucial observation at this point is that we can characterize the elements of this subset algebraically; they all obey

I. I NTRODUCTION

This property then allows us to rewrite (7) as a quadratically constrained linear optimization problem

Previously [1], we were concerned with adiabatic quantum computing solutions for finding a maximum element of a set or vector of real numbers. We devised an appropriate Ising model whose minimum energy states can be determined by an adiabatic quantum computer [2]–[4] and reasoned as follows. A. Previous Result e|i x ≥ e|j x

(1)

where ei and ej are the i-th and j-th standard basis vector of Rn . Since multiplication by a positive constant and addition of a (positive or negative) constant leave this inequality intact, we have the following equivalencies ⇔ 2e|i x − 1| x ≥ 2e|j x − 1| x ⇔

|

|

(2ei − 1) x ≥ (2ej − 1) x s|i x





s|j x

(2) (3) (4)

where 1 ∈ Rn denotes the vector of all ones. The problem of finding the largest element of x can thus be cast as having to solve i = argmax xj ⇔ si = argmax s|j x

− s| x

s∈{−1,+1}n

s.t.

s| 1 − c1

2

(10) =0

whose Lagrangian is

−s|j x.

2

or, equivalently  2 L x, λ1 = s| 1 − c1 − λ1 s| x.

(11)

(12)

In [1], we argued w.l.o.g. that, if x is normalized such that it is non-negative and has a unit L1 norm, a good choice for the Lagrangian multiplier is λ1 = n. Finally, expanding 2 s| 1 − c1 = s| 11| s − 2c1 s| 1 + c21 (13) where the constant c21 is independent of s, we realize that the problem of finding a maximum element of a vector x can be written as  (14) s∗ = argmin s| 11| s − s| nx + 2c1 1 . s∈{−1,+1}n

This, however, is an Ising energy minimization problem that can be solved on adiabatic quantum computers.

(6)

B. Contribution In this paper, we show how to extend the Ising model for the basic problem of finding the k = 1 largest element of a set of number towards the slightly more general task of finding its k > 1 largest elements. We shall see that this requires only a miniscule adaptation of the above model and that the computational efforts for solving the more general problem are independent of the choice of k. In other words, in contrast to implementations on a classical computer, adiabatic quantum computing can find the k > 1 largest elements in the same amount of time required to find the k = 1 largest element.

sj

sj

argmin

(9)

(5)

j

⇔ si = argmin

s∗ =

L(x, λ) = −s| x + λ s| 1 − c1

Let xi , xj be two elements of x ∈ Rn . If xi ≥ xj , then

(1)

s|j 1 = 1 · (+1) + (n − 1) · (−1) = 2 − n ≡ c1 .

(7)

By the definition in (4), each sj is a transformed version of one of the n basis vectors ej of Rn and the elements of the sj are given by ( +1 if l = j (sj )l = (8) −1 otherwise. This is to say that each sj contains exactly 1 element that equals “+1” and n − 1 elements that equal “−1”.

II. A N I SING M ODEL FOR k L ARGEST E LEMENTS

III. A DIABATIC Q UANTUM argmax C OMPUTATION n

Identifying the k > 1 largest element of a vector x ∈ R is to determine an index set {i1 , i2 , . . . , ik } ⊂ {1, 2, . . . , n} such that k X

k X

xil ≥

l=1

xjl

  il ∩ jl = ∅.



(15)

l=1

In other words, we need to solve the following maximization problem {il } = argmax {jl }

k X

xjl

(16)

l=1

for which we find, in direct analogy to our discussion above, the following sequence of equivalencies (16)



{eil } = argmax {ejl }



{sil } = argmax {sjl }



k X l=1 k X

{sil } = argmin − {sil } = argmin − {sjl }

(17)

s|jl x

(18)

l=1 k X

{sjl }



e|jl x

When using (25) to find the k largest elements of a vector x ∈ Rn through adiabatic quantum computing, we consider an evolving system of n qubits. At each time t, the system is in a superposition of 2n basis states n

−1 2X ψ(t) = ai (t) ψi

(26)

i=0

where we understand each of the basis states ψ0 = 000 . . . 000 ψ1 = 000 . . . 001 ψ2 = 000 . . . 010 ψ3 = 000 . . . 011 .. .

(27) (28) (29) (30)

as an indicator vector representing one of the 2n possible (yet not necessarily correct) solutions. Considering a period of 0 ≤ t ≤ τ and choosing its initial state to be n

s|jl x

l=1 k X

(19) !|

sjl

x.

(20)

l=1

At this point, we observe that, when introducing the notation J = {jl } X sJ = sjl ,

(21) (22)

2X −1 ψi ψ(0) = √1 n i=0

we let the qubit system evolve under the influence of a timedependent Hamiltonian  (32) H(t) = 1 − τt HB + τt HP where HB is a problem independent Hamiltonian and HP is a problem specific Hamiltonian whose ground state represents a solution to the problem at hand [5], [6]. Following standard suggestions, we define

jl ∈J

HP =

the expression in (20) can be written more compactly as sI = argmin −s|J x.

(23)

This problem is structurally equivalent to the one we found in (7). However, here the sJ in (23) are bipolar vectors that contain k elements equal to “+1” and n − k elements equal to “−1”. Algebraically, this is to say that each of the nk possible vectors sJ obeys s|J 1 = k · (+1) + (n − k) · (−1) = 2k − n ≡ ck .

n X

σzi σzj −

i,j=1

sJ

(24)

Again in direct analogy to our our discussion above, we therefore find that the problem of finding the k > 1 largest elements of x is equivalent to solving the following Ising model  s∗ = argmin s| 11| s − s| nx + 2ck 1 . (25) s∈{−1,+1}n

The only difference between (14) and (25) in thus in the scalar constants c1 and ck . Since these are independent of the optimization variables s, the computational effort for finding k = 1 and k > 1 largest elements is of the same complexity.

(31)

and choose HB as n X HB = − σxi

n X (nxi + 2ck ) σzi

(33)

i=1

(34)

i=1

where σzi and σxi are Pauli spin matrices σz and σx acting on the i-th qubit. Measuring the a collapse of its system at t = τ will cause n wave function ψ(τ ) to one of the 2 basis states and the probability for this state to be ψi is given by the amplitude |ai (τ )|2 . Yet, since the adiabatic evolution was steered towards the problem Hamiltonian HP , states ψi that correspond to ground states of HP are more likely to be found. On an adiabatic quantum computer, this whole process can be carried out physically. On a digital computer, we may simulate its evolution by numerically solving the Schr¨odinger equation d ψ(t) = −i H(t) ψ(t) (35) dt for ψ(t) at each time step 0 ≤ t ≤ τ .

(a) x1 = [1, 2, 3, 4, 5, 6, 7, 8]

(b) x2 = [8, 7, 6, 5, 4, 3, 2, 1]

(c) x3 = [3, 6, 1, 4, 7, 2, 8, 5]

ψi

|ai |2

ψi

|ai |2

ψi

|ai |2

|00000111i |00001011i |00010011i |00001101i |00100011i |00010101i |00001110i |01000011i |00100101i |00011001i |00010110i |10000011i |01000101i |00101001i |00100110i |00011010i

0.016640 0.016040 0.015486 0.015451 0.014981 0.014925 0.014878 0.014525 0.014444 0.014404 0.014377 0.014116 0.014010 0.013947 0.013920 0.013881

|11100000i |11010000i |11001000i |10110000i |11000100i |10101000i |01110000i |11000010i |10100100i |10011000i |01101000i |11000001i |10100010i |10010100i |01100100i |01011000i

0.016640 0.016040 0.015486 0.015451 0.014981 0.014925 0.014878 0.014525 0.014444 0.014404 0.014377 0.014116 0.014010 0.013947 0.013920 0.013881

|01001010i |00001011i |00011010i |01000011i |10001010i |01010010i |01001001i |00001110i |11000010i |00010011i |01011000i |00101010i |01000110i |10000011i |11001000i |00011001i

0.016640 0.016040 0.015486 0.015451 0.014981 0.014925 0.014878 0.014525 0.014444 0.014404 0.014377 0.014116 0.014010 0.013947 0.013920 0.013881

(d) top 16 most likely final states

(e) top 16 most likely final states

(f) top 16 most likely final states

Fig. 1: Adiabatic quantum computation of the k = 3 largest elements of three 8-dimensional vectors x1 , x2 , and x3 . Each ψ(t) of 8 qubits. During their evolution over time, panel in the top row visualizes the evolution of a corresponding system the system are in a superposition of 28 = 256 basis states ψi each of which represents a potential solution. Initially, each possible solution (correct or incorrect) is equally likely. At the end of each process, certain basis states have noticeably higher amplitudes |ai |2 than the others and are thus more likely to be observed. In each case, the top most likely final states correspond to a configuration of the qubit systems that correctly identifies the k = 3 largest elements of x1 , x2 , and x3 .

IV. P RACTICAL E XAMPLES Next, we present simulation experiments (using the Python quantum computing toolbox QuTiP [7]) which illustrate how adiabatic quantum computing can solve the k largest elements problem. In particular, we consider three 8-dimensional input vectors which, prior to normalization to unit L1 norm, are given by x1 = [1, 2, 3, 4, 5, 6, 7, 8] x2 = [8, 7, 6, 5, 4, 3, 2, 1] x3 = [3, 6, 1, 4, 7, 2, 8, 5]. and evaluate (35) for t ∈ [0, τ = 100]. Figure 1 visualizes the adiabatic evolutions of qubit systems used to determine the k = 3 largest elements of our input vectors.

Each top row panel shows the behavior of the amplitudes |ai (t)|2 of the basis states the systems can be found in. At t = 0, all basis states of each system are equally likely but, over time, their amplitudes begin to increase or to decrease. At t = τ , several basis states have considerably higher amplitudes so that a measurement will likely cause the systems to collapse to one of these more probable states. The tables in the bottom row rank the corresponding 16 most likely final states. For each of the three cases, we observe that the top most likely final state represents a qubit configuration that correctly identifies the k = 3 largest elements of the input data. Figure 2 visualizes the adiabatic evolutions of qubit systems used to determine the k = 5 largest elements of the input vectors x1 , x2 , and x3 . The temporal behaviors of the amplitudes are completely analogous to the previous case and the adiabatic evolution of

(a) x1 = [1, 2, 3, 4, 5, 6, 7, 8]

(b) x2 = [8, 7, 6, 5, 4, 3, 2, 1]

(c) x3 = [3, 6, 1, 4, 7, 2, 8, 5]

ψi

|ai |2

ψi

|ai |2

ψi

|ai |2

|00011111i |00101111i |00110111i |01001111i |00111011i |01010111i |10001111i |00111101i |01011011i |01100111i |10010111i |00111110i |01011101i |01101011i |10011011i |10100111i

0.015705 0.015125 0.014582 0.014568 0.014076 0.014051 0.014038 0.013609 0.013570 0.013551 0.013546 0.013183 0.013126 0.013094 0.013088 0.013070

|11111000i |11110100i |11101100i |11110010i |11011100i |11101010i |11110001i |10111100i |11011010i |11100110i |11101001i |01111100i |10111010i |11010110i |11011001i |11100101i

0.015705 0.015125 0.014582 0.014568 0.014076 0.014051 0.014038 0.013609 0.013570 0.013551 0.013546 0.013183 0.013126 0.013094 0.013088 0.013070

|01011011i |11001011i |11011010i |01001111i |10011011i |01011110i |01101011i |11010011i |00011111i |11001110i |01111010i |11011001i |01010111i |10001111i |00111011i |11101010i

0.015705 0.015125 0.014582 0.014568 0.014076 0.014051 0.014038 0.013609 0.013570 0.013551 0.013546 0.013183 0.013126 0.013094 0.013088 0.013070

(d) top 16 most likely final states

(e) top 16 most likely final states

(f) top 16 most likely final states

Fig. 2: Adiabatic quantum computation of the k = 5 largest elements of three 8-dimensional vectors x1 , x2 , and x3 .

the three qubit systems for the problem of finding the k = 5 largest elements of the input leads to correct results as well. What is noticeable in both experiments is that the order in which the largest elements occur in the input vectors does not seem to matter. The respective three most likely final states in Figs. 1 and 2 are equally likely to be measured. V. C ONCLUSION We derived an Ising model for the problem of identifying the k > 1 largest elements of a vector x ∈ Rn . Given this model, the problem can be solved via adiabatic quantum computing and we presented simulations which corroborate this claim. Although our main concern was the feasibility rather than the efficiency of quantum computing for the k largest element problem, we observed that the complexity of solving the Ising model for k = 1 is the same as for the Ising model for k > 1. This differs from digital computing where efficient algorithms would run in O(n) and O(kn), respectively. The fact that adiabatic quantum computing can find the k largest elements of a set of numbers simultaneously may be of

interest for machine learning or data scientific problems such as discussed in [8]–[13] R EFERENCES [1] C. Bauckhage, K. Cvejoski, C. Ojeda, J. Sch¨ucker, and R. Sifa, “Adiabatic Quantum argmax Computation,” researchgate, Tech. Rep., Mar 2018. [2] Z. Bian, F. Chudak, W. Macready, and G. Rose, “The Ising Model: Teaching an Old Problem New Tricks,” D-Wave Systems, Tech. Rep., 2010. [3] M. Johnson, M. Amin, S. Gildert, T. Lanting, F. Hamze, N. Dickson, R. Harris, A. Berkley, J. Johansson, P. Bunyk, E. Chapple, C. Enderud, J. Hilton, K. Karimi, E. Ladizinsky, N. Ladizinsky, T. Oh, I. Perminov, C. Rich, M. Thom, E. Tolkacheva, C. Truncik, S. Uchaikin, J. Wang, B. Wilson, and G. Rose, “Quantum Annealing with Manufactured Spins,” Nature, vol. 473, no. 7346, 2011. [4] V. Denchev, S. Boixo, S. Isakov, N. Ding, R. Babbush, V. Smelyanskiy, J. Martinis, and H. Neven, “What is the Computational Value of Finite Range Tunneling?” Phys. Rev. X, vol. 6, no. 3, 2016. [5] E. Farhi, J. Goldstone, S. Gutmann, and M. Sipser, “Quantum Computation by Adiabatic Evolution,” arXiv:quant-ph/0001106, 2000. [6] A. Lucas, “Ising Formulations of Many NP Problems,” arXiv:1302.5843 [cond-mat.stat-mech], 2014. [7] J. Johansson, P. Nation, and F. Nori, “QuTiP 2: A Python Framework for the Dynamics of Open Quantum Systems,” Computer Physics Communications, vol. 184, no. 4, 2013.

[8] A. Cutler and L. Breiman, “Archetypal Analysis,” Technometrics, vol. 36, no. 4, 1994. [9] C. Faloutsos and K.-I. Lin, “FastMap: A Fast Algorithm for Indexing, Data-mining and Visualization of Traditional and Multimedia Datasets,” in Proc. SIGMOD. ACM, 1995. [10] D. Arthur and S. Vassilvitskii, “k-means++: The Advantages of Careful Seeding,” in Proc. SODA. ACM/SIAM, 2007. [11] C. Bauckhage and C. Thurau, “Making Archetypal Analysis Practical,” in Pattern Recognition, ser. LNCS, J. Denzler and G. Notni, Eds., vol. 5748. Springer, 2009. [12] C. Bauckhage and R. Sifa, “k-Maxoids Clustering,” in Proc. KDMLLWA, 2015. [13] R. Sifa and C. Bauckhage, “Online k-Maxoids Clustering,” in Proc. Int. Conf. on Data Science and Advanced Analytics. IEEE, 2017.