Research Collection
Doctoral Thesis
Development of Quantum Applications
Author(s): Heim, Bettina
Publication Date: 2020
Permanent Link: https://doi.org/10.3929/ethz-b-000468201
Rights / License: In Copyright - Non-Commercial Use Permitted
This page was generated automatically upon download from the ETH Zurich Research Collection. For more information please consult the Terms of use.
ETH Library diss. eth no. 27053
DEVELOPMENTOFQUANTUMAPPLICATIONS
A thesis submitted to attain the degree of doctor of sciences of eth zurich (Dr. Sc. ETH Zurich)
presented by bettina heim M. Sc. ETH Zurich born on 2 July 1989 citizen of Switzerland
accepted on the recommendation of Prof. Dr. M. Troyer, examiner Prof. Dr. R. Renner, co-examiner Prof. Dr. H. Katzgraber, co-examiner
2020 To my husband and family. ABSTRACT
The aim of this thesis is to identify practical applications where quantum computing could have an advantage over what is achievable with conventional means of computing, and what advances are needed in order to actualize that potential. We investigate the possibilities on both quantum annealing devices (analogue quantum computers) as well as on gate-based devices (digital quantum computers). Quantum annealing devices in particular have grown in size and capabilities over the last decade. While they are natural candidates for providing improved solvers for NP-complete optimization problems, the number of qubits, accuracies and available couplings are still limited and their aptitude has yet to be confirmed. We use Monte Carlo methods and conceive an adaptive annealing schedule to assess the options to leverage them for the construction of satisfiability filters. We furthermore investigate their prospective as heuristic solvers for the traveling salesman problem, and what future enhancements in terms of geometries and couplings would be beneficial for that. Based on our simulations there is no reason to expect any benefits to leveraging analogue quantum computers over state-of-the-art classical methods. However, we see an implementation of annealing schemes on future digital devices as a promising approach that doesn’t suffer from the same issues that impede performance on analogue devises. To that effect, we construct and implement an efficient quantization of the Metropolis-Hastings algorithm. Opposed to following the common way of quantization à la Szegedy that is usually defined with respect to an oracle, we reformulate the walk to closely mimic the classical algorithm and thus circumvent having to rely on costly quantum arithmetics. Our proposed realization thereby can lead to substantial savings. While theoretical arguments promise a quadratic speedup in the asymptotic limit, we numerically confirm that a polynomial speedup in terms of minimal total time to solution can be achieved for pragmatic use. We explore the prospects of using quantum walks in a heuristic setting and estimate the gate times the would be required to outperform a classical supercomputer. Finally, we elaborate on the role of programming languages, and how software tools can accelerate the advancement of the field. We discuss unique aspects of quantum programming and the purpose of Q# in particular, and conclude by highlighting what developments are needed for quantum computing to live up to its potential.
iii ZUSAMMENFASSUNG
Das Ziel dieser Dissertation ist es praktische Anwendungen zu identifizieren, bei denen Quantencomputer einen Vorteil gegenüber herkömmlichen Methoden erbrin- gen, sowie welche Fortschritte nötig sind, um dieses Potential umzusetzen. Wir untersuchen die Möglichkeiten dafür im Bezug auf analoge Quantencomputer sowie digitale. Insbesondere analoge Hardware ist im Laufe des letzten Jahrzehnts grösser und fähiger geworden und ist ein naheliegender Kandidat zur Lösung von NP-kompletten Problemen. Jedoch sind die Anzahl von Qubits, deren Genauigkeit und die verfügbaren Kopplungen limitiert, sodass ihre Eignung erst noch bestä- tigt werden muss. Wir verwenden Monte Carlo Methoden und entwickeln einen adaptiven Prozess um ihre Nützlichkeit für die Konstruktion von SAT-Filtern abzuschätzen. Ebenso evaluieren wir ob sie als besonders gute heuristische Löser für das Rundreiseproblem fungieren können, und welche zukünftigen Entwicklun- gen bezüglich Geometrie und Kopplungen der Machinen dafür vorteilhaft sind. Basierend auf unseren Simulationen schliessen wir, dass es keinen Grund gibt anzunehmen, dass solche anologe Hardware klassischen Methoden überlegen sind. Eine Implementierung dieses Prozesses auf digitaler Hardware hingegen könnte vielversprechend sein. Wir entwickeln daher eine effiziente Quantisierung des Metropolis-Hastings Algorithmus die mittels digitalen Quantencomputern einge- setzt werden kann. Im Gegensatz zu einer Quantisierung gemäss Szegedy, welche im Üblichen ein Orakel benutzt, erreichen wir es mit unserer Formulierung kostspie- lige Quanten Arithmetik zu vermeiden. Die präsentierte Umsetzung erweist sich damit als wesentlich kostensparender. Theoretische Argumente basierend auf dem asymptotischen Limit versprechen, dass ein quadratischer Geschwindigkeitsvorteil mittels Quantisierung erreicht werden kann. Wir bestätigen mit einer numerischen Studie eine polinomiale Überlegenheit für die heuristische Anwendung und geben die nötigen Geschwindigkeiten für die Ausführung von Instruktionen an, um einen klassischen Supercomputer zu übertreffen. Letztendlich diskutieren wir die Rolle von Programmiersprachen und wie geeignete Software die Ausarbeitung von Quantenapplikationen beschleunigen kann. Wir erklären die einzigartigen Aspekte beim Programmieren von Quantencomputern und den Zweck der Sprache Q#. Abschliessend heben wir die Entwicklungen hervor, die stattfinden müssen damit Quantencomputing seinem Potential gerecht wird.
iv ACKNOWLEDGEMENTS
I would like to thank my husband Stefan Baumann, without whose support this work would not have been possible. I would like to thank my parents whose unwavering faith in me has always pushed me to be a better person. I would like to thank Matthias Troyer who not only has been a fantastic mentor but is also a true inspiration.
Furthermore, I would like to thank the collaborators that contributed to the work discussed in this thesis. First and foremost, I would like to thank the co-authors of the papers that served as the basis for this thesis (in alphabetical order): Alan Geller, Andres Paz, Christopher Granade, Daniel Herr, Dave Wecker, David Poulin, Ethan Brown, Guglielmo Mazzola, Jessica Lemieux, John Azariah, Krysta Svore, Mariia Mykhailova, Mario Könz, Marlon Azinovi, Martin Roetteler, Mathias Soeken, Matthias Troyer, Sarah Marshall, and Vadym Kliuchnikov. Thanks go to Ilia Zintchenko for providing the translation of a k-SAT prob- lem to an Ising spin glass problem, and to Alex Kosenkov, Ilia Zintchenko, and Ethan Brown for providing and supporting the whiplash framework for easier management of measurement data. I thank Andreas Elsener, Donjan Rodic, Guang Hao Low, Guiseppe Carleo, Guillaume Duclos-Cianci, Jeongwan Haah, José Luis Hablützel Aceijas, Matt Hastings, and Thomas Häner for stimulating discussions. I thank Ali Javadi-Abhari, Julien Ross, Margaret Martonosi, and Peter Selinger for sharing their insights and input on quantum programming languages. Last but not least, I would like to express my gratitude the work of the people who set up and maintain the spinglass server [1] that was used for the calculation of ground state energies.
v CONTENTS
List of Figures ix List of Tablesx List of Programs xi 1 introduction1 1.1 Quantum states and qubits ...... 2 1.2 Analogue quantum computing ...... 4 1.3 Digital quantum computing ...... 5 2 traveling salesman problem 10 2.1 Mapping the TSP to an annealing problem ...... 11 2.1.1 Transition probabilities in quantum annealing . . . . . 11 2.1.2 Encoding as permutation matrix ...... 12 2.1.3 An improved encoding ...... 15 2.2 Numerical results ...... 17 2.3 Digital quantum annealing ...... 20 3 sat filters 22 3.1 Set membership problem and filter construction ...... 23 3.2 Quality metrics for filters ...... 25 3.2.1 False positive rate ...... 25 3.2.2 Filter efficiency ...... 26 3.3 Obtaining independent solutions ...... 26 3.3.1 Using annealing ...... 27 3.3.2 Using SAT-solvers ...... 30 3.4 Numerical results ...... 30 3.4.1 Diversity of solutions ...... 31 3.4.2 Quality of solutions ...... 32 3.4.3 Scaling with problem size ...... 37 3.5 Possible improvements ...... 38 4 annealing schedules 39 4.1 Adaptive schedule ...... 39 4.2 Calculation of observables ...... 42 vi contents vii
4.3 Numerical results ...... 43 5 quantum walks 47 5.1 Szegedy’s quantum walk ...... 48 5.1.1 Eigenvectors and eigenvalues ...... 49 5.1.2 Adiabatic state preparation ...... 50 5.2 Quantization for Metropolis-Hastings algorithm ...... 51 5.2.1 Construction of Szegedy’s walk oracle ...... 53 5.2.2 Alternative walk ...... 54 5.3 Optimization heuristics ...... 59 5.3.1 Algorithm based on the quantum Zeno effect . . . . . 60 5.3.2 Algorithm based on a unitary walk ...... 61 5.4 Numerical results ...... 62 5.5 Irreversible parallel walk ...... 65 6 quantum programming 69 6.1 Domain-specific concepts ...... 70 6.2 Quantum algorithms ...... 72 6.3 Quantum model of computation ...... 74 6.4 Quantum software frameworks today ...... 76 6.4.1 Use cases ...... 78 6.4.2 Tools ...... 79 6.4.3 Ecosystems ...... 81 7 quantum programming languages 84 7.1 Purpose of programming languages ...... 84 7.2 Languages and ecosystems overview ...... 86 7.2.1 Q# ...... 88 7.2.2 OpenQASM and Qiskit ...... 92 7.2.3 Cirq...... 98 7.2.4 Quipper ...... 102 7.2.5 Scaffold ...... 105 8 domain-specific language q# 108 8.1 Design principles ...... 108 8.2 Program structure and execution ...... 109 8.3 Global constructs ...... 113 8.3.1 Type declarations ...... 113 8.3.2 Callable declarations ...... 114 8.3.3 Specialization declarations ...... 116 viii contents
8.4 Statements ...... 121 8.4.1 Quantum memory management ...... 123 8.4.2 Variable declarations and updates ...... 124 8.4.3 Returns and termination ...... 126 8.4.4 Conditional branching ...... 127 8.4.5 Loops and iterations ...... 129 8.4.6 Call statements ...... 130 8.4.7 Other quantum-specific patterns ...... 132 8.5 Expressions ...... 134 8.5.1 Operators, modifiers, and combinators ...... 134 8.5.2 Conditional expressions ...... 140 8.5.3 Partial applications ...... 144 8.5.4 Copy-and-update expressions ...... 145 8.5.5 Item access for user defined types ...... 147 8.5.6 Contextual and omitted expressions ...... 147 8.6 Type system ...... 148 8.6.1 Singleton tuple equivalence ...... 149 8.6.2 Immutability ...... 149 8.6.3 Quantum-specific data types ...... 150 8.6.4 Callables ...... 151 8.6.5 Operation characteristics ...... 152 8.6.6 Type parameterizations ...... 156 8.6.7 Subtyping and variance ...... 159 8.7 Debugging and testing ...... 162 9 into the future 164
bibliography 169 LISTOFFIGURES
Figure 1.1 Bloch sphere ...... 3 Figure 2.1 Required spin flips to resolve tour crossings ...... 14 Figure 2.2 Number of connections for subtours found by annealing 18 Figure 2.3 Gate-based implementation of energy penalties for sub- tours ...... 21 Figure 3.1 Number of unique SAT-solutions obtained by annealing 31 Figure 3.2 FPR of the constructed SAT-filters ...... 32 Figure 3.3 Efficiency of the constructed SAT-filters ...... 33 Figure 3.4 Hamming distance between randomly selected solutions 34 Figure 3.5 Probability of finding similar SAT-solutions ...... 35 Figure 4.1 Optimized annealing schedule ...... 44 Figure 4.2 Median residual energy for various annealing schedules 45 Figure 5.1 Quantum and classical minimum total time to solution for a 1D Ising model ...... 62 Figure 5.2 Quantum and classical minimum total time to solution for a random sparse Ising model ...... 63 Figure 5.3 Residual energy of an Ising model on a complete graph using quantum walks ...... 67 Figure 8.1 Working with clean versus borrowed qubits...... 124
ix LISTOFTABLES
Table 2.1 Comparison of the number of spin flips required to resolve crossings ...... 15 Table 3.1 Average Hamming distance between two 4-SAT solutions found by different solvers...... 35 Table 5.1 Upper bound on the complexity of each component of the walk operator ...... 55 Table 5.2 Logical gate times required to outperform a supercom- puter ...... 65 Table 7.1 Overview of features of the discussed quantum program- ming languages...... 87 Table 8.1 Overview over available operators in Q#...... 135 Table 8.2 Expression modifiers and combinators in Q#...... 139
x LISTOFPROGRAMS
Program 7.1 Q# code implementing teleportation of an arbitrary quantum state...... 91 Program 7.2 OpenQASM code implementing teleportation of an arbitrary quantum state...... 94 Program 7.3 Python code used to execute OpenQASM programs using Qiskit...... 95 Program 7.4 Qiskit code to generate the OpenQASM circuit for teleporta- tion...... 96 Program 7.5 Cirq code implementing teleportation of an arbitrary quan- tum state...... 100 Program 7.6 Quipper code implementing teleportation of an arbitrary quantum state...... 103 Program 7.7 Haskell code that instantiates the target machine for Pro- gram 7.6...... 104 Program 7.8 Scaffold code implementing teleportation of an arbitrary quantum state...... 106 Program 8.1 Q# command line application executing a quantum Fourier transformation...... 111
xi 1 INTRODUCTION
Quantum computing exploits quantum phenomena such as superposition and entanglement to realize a form of parallelism that is not available to traditional computing. It offers the potential of significant computational speed-ups in quantum chemistry, materials science, cryptography, and ma- chine learning. Having been a long-standing topic of discussion among scientists, quantum computing has more and more become the focus of public interest as well. Its potential to be more powerful than any conven- tional means of computing and claims that it can revolutionize the way hard optimization problems are solved [2] have piqued the interest of industry. While there is great hope for the merits that quantum computing could bring, there is also an understanding that any practical application requires algorithmic advances and specialized tools to conquer the challenges unique to working with quantum systems. To build a quantum computer for com- mercially viable applications we need innovations both on the hardware and on the software front. Our effort must include not only a scalable hardware platform, but equally important a sustainable software stack that is capable of supporting its design, control, and the innovations that will eventually lead to a clear advantage of quantum over classical. The idea of a software stack is to build layers of abstraction that encapsulate the required knowledge about different aspects relevant for execution, thus making it available for other layers to build on without having to be aware thereof.
In this thesis we dive into what quantum technology can offer, and what developments are needed to enable large scale quantum computing. We start by looking into some potential applications for quantum annealing devices before looking at the corresponding options and implementations on digital quantum computers. Finally, we muse about how to build a scalable software stack for quantum computing, before detailing the role and purpose of quantum programming languages, and concluding with an outlook into the future.
1 2 introduction
1.1 quantum states and qubits
Fundamentally, a quantum computer is a machine that stores and processes quantum information. While classical computing models a binary system and employs boolean logic for computation, quantum information is stored in quantum states of matter, and computation is effected by quantum inter- ference. Just as individual binary values are stored in bits, quantum states are stored in quantum bits or qubits for short. We will start with a brief introduction of the basic units of quantum information and a description of quantum states.
An idealized quantum system consisting of n logical qubits used for n computation is described by a complex state vector in C2 . For instance, the state of a single-qubit system can be written as |ψi = α|0i + β|1i, for . 1 . 0 some complex numbers α and β, where |0i = (0) and |1i = (1) are vectors forming the computational basis for a single qubit. The components α and β are called amplitudes and a state of the above form is called a superposition of the basis states |0i and |1i if α 6= 0 6= β. The amplitudes of a quantum state cannot be observed directly. Instead, measurements are required to extract any information about a quantum state. Measurements are probabilistic and returns only n bits of information for a quantum system with 2n basis states; measurement selects one output state at random. Evolving under a carefully constructed transformations enables quantum interference to modify the states’ amplitudes and in turn the probability distribution from which one draws the measurement output. Born’s rule provides that the absolute value of the amplitude squared maps to probability space; when measuring the quantum state |ψi = α|0i + β|1i in the computational basis for example, either state |0i or |1i is observed with probability |α|2 or |β|2, respectively. One may notice that global phase eiδ does not change these probabilities. In fact, it does not impact any observable properties of the state. This ambiguity is a result of our simplification to represent the state of the quantum system as vector. More generally, the state of a two-level quantum system would indeed need to be represented not as a vector, but instead as a full density matrix in SU(2). However, quantum computing is merely concerned with pure states, allowing for the simplification of representing the relevant states as a vector rather than a matrix. For a two-level quantum system (a qubit), the isomorphism between the lie algebra for the group of unitary and hermitian matrices SU(2) and 1.1 quantum states and qubits3
ˆz = |0i
|ψi
θ ˆy ϕ ˆx
−ˆz = |1i
Figure 1.1 Visualization of a single-qubit state via Bloch sphere the lie algebra of the group of three dimensional rotations SO(3) allows for an nice geometric representation. A single qubit state is hence often visualized as a point on the surface of the so-called Bloch sphere. Within This geometric representation, a state is defined by spherical coordinates θ and φ. The angle θ describes the colatitude with respect to the Z-axis and φ θ iφ θ the longitude with respect to the Y axis: |ψi = cos 2 |0i + e sin 2 |1i, with 0 ≤ θ ≤ π and 0 ≤ φ < 2π. The pure states that are of interest for quantum computing are on the surface of the Bloch sphere, while points within the sphere correspond to mixed states. The visual interpretation unfortunately breaks down for the multi-qubit case.
The states of a multi-qubit system consisting of unentangled subsystems can be described in terms of the tensor products of valid states for individual subsystems. For instance, a two-qubit state can be constructed as |01i = |0i ⊗ |1i = (0 1 0 0)t. The set of valid states within the entire computation space is then found by the closure under linear combinations, subject to the consistency requirement that any valid quantum state√ must be normalized as |hψ|ψi|2 = 1. The two-qubit state (|00i + |11i)/ 2 is therefore a valid state, despite that there does not exist any pair of single-qubit states that we can assign to each individual qubit. That certain states are impossible to express as a tensor product of the states of individual subsystems implies a particular form of correlation between these subsystems that we refer to as entanglement. 4 introduction
1.2 analogue quantum computing
Some of the earliest physical realizations aspiring to leverage the power of quantum for computing were quantum annealing devices. Such devices compute via (quasi-)adiabatic evolution; the adiabatic theorem [3, 4] states that a system that is in an eigenstate of an initial Hamiltonian will remain in the instantaneous eigenstate when the Hamiltonian is changed slowly enough. In principle, adiabatic quantum computing is polynomially equivalent to gate-based quantum computing [5]. In reality, current implementations in commercial quantum annealing devices [6–8] provide only a limited set of couplings such that only certain kinds of problems can be solved. In particular, unconstrained binary optimization problems (QUBOs) are prime candidates for problems where annealing devices can potentially bring some benefits. QUBO problems can be mapped trivially to an Ising spin glass Hamiltonian with local fields given in Eq. (1.1). Finding the ground state of such Ising spin glass problems in three or more dimensions is an NP-complete problem [9], and many well-known problems from the field of computer science can be mapped to such a description [10, 11]. To accommodate hardware restrictions, a QUBO usually needs to be mapped to a more restricted format such as, e.g., the Chimera graph implemented by D-Wave devices [6]. To perform computations, the idea of quantum annealing [12–16] is to start in the easy to prepare ground state of an interacting Hamiltonian and then gradually tune the interaction strength to transition into the ground state of a more complex target Hamiltonian. Within the context of annealing, physical qubits are often referred to as spins, owed in partial due to the fact that currently realizable target Hamiltonians commonly have to take Ising spin glass form z z z HP = ∑ Jss0 σs σs0 − ∑ hsσs (1.1) hs,s0i s z where σj is the Pauli-z matrices acting on spin j, and the sum goes over all coupling spins. The gradual change of the Hamiltonian is described by two monotonic functions A and B, with A(0) = 1, B(0) = 0 and A(T) = 0, B(T) = 1, such that the Hamiltonian at a time t is given by
H(t) = A(t)HD + B(t)HP for t ∈ [0, T].
A common choice is A(t) = 1 − t/T and B(t) = t/T. The relation between the interaction or driver Hamiltonian determines the dynamics during 1.3 digital quantum computing5
evolution. A usual choice for HD is given by the Hamiltonian of a transverse magnetic field: x HD = −Γ ∑ σi . i In analog devices, thermal as well as quantum fluctuations can excite the system, making quantum annealing an approximate solver that will generally find states close to but not necessarily the exact ground state; crossings or near-crossings in the energy spectrum allow for transitions into excited states (see also Ref. [17]). The size of the spectral gap – if any – determines how slowly the system has to be evolved [18]. Stoquastic Hamiltonian such as the Ising Hamiltonian in a transverse field can be efficiently simulated via quantum Monte Carlo methods. Even though this is true for any stoquastic Hamiltonian, in general it is a highly nontrivial endeavor to identify a suitable set of basis states that would allow to do so. Furthermore, there are recent efforts to realize nonstoquastic Hamiltonians [19]. To simulate quantum annealing on a classical computer, one option is to use path integral Monte Carlo, where the d-dimensional quantum system is mapped onto a classical system in d+1 dimensions via a Suzuki-Trotter decomposition, introducing an additional “imaginary time” dimension [20].
Quantum annealing in spirit is closely related to its classical counterpart; thermal annealing. Thermal annealing consists of keeping a system in thermal equilibrium with a heat bath while the temperature is slowly decreased to almost zero. If the annealing process is slow enough and the final temperature low enough, the system is forced into its ground state. The idea to simulate this process to solve optimization problems using Markov chain Monte Carlo methods was introduced by Kirkpatrick, Gelatt and Vecchi in 1983 [21, 22]. Whether thermal excitations or quantum fluctuations (tunneling) are more effective to drive the system out of local minima while exploring the problem space depends on the energy landscape or cost function for the problem [23–25].
1.3 digital quantum computing
Gradually tuning a set of couplings and field strengths to continuously evolve the state of a computation is in contrast to how digital devices perform computations. Digital quantum computers – much like classical computers – operate by implementing a discrete set of instructions. These 6 introduction
are combined to approximate arbitrary transformations of the quantum state during program execution. At the lowest level, quantum algorithms are built from a handful of primitive quantum instructions, just like classical algorithms at lowest level are made of primitives like AND, NOT, and OR gates. Within the context of this these, we will call an instruction that has no effect on the program state other than manipulating the quantum state a quantum gate. A sequence of gates operating on a set of qubits is traditionally called a quantum circuit. In this section, we will briefly introduce the most basic quantum primi- tives, before elaborating how this historic point of view relates to expressing quantum programs at a similar abstraction level as we are used to in classi- cal software engineering. We will then cover this topic in much more depth in the chapters VI - VIII.
From the perspective of quantum algorithms research, how we think and reason about quantum algorithms is rooted in the mathematical concepts that are at the foundation of quantum computing. Within this model, a computation corresponds to a sequence of mathematical transformations applied to the state vector. These transformations are described by 2n × 2n complex unitary matrices or measurements. A unitary matrix is a matrix whose inverse is given by its conjugate transpose, also referred to as its adjoint. For example, a single-qubit state can be transformed from |0i to |1i and back via the X operator, represented by the unitary matrix ! 0 1 X .= .(1.2) 1 0
The operator X can be seen as a coherent version of a classical NOT gate, mapping an arbitrary superposition α|0i + β|1i to α|1i + β|0i. That transformation applied to a particular qubit within a multi-qubit system is obtained by taking the tensor product of X with the identity operator 1 on the remaining qubits. The effect of applying X to the second qubit within a three-qubit system, for example, is represented by the unitary operator 1 ⊗ X ⊗ 1. We adopt the convention of specifying transformations by their actions on the transformed subsystem and will leave the extension to the entire system implicit. The X operator is one of three Pauli operators that together with the identity form a basis for all unitary transformations 1.3 digital quantum computing7 on a single qubit. The matrix representations for the other two operators Y, and Z are ! ! 0 −i 1 0 Y .= , Z .= .(1.3) i 0 0 −1
Any single-qubit unitary transformation can be expressed as a linear com- bination of these operators. In order to transition from this mathematical perspective to a formulation that is more aligned with how computer programs are commonly expressed, it is convenient to introduce the single- qubit operators H and T given by ! ! 1 1 1 1 0 H .= √ , and T .= .(1.4) 2 1 −1 0 eiπ/4
The Hadamard operator H is the transformation between the eigenbases of X and Z, while T rotates a qubit around the Z-axis. Its square S .= T2 is the transformation between the X and Y eigenbases. From the given matrix representation we can see that the Hadamard operator H maps |0i → √1 (|0i + |1i), and |1i → √1 (|0i − |1i), whereas up to a global 2 2 phase, T rotates a qubit around the Z-axis by an angle π/8. In order to obtain a finite set of discrete instructions that are universal for arbitrary multi-qubit unitary transformations only one additional in- struction is needed. A common choice is the CNOT operator acting on two qubits. It maps |x, yi → |x, x ⊕ yi. This operator is represented by the unitary matrix 1 0 0 0 0 1 0 0 CNOT .= ,(1.5) 0 0 0 1 0 0 1 0 and is often referred to as the controlled-NOT, or CX, gate. Conditioned on the state of the first qubit, the transformation X is applied to the second qubit. Such a conditional transformation in a sense can be seen as the “quan- tum version” of a conditional branching, where both branches can execute simultaneously if the condition given by the state of the first qubit being |1i is a superposition of being satisfied and not satisfied [26]. The concept of this coherent branching can be extended to performing arbitrary multi- qubit transformations conditioned on the state of multiple qubits. Just like 8 introduction
any unitary transformation, such controlled transformations can be broken down into a sequence of simpler one- and two-qubit transformations [27, 28]. While the ambiguity in the description of quantum state up to a global phase is merely an artifact of our choice to work with the simplified de- scription of the quantum state as a vector instead of the full density matrix, it is worth pointing out that an irrelevant global phase can quickly become local and thus relevant when a gate is executed conditionally on the state of other qubits.
The introduced operators T, Hadamard, and CNOT form a universal gate set, i.e., any target unitary transformation can be approximated to arbitrary precision over this gate set. Along with measurement, they can thus be used to express any quantum algorithm [29–31]. The corresponding gate set is of- ten called the Clifford+T gate set. Examples for which such approximations are needed include rotations around Pauli axes and are common in many −iθP/2 quantum algorithms. The corresponding operator is RP(θ) = e , where P ∈ {X, Y, Z} denotes one of the Pauli matrices and θ ∈ [0, 2π) is a rotation angle. For further reading about approximations over the Clifford+T and other gate sets, we refer to [32–34] and the references cited therein. Besides efficient algorithms for approximation of gates, the Clifford+T gate set has also several benefits when it comes to circuit optimization and rewriting, see e.g. [35]. When implemented fault-tolerantly, gates can have widely different cost. In typical fault-tolerant architectures, T gates are not provided natively but rather have to be created by a special distillation process [36]. This process can create large overheads, depending on the underlying noise level and other architectural parameters. In the Clifford+T gate set, the cost of a T gate that is several orders of magnitude higher than the cost of H, Z, X, S, and CNOT which are all elements of the so-called Clifford group. This motivates to just count the total number of T gates required by a quantum algorithm implementation and the total circuit T-depth when trying to parallelize as many Ts into stages as possible. While the Clifford+T gate set is sufficient to approximate any unitary transformation, it is often convenient to express certain transformations in terms of larger multi-qubit gates. An example for a popular three-qubit gate is the Toffoli gate, also called CCNOT gate. It maps |x, y, zi → |x, y, xy ⊕ zi. A possible origin of its popularity lays in the close relation between quan- tum computing and classical reversible computing; any unitary operator by 1.3 digital quantum computing9 definition is reversible since for a unitary matrix U it holds that UU† = I, where † represents the complex conjugate transpose matrix. The mapping defined by the Toffoli gate makes it universal for reversible classical com- puting, since it is capable of implementing any reversible Boolean function given enough zero-initialized ancillary bits.
So far we have covered how to express the reversible parts of a quantum computation. While large parts of a quantum algorithm can be described by unitary transformations, ultimately classical information needs to be extracted for use by non-quantum hardware. Such an extraction is achieved by projecting the state onto the eigenspaces of a unitary operator which yields the corresponding eigenvalue as measurement result. In principle, a quantum state can be projected onto an eigenspace of an arbitrary unitary operator. In practice, only a limited set of measurements are available as hardware instructions, and any other projection is achieved by suitable transformations beforehand. For example, to project a single-qubit state onto the eigenstates of the X operator, one would apply the basis trans- formation H, perform the measurement with respect to the computational basis, and reverse the basis switch by applying H again. Similarly, to project onto the eigenstates of the Y operator, the basis transformation is given by (SH)† = HS†, with the reversion SH. Despite being non-unitary, projec- tive measurements can be used to manipulate quantum entanglement [37] and are an integral part of a wide class of quantum algorithms. A simple CNOT gate, for example, can be performed using leveraging entanglement, measurements, and single-qubit operations applied conditionally on mea- surement outcomes [38].
A quantum program can be seen as a sequence of primitive instructions such as the elements of the Clifford+T gate set. The sequence is herein generated by a classical algorithm, where the generating algorithm con- tains classical control flow that potentially depends probabilistically on the execution of preceding transformations. Such dependencies arise if the program continuation is conditioned on the outcome of measurement results, and are widely used in particular in the form of repeat-until-success patterns [39–41] and in iterative phase estimation based algorithms [42–44] used in applications such as Hamiltonian simulation [45]. 2 TRAVELINGSALESMANPROBLEM
This chapter contains content from Publication IV.
With progress in quantum technology more sophisticated quantum an- nealing devices are becoming available. Quantum technology is maturing to the point where, for specially selected problems, it can compete with classi- cal computers. Particularly, quantum annealing (QA) devices – performing quantum optimizations by slowly evolving toward a target Hamiltonian – and their potential have been a recent source of controversy. While they offer new possibilities for solving optimization problems, their true poten- tial is still an open question. For a fair assessment of their potential it is necessary to take a close look at the real world problems they strive to solve, and how they can be implemented on a given device. Moreover, how to design such algorithms is becoming increasingly relevant as more and more sophisticated models are starting to become available [46]. As the optimal design of adiabatic algorithms plays an important role in their assessment, we illustrate the aspects and challenges to consider when implementing optimization problems on quantum annealing hardware based on the ex- ample of the traveling salesman problem (TSP).
In this chapter we address factors that determine the performance of quantum annealing algorithms and formulate guidelines for their devel- opment. We discuss the issues that need to be considered when designing specialized quantum hardware and illuminate the challenges and pitfalls of adiabatic quantum computing by examining the case of the traveling salesman problem. We will see that tunneling between local minima can be exponentially suppressed if the quantum dynamics are not carefully tailored to the problem. Furthermore we demonstrate that inequality con- straints, in particular, present a major hurdle for the implementation on analog quantum annealers. Programmable digital quantum annealers can overcome many of these obstacles and can – once large enough quantum computers exist – provide an interesting route to using quantum annealing on a large class of problems.
10 2.1 mapping the tsp to an annealing problem 11
2.1 mapping the tsp to an annealing problem
In order to solve an optimization problem by annealing, its solution needs to be encoded into the ground state of the target Hamiltonian. With quan- tum annealing being an approximate solver, it is preferable that in fact all low energy states correspond to solutions that are close to optimal - and to only those. Since the commutation relation between the target and driver Hamiltonian determines the dynamics during evolution, the chosen encod- ing additionally has to permit the use of a simple enough to implement driver that allows for fast transitions between potential solutions. While in principle it is possible to solve an arbitrary problem on an annealing device, its quantum nature as well as architectural limitations im- pose restrictions on the cost functions and possibly constraining conditions that can be realized. Optimally implementing a given problem thus requires a well chosen mapping onto a suitable target Hamiltonian. The choice of this mapping significantly influences the performance of the algorithm and its scaling with problem size. Whether or not a problem can be solved efficiently by annealing thus depends on both the available hardware and the chosen algorithm.
Given N cities and distances dij between them, the task of the traveling salesman problem is to find the shortest possible roundtrip that visits each city exactly once. Since current devices provide only local fields and tunable two-site couplings between adjacent qubits, any target Hamiltonian has to correspond to an Ising spin glass.
2.1.1 Transition probabilities in quantum annealing
The ground state of an Ising spin glass can be found by quantum annealing, where the system evolves according to a time dependent Hamiltonian
t t H(t) = (1 − )H + H for 0 ≤ t ≤ T.(2.1) T D T P
Consider the transition probability for transitions between two states ψ0 and ψ1 that each represent a valid tour. Both states are then eigenstates of HP. Assume the system is in a state ψ0 at a time t0 . T. The probability that 12 traveling salesman problem
x the state at a time t0 + ∆t . T is ψ1, if we choose HD = −Γ ∑e σe , h¯ = 1, can be approximated by
Γ Γ P (∆t) = sin2 |a(ω )| cos2 |a(ω )| + O(|I | + 2r) t0 ∏ T j ∏ T k 1 j∈I1 k∈I2
where r N, and
4 4t (t + ∆t) ω | ( )|2 = + 0 0 2( k ) a ωk 4 2 sin ∆t ωk ωk 2 ∆t2 4∆t ω ω + − ( k ) ( k ) 2 3 sin ∆t cos ∆t (2.2) ωk ωk 2 2
The set I1 contains all spins whose state differs between the two valid tours, I2 all remaining spins. The terms ωk are the frequencies belonging to the transition given by flipping spin k. While they depend on the state of the surrounding spins, we can neglect this dependency for term up to order O(|I1| + 2r) for r N. We thus make the approximation that the frequencies ωk are independent on the transition path from ψ0 to ψ1 in Eq. (2.2).
∆t In the limit T → ∞, const = T 1, the lowest order contribution to the transition amplitude simplifies to
s Γ∆t s 1 A(s)(∆t) = (2.3) T ∑ ∏ E − E⊥ shortest i=1 0 γi paths γ
where s is the minimal path length to transition between the two states. E⊥ The energies γi are the eigenvalues of the intermediate states along the transition path, and thus path dependent.
2.1.2 Encoding as permutation matrix
To formulate a TSP as annealing problem, we need to represent every possi- ble valid roundtrip as a spin configuration. The straightforward encoding is to associate each roundtrip with a permutation matrix aik, where aik = 1 if the i-th city is visited at time k of the tour, and zero otherwise [11]. With z the mapping aik = (1 − σik)/2 the Hamiltonian can be formulated in terms of quantum spin variables. We then need to ensure that the ground state 2.1 mapping the tsp to an annealing problem 13 corresponds to the encoding of the shortest roundtrip. Minimizing the tour length given by the Hamiltonian
Hl = ∑ dijaikajk+1 for ajn+1 ≡ aj1 (2.4) i,j,k subject to the constraints ∑i aik = 1 ∀k and ∑k aik = 1 ∀i accomplishes our goal. These two requirements guarantee that (Mij) is indeed a permutation matrix. They can be implemented by constraint terms
!2 !2 Hc = ∑ 1 − ∑ aij + 1 − ∑ aji ,(2.5) i j j which add an energy penalty to states violating them. The ground state of the Hamiltonian
(perm) . HP = Hl + ηHc ˜ 1 z z di z = ∑ dijσikσjk+1 + ∑( + η(N − 3))σik 4 i,j,k ik 2 η z z + σ σ 0 + const 4 ∑ s s hs,s0i
˜ . 1 with di .= ∑ (dij + dji) j6=i 2 therefore provides the desired TSP solution. The last sum is over all neigh- boring spins, where we consider two spins to be neighbors, if they either represent the same city or the same time during the tour. The factor η has to be chosen large enough to ensure that the ground state indeed corresponds to a tour configuration; η ≥ max{dij/2}. Such a formulation requires (N − 1)2 spins, as we can fix city N to be the last city in the tour, each of which has 2(N − 2) neighbors. For an N-city TSP we hence in principle require (N − 1)2 qubits and 3(N − 2)(N − 1)2 couplers. Given a typical QA architecture with a small bounded number of couplers per qubit, one will rather need O(N3) qubits.
The quantum driver Hamiltonian HD determines the dynamics of the annealing process and should provide an efficient near-adiabatic evolution towards HP without ending up in an excited state. The usual choice is x a transverse field term Hx = −Γ ∑i,j σij, which induces single spin flips. 14 traveling salesman problem
Before contemplating more complex alternatives it is useful to understand the influence of HD on the annealing efficiency.
Figure 2.1 A) A crossing requiring up to 4bN/4c single spin flips to resolve for a permutation mapping, and only 4 for a symmetric TSP represented by a graph mapping. B) Worst case for N = 18, r = 3: Using a permutation mapping, resolving r crossing requires up to 2 N − d(N − (r − 1))/(r + 1)e single spin flips.
Consider the probability to transition between two tours of similar length, as shown in Figure 2.1A. This transition can be performed by a so-called 2-opt update [47, 48], which is a common and very efficient primitive move in classical heuristics. Using the above mapping this, however, requires to update m = O(N) variables, since we have to change the order in which half of the cities are visited. The probability to transition between these two tours towards the end of the annealing process is thus – in leading order – proportional to Γ/∆)m, see Eq. (2.3), where ∆ is the scale associated with the barriers between the two solutions. A simple crossing, as shown in Figure 2.1A, is therefore difficult to resolve since the transition probability is exponentially suppressed (in the problem size N) compared to classical heuristics that can directly implement a 2-opt update.
We thus see that the choices of mapping HP and HD affect which updates to a configuration are efficiently realized during quantum annealing, and this directly and significantly impacts performance. The above exponential slowdown might be avoided by a better choice of HD or HP. Following the first route we could opt to permute several cities using multi-qubit couplers. While resolving a crossing may still entail O(N) steps and the exponential suppression remains, this may nevertheless significantly improve transition probabilities by avoiding high energy intermediate configurations that violate constraints. In fact, such kinetics could allow sampling of only viable TSP solutions, which would render the constraints of Eq. (2.5) unnecessary, 2.1 mapping the tsp to an annealing problem 15 and thereby simplify the energy landscape that needs to be explored [49]. However, the pairwise exchange of all two-city pairs requires O(N4) four- spin couplers, which is infeasible for all but the smallest problems.
2.1.3 An improved encoding
Independent on the exact dynamics induced by HD, the transition prob- ability declines exponentially with the required number of moves for a transition between two given states. In order to design a mapping that allows for an efficient realization of 2-opt (or more generally k-opt) moves in the quantum annealer, we use N(N − 1) spins to represent not the per- mutation, but the the travelled connections between cities, leading to a cost function 0 Hl = ∑ dijaij.(2.6) i,j While the required number of moves for a transition between two TSP solutions is approximately the same for both mappings in the asymmetric case, the second map has a clear advantage in the symmetric case. Focusing on symmetric TSPs, a 2-opt update using such an encoding as connection graph only requires the flipping of m = 4 spins. More general k-opt move requires just m = 2k flips, independent of the problem size. Such a mapping thus avoids the exponential slowdown of the previous one. Table 2.1 gives an overview for the number of single spin flips required to resolve r crossings in both mappings.
permutation graph mapping mapping
minimal number r+1 of required spin flips 4b 2 c 4r
maximal number N−(r−1) r of required spin flips 2 N − d r+1 e 4
Table 2.1 Required number of spin flips to resolve r crossings in the symmetric TSP compared for both mappings
In the case of a symmetric TSP, ie. dij = dji ∀ i, j, we can associate aij = aji with the undirected edges between cities i and j, and the number of required 16 traveling salesman problem
1 spins reduces to 2 N(N − 1). While the the number of required qubits seems to be comparable at N(N − 1)/2, this number can be substantially reduced by truncating the set of considered edges. Along the optimal tour, cities are connected almost exclusively to nearby cities. In fact, the probability of connecting to the l-th farthest city decreases exponentially with l for random problems instances. We can thus truncate the set of considered edges originating at a city to a small number of L closest cities. This substantially reduces the number of required qubits to NL/2 = O(N).
Implementing the constraints
TSP solutions are subject to the constraint that the set of edges with aij = 1 form a valid tour. We expect each city to be connected to exactly two other cities. Closed tours can be enforced by adding a constraint term
!2 0 Hc = ∑ 2 − ∑ aij with aij = aji (2.7) i j6=i
These constraint terms require O(NL2) 2-qubit couplers, substantially less than the O(N3) terms required for the first mapping. While this term enforces a configuration consisting of closed loops where each city is visited exactly once, it does not in fact enforce that all visited cities belong to the same loop: the tour can break up into disjoint subtours instead of one tour connecting all cities. Depending on the specific variant of the TSP this may or may not be desired – one may, for example, want to know if using multiple salesmen is preferred. In that case the target Hamiltonian
(graph) de z η z z H = ( + η(N − 5))σ + σ σ 0 + const P ∑ 2 e 4 ∑ e e e he,e0i
will serve our purpose. The last sum over neighboring spin pairs includes all pairs of spins representing connections with one common start or end point.
However, for randomly generated problems many of the subtours are not particularly interesting. Evaluating 100 random problems with N = 12 and uniformly distributed cities in a 2D-plane using CPLEX [50, 51] shows that the ground state of 75% of the instances splits into subtours and a majority of these subtours contain only three cities. For larger problem sizes, it is likely that here too, we will frequently obtain solutions consisting of a large number of subtours containing only a small number of cities. 2.2 numerical results 17
If we rather want to insist on exactly one closed loop, additional precau- tions will have to be taken. Directly enforcing a single closed tour would require N-qubit coupling terms and is unrealistic. The standard procedure to avoid such undesired states is to iteratively add terms that penalize the specific subtour breakups encountered during the optimization. Given a breakup into, e.g., two sets of cities A and B, we add an inequality constraint of the form ∑ ∑ aij > 0. (2.8) i∈A j∈B Unfortunately, such an inequality constraint is hard to implement with two-qubit couplings in an Ising model quantum annealer. Approximating the step function of an inequality by a k-th order polynomial requires implementing O(N2k) k-spin couplings. Luckily, an evaluation using CPLEX [50] shows that for the ground states of our instances there are very few required connections; around 94% of disconnected subtours should have merely two connections with each other and the remaining 6% should form four connections. For these a simple quadratic energy penalty !2 0 η C − ∑ ∑ aij (2.9) ∈A j∈B with a constant C = 2 to favor two connections or C = 3 to equally favor two and four connections would be sufficient. Such constraint terms increases the number of couplings to O(N2L2), which is still a better scaling than in the original mapping. The algorithm to obtain an estimate for the TSP solution then consists of first annealing the minimally constrained 0 0 system described by HP = Hl + ηHc. If the best solution found splits into subtours, we add additional constraints given in Eq. (2.9) before repeating the annealing. This procedure is repeated until a solution consisting of a single closed tour is found.
2.2 numerical results
We analyzed the effectiveness of this algorithm by numerical simulations on problems with N = 8, 12 and 16 cities. We focus our discussion here on the main results for the case N = 12. We investigated 100 random TSPs with the cities uniformly distributed on a square. We start by testing the subtour suppression strategy using the MIQP solver of CPLEX [50]. To avoid any complications due to competing con- 18 traveling salesman problem
straints, we first analyze the performance of the outlined algorithm when choosing C = 2 for all iterations. This should enforce the correct behavior for the majority of instances where only two connections between subtours are required. Indeed, after one iteration almost all subtours require merely two connections with only one needing four, and after just two iterations the optimal TSP solution is found for 95% of these systems.
st 100 1 Iteration 4th Iteration MCS 80 1 80 10 2 60 10 103 40 104 60 5 20 10 106 0 7 2 4 6 8 10 12 10 40 probability in %
20
0 2 4 6 8 10 12 14 16 18 2 4 6 8 10 12 14 16 18 number of connections in shortest roundtrip
Figure 2.2 Distribution of the number of connections that a subtour found by annealing should have during the first and forth iteration in order to be consistent with the TSP solution. As the state after annealing is generally an excited state, the number of connections can be quite high even for problems where the ground state subtours require only very few connections - even more so the farther we are from the ground state. The legend denotes the number of Monte Carlo steps (MCS) used for annealing in both panels. The inlay in the “1st Iteration” panel shows the distribution for the ground state subtours obtained by an exact solver.
Even though iteratively adding constraints works reasonably well with exact solvers, we found that it fails with heuristic solvers, such as QA, simu- lated QA (SQA), or classical simulated annealing (SA). We show SA results but expect the observations to carry over to SQA and QA. The algorithm succeeds in finding the TSP solution only in very few cases. The reason for this failure is the limited probability of finding the absolute minimum. Unfortunately, this does not simply translate into a larger number of rep- etitions before the algorithm terminates. Contrary to the ground states, a significant number of the subtours found by annealing should have more 2.2 numerical results 19 than two connections in the TSP solution.
As can be seen in Figure 2.2, a poor annealing performance significantly reduces the chance of introducing an appropriate set of constraints. Since enforcing the wrong number of connections - that is one inconsistent with the TSP solution - during any one repetition implies that the roundtrip obtained at the end of our algorithm is not of minimal length, the success probability of our algorithm decreases exponentially with the number of iterations. In an effort to mitigate the detrimental effects resulting from the uncer- tainty about the required number of connections one could pursue several strategies. Adding a penalty function that has multiple minima, e.g., at C = 2 and C = 4 requires O(N8) four-spin couplings and is thus not likely to be implementable in the near future. Instead, one might try to choose C = 3 in order to equally favors two or four connections, given that an even number of connections is enforced. As the obtained subtours can contain a similar set of cities for several iterations, the ratio η/η0 then needs to be successively increased with each iteration; otherwise the ground state configuration corresponds to broken tours with three connections between subsets of cities. This creates an unfavorable and very rough energy land- scape, where an annealer has barely any chance of finding the ground state. A potential alternative is to use slack variables s1 ... sm, sk ∈ {0, 1}, for each subset A of m cities forming a subtour. One can then implement soft constraints by introducing energy penalties
m 2 m 2 0 00 η ∑ ∑ aij − ∑ 2ksk + η ∑ sk − 1 . i∈A j6∈A k=1 k=1
Engineering a suitable energy landscape, however, poses similar challenges, and transitions between solutions with a different number of connections can be heavily suppressed.
We thus conclude that analog quantum annealing devices are unlikely to be of interest as TSP solvers in the near future. The traveling salesman problem demonstrates many important aspects to consider in the design of both adiabatic quantum algorithms and specialized hardware. A so far under appreciated aspect is that quantum dynamics has to be an impor- tant consideration in designing the mapping of an application problem to Ising spin variables. Using transverse fields (or any other local term) for the quantum dynamics incurs an exponential slowdown in the standard 20 traveling salesman problem
faithful mapping of TSP to Ising spins, compared to efficient 2-opt updates. An alternative mapping, which avoids this slowdown and improves the dynamics, comes at the cost of requiring additional constraints to prevent a breakup into subtours. The limitation to quadratic penalty functions in current analog annealing devices constitutes a major problem. In partic- ular the need for inequality constraints presents a major hurdle for the implementation on such devices.
2.3 digital quantum annealing
Virtually all of the above mentioned issues can be remedied by a “digital” implementation on a gate-model quantum computer that simulates the time evolution of quantum annealing by splitting the propagation into m discrete time steps ∆t [52, 53]. Implementing a constraint ∑i xi = a as a m 2 2 quadratic function (∑i xi − a) requires m /2 couplers, which results in O(m2) qubits assuming limited connectivity. The same constraint can be implemented in a digital simulation as a phase rotation conditioned on whether the constraint is satisfied or not. Using just O(m) qubits this can be implemented in time O(log m) (see Figure 2.3a). With this approach the constraint (2.7) requires only O(N2) instead of O(N3) qubits and the cost for the constraint in Eq. (2.8) is O(N2). The scaling of the required number of qubits is thus quadratically improved from O(N4) to O(N2) (or from O(N2L2) to O(NL) when using a cutoff L for the number of neighboring cities considered).
A digital implementation of quantum annealing on a universal quantum computer simulating QA has several other advantages:
• Embedding the program into a specific hardware graph imposes at most linear overhead in runtime, opposed to potentially exponential slowdown of quantum tunneling due embedding into a system with low connectivity in an analog approach. • The programmability of the digital computer allows efficient imple- mentation of a large class of cost functions and penalty terms; The flexibility offered by a universal digital quantum computer offers more choices of quantum dynamics, including 2-opt moves. • All penalty terms in the cost function can be implemented much more efficiently, reducing the scaling of the number of qubits with problem size. 2.3 digital quantum annealing 21
• The inequality constraint in Eq. (2.8) can now be implemented without heavy approximations. • A more even energy landscape allows for better annealing perfor- mance. • Quantum error correction removes calibration errors.
Figure 2.3 a) The left side shows the circuit implementing an energy penalty if a certain subset of cities is disjoint from the rest (inequality constraint in Eq. (2.8)). The qubits x1 ... xm represent all possible connections between the subset and the other cities, the qubits e1..em−2 are additional ancilla qubits initialized to |0i (the graphic shows m = 6). The 2(m − 2) Toffoli gates can be executed in O(log m) time. Open circles denote conditioning on the connections xi not being part of the current tour configuration. The unitary U is a phase gate that implements the propagator corresponding to an energy penalty η0 during one step of the annealing process by 0 adding a phase exp(−iB(t)η ∆t/¯h) if the qubit is set. b) As a thought experiment, we could toy with the idea of whether it would theoretically be possible to eliminate all subtours at once. Albeit certainly not of practical value, the circuit on the right illustrates the recursion step for such a circuit. The circuit results in the ancilla qubit a1 being set if and only if there is a closed subtour of length k + 2. The red gates are necessary only to minimize the number of qubits. While this circuit illustrates the principle, using more ancillas allows one to reduce the scaling of the number of gates with system size.
We thus see digital quantum annealers as a promising route to quantum optimization, also because they allow more tailored types of quantum dy- namics to be programmed and – with error correction – solve the calibration and error problems of analog devices. We will further explore this option in Chapter 5. 3 SATFILTERS
This chapter contains content from Publication V.
Set membership testing, i.e. determining whether a specific element is a member of a given set in a fast and memory efficient way, is important for many applications, such as database searches. The usage of filters, such as the Bloom filter [54], can give tremendous improvements in terms of resource costs. In 2012, Weaver and collaborators introduced a new type of filter, called satisfiability filter [55], which are based on a specific type of Boolean satisfiability problem (SAT), namely random k-SAT problems, and can achieve a higher efficiency than other popular filters [55–57]. Satisfia- bility filters are a promising type of filters for set membership testing. The creation of a satisfiability filter relies on finding solutions to SAT problems; to construct a high-quality filter it is necessary to find disparate solutions to hard random k-SAT problems. There are many methods which can solve these SAT problems but re- cently with the advent of quantum annealing (QA) a fundamentally dif- ferent method was introduced that can potentially be leveraged for the construction of such filters. A D-Wave Two device has recently been used to construct SAT filters [58] by constucting and solving SAT problems which can be realized with two-qubit couplings. However, the chimera-graph of the D-Wave device does not allow arbitrary connections and thus restricts the types of problems that can be implemented without embedding.
In this chapter, we investigate whether quantum annealing (QA) on an arbitrary connected and completely coherent device can be advantageous for the creation of SAT filters. We compare simulated annealing, simulated quantum annealing and WalkSAT, an open-source SAT solver, in terms of their ability to find suitable k-SAT solutions. Our simulations use an efficient implementation of simulated quantum annealing (SQA), which has been shown to be indicative of the performance of stoquastic Quantum Annealing devices [23, 25, 59]. We compare the obtained SQA result to those with simulated annealing (SA) and WalkSAT (WS) [60]. Section 3.3 give a brief introduction to SA and SQA related to SAT instances and explains the measurement set-up.
22 3.1 set membership problem and filter construction 23
3.1 set membership problem and filter construction
The set membership problem is defined as follows: Given an element x ∈ D and a set Y ⊆ D, determine whether x ∈ Y. For typical applications, |Y| is very large. Y could, for example, contain all words used on a specific domain and x could be a key-word entered into a search engine. Such queries can be sped up using filters, which are mathematical objects created from the set Y. Such a filter can be queried with an element x and returns one of the following answers: Either the element is definitely not in the set or the element might be in the set and further checks have to be performed to obtain a definite answer. These additional tests may be computationally more costly. Hence, a useful filter should have a low rate of indecisive answers for elements not being in the set. Furthermore, a filter should ideally require little storage.
Let Y ∈ D be the set that should be encoded by the filter and let m denote the cardinality of Y. To construct a filter encoding the set Y, a set of k hash functions is chosen which map each element of D uniformly at random into a set of k distinct literals such that the literals form a clause of the form
Ci = li,1 ∨ li,2 ∨ · · · ∨ li,k when they are combined by logical disjunction (indicated by ’∨’). Here, li,j are non-complementary literals given by a Boolean variable (x f ) or its negation (x¯ f ), chosen from a set of n variables x1, x2,... xn. The number k of literals within a clause is called the width of the clause. Since the literals cannot be complimentary, k is also the number of variables in the clause. The set of hash functions is used to map the m elements of Y to m clauses of width k. Using logical conjunctions (indicated by ’∧’), the resulting m clauses are then combined to a random k-SAT problem of the form
C1 ∧ C2 ∧ · · · ∧ Cm
This is known as the conjunctive normal form (CNF) of the Boolean satisfia- bility problem. The problem of deciding whether a given Boolean formula can be evaluated to true by consistently assigning the values true or f alse to the appearing variables is also known as k-SAT problem. We talk about a random k-SAT problem when each of the m clauses is drawn uniformly, independently and with replacement from the set of all width k clauses [61]. The problem of deciding whether a random k-SAT problem is satisfiable was the first problem proven to be NP-complete [62] for k ≥ 3. 24 satfilters
A SAT solver is used to find s different solutions to the random k-SAT problem constructed from set Y. These solutions are stored and constitute the filter. To query the filter with an element, the same k hash functions are used to map this element to a clause of width k. If at least one of the stored solutions does not satisfy the newly created clause, the element cannot be in the set from which the solutions where created. The hash functions, however, may map to a clause that is satisfied for all solutions by chance alone, such that a positive result does not give any further information about the set membership. One can see that more calculated solutions lead to a lower probability for an element which is not in Y to pass the filter. This constitutes a trade-off because a filter should also require little storage. Thus, to make good use of the required storage, the solutions should be as independent as possible. Two solutions are considered independent if the probability that a randomly generated clause is satisfied by one solution is uncorrelated with the probability that this clause is satisfied by the other one. This implies for example that the mean pairwise Hamming distance of a set of independent solutions with n variables each is given by n/2. Finding solutions to a random k-SAT problem which qualify as independent is time consuming and sometimes might not be possible at all. Nonetheless, this calculation is a one-time effort which only has to be done when the filter is constructed.
To ensure that the stored solutions are independent, it is also possible to use s different sets of hash functions to construct s different random k-SAT problems out of the set Y. In this case, only one solution per problem has to be found. Similar to the case described before, the s solutions constitute the filter. If such a filter is queried, the same s sets of hash functions are used to map the element to s different clauses. If the clauses are satisfied by the respective solution, the element might be in the set Y. The advantage of constructing a filter this way is that each stored solution stems from a different random k-SAT problem. Therefore, they are indeed independent of each other. The disadvantage is that more hash functions and clauses have to be evaluated every time the filter is queried, which increases the ongoing costs. Since we want to investigate the effectiveness of quantum annealing for finding multiple disparate solutions to random k-SAT problems, we hence won’t discuss this approach any further and instead focus on the first approach that uses multiple solutions to the same random k-SAT problem. 3.2 quality metrics for filters 25
For a more thorough introduction of satisfiability filters, we refer the reader to Ref. [55].
3.2 quality metrics for filters
For our investigation, we assess the quality of the constructed filters by measuring two important quantities: the false positive rate and the filter efficiency. We briefly introduce those two metrics here, and direct the reader to Ref. [55] for a more detailed discussion.
3.2.1 False positive rate
The false positive rate (FPR) of a SAT filter is the probability of the filter returning an inconclusive answer (indicated by “maybe” in the equation below) when queried with an element x ∈ D, which is not in Y, i.e.
pFP = P[F(x) = maybe|x ∈ D \ Y] where F(x) is the return of the SAT filter when queried with x. Assuming that |Y| |D| – which is usually the case –, and that all stored solutions are fairly independent, it can be approximated by
pFP ≈ P[F(x) = maybe|x ∈ D] s ≈ (1 − 2−k) (3.1) where s is the number of solutions stored and k the width of the clauses of the SAT instance. While the assumption that all used solutions are indepen- dent is reasonable when the solutions stem from different SAT instances, it is less trivial when they are solutions to the same instance. However, there is experimental evidence that the approach of using different solutions to the same problem can lead to similar FPRs as truly independent solutions, provided their average Hamming distances are of similar magnitude. Finding such solutions can be costly such that the construction of the filter generally takes longer. The benefit of filters based on different solutions to the same problem are faster query times, compared to filters based on solutions to multiple instances. 26 satfilters
3.2.2 Filter efficiency
A SAT filter needs n · s bits to store s solutions with n variables each. For a filter encoding a set Y with cardinality |Y| = m that is based on s solutions to a k-SAT problem involving n variables, the filter efficiency is defined as − log p E ≡ 2 FP ≤ 1 sn/m
where pFP is the false positive rate of the filter. Using the approximation in Eq. (3.1), we can approximate the efficiency by − log (1 − 2−k) E ≈ 2 = −α log (1 − 2−k) n/m χ 2
where we have defined the clauses-to-variables-ratio αχ of the SAT instance from which the solutions were generated: number of clauses m α .= = χ number of variables n Asymptotically, the satisfiability of a random k-SAT problem is deter- mined with high probability by the clauses-to-variables-ratio; for every value of k, there exists a threshold α0(k), such that for a large number of variables, SAT instances with a clauses-to-variables-ratio αχ < α0(k) are almost certainly solvable whereas those for which αχ > α0(k) are almost surely not solvable. The threshold α0(k) is called satisfiability threshold, and in Ref. [57] was proven to be k α0(k) = 2 (ln(2) − O(k)) Looking at that threshold value, we see that the information theoretical limit (E = 1) can be reached by increasing the width k of clauses, as was shown by Weaver and collaborators [55]. Increasing k also increases the complexity of the problem, but even for a relatively small value of k = 3, a better performance compared to the constant efficiency of Bloom filters [54] (E ≤ ln(2)) can be achieved.
3.3 obtaining independent solutions
Even though it is a one one-time effort to find solutions as independent as possible during the construction of sat filters, quantities such as the false positive rate and query time heavily depend on the success of this step. We will therefore focus our effort on evaluating and comparing different methods for obtaining independent solutions for a single k-SAT instance. 3.3 obtaining independent solutions 27
3.3.1 Using annealing
For a random k-SAT instance with m clauses involving n variables, the configuration of the system is defined by an n-bit value x = (x1,..., xn), where xi ∈ {true, false} for 1 ≤ i ≤ n. We can defined a cost function
E(x) = |{Ci|Ci(x) = f alse}| i.e. the cost of a configuration is given by the number of unsatisfied clauses. Our goal is to minimize this cost function, and a configuration x with minimal energy E(x) = 0 is a solution to the SAT-problem. Annealing methods are widely used optimization heuristics for min- imizing cost functions. Their effectiveness depends on the shape of the cost function. Depending whether local minima are separated by tall and narrow peaks, or flat and wide ones, quantum fluctuations as leveraged by quantum annealing or the thermal fluctuation used by classical annealing may be more suitable to escape local minima while exploring the problem space [63–65].
Solution on Quantum Annealing Devices
Since filters are mainly used in big data contexts, their size can be quite large, depending on the size of the set |Y| and the required FPR. To illustrate this, we give an example for a SAT filter encoding a set Y with |Y| = 216 elements: The 216 elements result in m = 216 clauses. If the required FPR is 1 pFP = 4 , a 4-SAT filter needs to store s ≈ 22 (independent) solutions [55]. If the targeted efficiency is given by E = 0.75 each solution involves n ≈ 8136 variables. The filter therefore stores ≈ 22 · 8136 bits. A 5-SAT filter achieving the same efficiency and FPR needs to store s ≈ 44 (independent) solutions with n ≈ 4002 variables.
To solve a SAT problem by quantum annealing, each variable is identified with a logical qubit. The couplings in the target Hamiltonian are chosen so that its energy is equal to the number of unsatisfied clauses for that assignment. The ground state of the target Hamiltonian will then provide a solution to the SAT instance. An implementation on a quantum annealing device needs more physical qubits (referred to as spins in the context of spin glass systems such as the D-Wave device) than there are boolean variables due to the embedding needed to accommodate for the limited connectivity of physical devices. An implementation on current hardware is therefore not yet possible. However, 28 satfilters
the rapid development in this field might lead to physical implementations in the near future.
The way in which the problem space is explored when using quantum annealing is fundamentally different than when using classical heuristics. An open question is hence whether the kind of solutions that are found by quantum annealing is significantly different from the solutions produced by classical means. If this is the case, then quantum annealing could potentially be leveraged to construct high quality SAT-filters, potentially in combination with other methods. Combining different methods may be desirable to obtain a broader variety of solutions, since there is evidence that quantum annealing only finds few of the ground states for problems with high degeneracy (see Ref. [66] for a theoretical prediction based on quantum Monte Carlo simulations and Ref. [67] for a recent experimental verification on a D-Wave 2X quantum annealing device). In order to explore these possibilities, we resort to numerical methods to gain some insight.
Solution by Simulated Quantum Annealing
Quantum annealing of spin glasses in a transverse magnetic field can be mimicked on a classical computer using quantum Monte Carlo (QMC) simulations. Previous work [25] shows a similar scaling of characteristic tunneling rates for SQA and unitary evolution, and suggests that SQA can indeed to a certain extent predict the performance of a physical quan- tum annealer. Additionally D-wave quantum annealers where empirically shown to scale similarly to SQA for random spin glass problems [59] and a numerical partitioning problem [23]. Even though a discretization with ∆τ = 1 might produce better optimiza- tion results, in order to simulate the real quantum behavior, computations should be performed in the continuous time limit ∆τ → 0 [68]. An alter- native is to use an algorithm directly working with an infinite number of time slices, as in [69], providing the same results as QMC using sufficiently small time-steps. As Ref. [68] shows, previous expectations of quantum speedup for QA in two-dimensional spin glasses [70, 71] were due to performing simulated quantum annealing (SQA) in the non-physical limit, which elegantly ex- plains why such a speed-up could not be observed in experiments [72, 73]. For our analysis, SQA is performed using discrete time SQA close enough to the continuous time limit to guarantee similar results to a continuous 3.3 obtaining independent solutions 29 time algorithm and a physical quantum annealer.
For the purpose of our investigation, we allows for arbitrary couplings between two or more spins without requiring any additional embedding. This gives us the flexibility to probe whether there could be benefits to leveraging quantum annealing without any adverse effects due to hardware limitations. We perform simulated quantum annealing on an Ising spin glass with n distinct spins, where up to k of them couple together. The used target Hamiltonian is
H = − J σz ··· σz − · · · − J σz σz − J σz − C P ∑ i1,...,ik i1 ik ∑ i1,i2 i1 i2 ∑ i1 i1 i1<··· r where C is a constant with no physical relevance, and σij is the Pauli r- operator, for r ∈ {x, y, z}. For the driver Hamiltonian, we use a transversal field Γ(t) ≥ 0, which induces single-spin flips, i.e. transitions between the states | ↑i and | ↓i for each spin individually: H (t) = −Γ(t) σx .(3.2) D ∑ i1 i1 Annealing parameters For each problem specification and each given number of attempted updates (Monte Carlo steps, abbreviated as MCS), the annealing parameters for SA (the initial inverse temperature β0 and the final inverse temperature β1) are optimized to maximize the average number of different results for a set of instances when running multiple times on each instance. The number of MCS is chosen such that an increase would not lead to a significantly larger number of different solutions found by any of the tested solvers. This value is chosen the same for SA and SQA. In the case of SQA, one MCS corresponds to one attempted update per physical spin (i.e. a certain site on all replicas). The SQA parameters (β0 = β1 as well as the initial and final transversal field Γ0 and Γ1) are optimized the same way, ensuring that M is big enough to be close to the physical (i.e the continuous time) limit. At the beginning ( ) > | | | | of the annealing schedule Γ 0 J... , Jij , so that HQA is dominated by HD and the system will be in the easily attainable ground state of HD with all spins pointing along x-direction, that is each variable is in a superposition between true and false. Then, the transverse magnetic field is slowly decreased, reducing the tunneling rates while the system 30 satfilters explores the configuration space. For our simulations we decreased the magnetic field linearly. At the end of the annealing schedule Γ(tend) = 0 and HQA(tend) = HP, such that the system freezes in a configuration that provides a guess for a solution of the SAT instance. Between Monte Carlo steps the transverse field is decreased linearly. The temperature is held constant during the annealing process. Open boundary conditions in imaginary time are used since they better reproduce the scaling with system size of a coherent quantum annealer [25, 74] and also improve convergence. When the scaling in problem size is considered, the annealing parameters are optimized to minimize the computational effort needed for finding a solution with a 99% chance. 3.3.2 Using SAT-solvers WalkSAT (WS) [60] is an efficient open source SAT solver, also used in [55]. For our analysis version 51 from Ref. [75] was used. It was run with the flags -printonlysol=TRUE, -out output_filename, -seed SEED. To obtain multiple solutions, SEED is set to a different positive natural number for every run on the same SAT instance. 3.4 numerical results In order to construct a filter from solutions to a single k-SAT instance, it is necessary to find multiple and disparate solutions to that instance (see Section 3.1). The number of existing solutions and how different they are depends on how close to the satisfiability threshold the SAT instance is. We investigate both aspects for a fixed filter efficiency. We focus on what kinds of solutions are found by each solver rather than considering the runtime of each solver. We consider at least 20 randomly generated SAT instances for each data set, i.e. for each value of k and clauses-to-variables-ratio. All solvers are run multiple times on each instance, after optimizing both SQA and SA parameters. The relevant quantities are calculated for each instance and then averaged over all instances to get the estimate for the entire problem class. Error bars indicate the standard error of the mean. 3.4 numerical results 31 3.4.1 Diversity of solutions We first investigate how many different solutions are found for a given number of repetitions of various solvers. Figure 3.1 shows the average num- ber of different solutions found when running each solver 2000 times with optimized annealing parameters on a randomly generated 4-SAT instance with n = 50 variables and m = 403 clauses. If independent solutions could be assumed, this clauses-to-variables-ratio would lead to an efficiency of E ≈ 0.75. The number of found solutions is averaged over 20 randomly generated instances, where the value for each instance is reweighted by dividing it through the number of solutions found by SA within 2000 runs. From Figure 3.1 it can be seen that the effort needed for a new solution increases with the number of already found solutions. This assumes that no further techniques such as blocking clauses (see Section 3.4.3) are employed to prevent repeated solutions. The number of different solutions found by SA is bigger than the number of different solutions found by SQA. Using WS naively, by just providing different random seeds, it finds the smallest number of different solutions. a) 1.0 SQA SA 0.8 WS 0.6 0.4 % of SA obtained solutions 0.2 0.0 0 500 1000 1500 2000 number of runs Figure 3.1 Average number of unique solutions obtained, when running each solver 2000 times on each instance. The number of different solutions obtained is normalized by the maximum number of different solutions found by SA within 2000 runs (about 1300). The left panel shows the average over 20 randomly generated 4-SAT instances with n = 50 variables and a clauses-to-variables-ratio of αχ4 ≈ 8.06. The right panel shows the average over 20 randomly generated 5-SAT instances with n = 50 variables and a clauses-to-variables-ratio of αχ5 ≈ 16.36 (leading to the same efficiency of E ≈ 0.75). 32 satfilters We performed the same measurements for 3-SAT and 5-SAT instances at a clauses-to-variables-ratio which would lead to the same efficiency of E ≈ 0.75, if independent solutions could be assumed. In the k = 3 case, the ranking among the solvers is similar. For k = 5, SQA finds the smallest number of different solutions, especially close to the satisfiability threshold. 3.4.2 Quality of solutions The next question to answer is whether the solutions found by the different solvers are of the same quality for SAT filter construction. The quality of found solutions is determined by the FPR of a filter constructed from these solutions, which we show in Figure 3.2. In Figure 3.2a) we choose the solutions randomly. Figure 3.2b) shows a subset of solutions with particularly large Hamming distance between each other1. a) b) Figure 3.2 Average FPR of a filter constructed from solutions found by each solver within 2000 runs. The average is taken over 20 randomly generated 4-SAT instances with n = 50 variables and a clauses-to-variables-ratio of αχ4 ≈ 8.06. a) The solutions used to construct the filter are chosen randomly from the found solutions. b) The solutions used to construct the filter are chosen so that they maximize the average pairwise Hamming distance between the chosen solutions. The dotted cyan line shows the theoretical FPR for a filter constructed from truly independent solutions. 1 In order to obtain this subset, a random solution was chosen initially. Afterwards, solution by solution, the solution with the highest average pairwise Hamming distance to the already chosen solutions was added to the set. 3.4 numerical results 33 The results show that the solutions found by SQA lead to a higher FPR than the solutions found by SA and WS. If more than ten solutions are chosen, all solvers provide a significantly worse FPR than truly independent solutions. The corresponding filter efficiencies are shown in Figure 3.3. Consistent with the higher FPR, the efficiency of a filter constructed using SQA is lower than the efficiency of a filter constructed using SA or WS. Figure 3.3 also shows that only for a small number of solutions, the efficiency of the constructed filter is comparable to the efficiency resulting from independent solutions, and only if they are specifically selected. The maximum number of solutions that still leads to an efficiency comparable to truly independent solutions, is about five for SQA and between seven and ten for SA and WS. This result indicates that combining the two techniques suggested in [55] might be useful: Instead of using either multiple sets of hash-functions and one solution per instance or one hash-function and many solutions of the resulting instance, it might be preferred to take multiple sets of hash functions and still find multiple solutions per instance. a) b) Figure 3.3 Average efficiency of a filter constructed from solutions found by each solver within 2000 runs. The average is taken over 20 randomly generated 4-SAT instances with n = 50 variables and a clauses-to-variables-ratio of αχ4 ≈ 8.06. a) The solutions used to construct the filter are chosen ran- domly from the found solutions. b) The solutions used to construct the filter are chosen so that they maximize the average pairwise Hamming distance between the chosen solutions. The dotted cyan line shows the theoretical FPR for a filter constructed from truly independent solutions. 34 satfilters It is worth pointing out that the closer to the satisfiability threshold we are, the less solutions exist, and the less likely found solutions are to be independent. As long as no further techniques like blocking clauses are employed (see Section 3.4.3), the approach to look for many solutions of one instance is generally not useful when targeting a high efficiency. In order to obtain a high efficiency the instances have to be generated too close to the satisfiability threshold for many sufficiently disparate solutions to be found. A FPR as predicted by assuming independent solutions is hence not achievable. The worse performance of SQA in terms of finding disparate solutions becomes more apparent for these instances, which only have a small number of solutions. a) b) Figure 3.4 Pairwise Hamming distance between different solutions randomly picked from the solutions obtained by each solver within 2000 runs. The Hamming distance was calculated for up to 200 different solutions found for each of 20 randomly generated 4-SAT instances with n = 50 variables and a clauses-to-variables-ratio of αχ4 ≈ 8.06. An average was taken over the instances. a) Shows the average pairwise Hamming dis- tance between the picked solutions. b) Shows the maximum pairwise Hamming distance between the picked solutions. The reason for the differences in the FPRs can be further investigated by looking at the average or maximum Hamming distance between solutions. The average and maximum Hamming distance, taken pairwise between different solutions found by each solver is shown in Figure 3.4, averaged over 20 instances. The result shows that the subset of solutions found by SQA have a much higher overlap than the subset of solutions found by SA and WS, resulting in a higher FPR of the SQA solutions. Without imposing 3.4 numerical results 35 further requirements, the approximation in Eq. (3.1) is worse for SQA than for the other solvers. Furthermore, we did not find evidence that SQA finds solutions that feature a particularly large Hamming distance to the set of solutions found by the other solvers. SQA, SQA SA, SA WS, WS SQA, SA SQA, WS SA, WS 15.6 18.9 20.2 17.9 19.1 19.7 ±1.4 ±0.6 ±0.2 ±1.1 ±0.3 ±0.4 Table 3.1 Average Hamming distance between two solutions of a randomly gen- erated 4-SAT problem, found by different solvers. The value provided is the average taken over 20 randomly generated instances with n = 50 and αχ4 ≈ 8.06. The solutions were randomly chosen among the solu- tions found within 800 runs by the respective solvers. Truly independent solutions would have an average Hamming distance of 25. Analogous plots and evaluations for k = 3 and k = 5 leads to the same rankings and conclusions. a) b) Figure 3.5 Probability for a) WS and b) SA to find the SQA-hardest and SQA-easiest solutions. The x-axis indicates the percentage of easiest and hardest SQA- found solutions, running SQA 2000 times on 20 randomly generated 4-SAT instances with n = 50 variables and a clauses-to-variables-ratio of αχ4 ≈ 8.06. An average was taken over the instances. 36 satfilters Figure 3.6 Probability for a) WS and b) SA to find the SQA-hardest and SQA- easiest solutions, running SQA 1000 times on 20 randomly generated 5-SAT instances with n = 50 variables and a clauses-to-variables-ratio of αχ5 ≈ 16.36 (leading to the same efficiency of E ≈ 0.75). a) b) Figure 3.7 Probability for a) WS and b) SA to find the SQA-hardest and SQA- easiest solutions, running SQA 1000 times on 20 randomly generated 5-SAT instances with n = 48 variables and a clauses-to-variables-ratio of αχ5 ≈ 19.6 (leading to a higher efficiency of E ≈ 0.9). One instance, for which SQA did not find any solution, was taken out of the statistic. This clause-to-variable ratio is close to the satisfiability threshold α5 ≈ 21.11 of 5-SAT [76]. Hence, many of the randomly generated instances only feature a small number of existing solutions. Of our 20 instances, the mean number of existing solutions was 40, and two instances had less than ten. 3.4 numerical results 37 Finally, we investigate whether the solutions which are easily found by SQA, are particularly unlikely to be found by SA and WS. If SQA could easily find solutions that are hard to find for the other solvers, it could be used to contribute complementary solutions. As can be seen above, we find no evidence for that. 3.4.3 Scaling with problem size Lastly, we compare the solvers abilities to find one solution to a given SAT problem. This is relevant if the filter is constructed by finding one solution to several different instances and might also be indicative of the solvers per- formance when blocking clauses [77] are used. A blocking clause is a clause which evaluates to true for all variable assignments except for some specific assignments, which are not desired. Adding a blocking clause to a random k-SAT problem removes all solutions with the undesired assignments of variables from the set of solutions. Blocking clauses can give a positive contribution to the energy if the configuration has already been found. Therefore, any solution found to the new problem, is necessarily different from the solutions previously obtained. It is also possible to add clauses which not only block a certain solution, but certain variable assignments. By blocking certain variable assignments it can be ensured that any solution to the new problem has a certain Hamming distance to the solutions found previously. Such procedures on the other hand make it less likely for a solver to still be able to find solutions. We compare SQA to SA for the task of finding any one solution to a SAT instance, since the natural similarity between SA and SQA makes it easy to compare their performance. Looking at the average computational effort needed to find a solution to a random 4-SAT problem with 99% we see no evidence that SQA requires a lower computational effort for all tested problem sizes, consistent with the findings of Refs. [78–81]. There is no indication either that SQA scales better with the number of variables than SA for random SAT instances and keeping the clause-to-variable-ratio constant. We therefore conclude that SQA, for the tested instances and using a linear schedule with a stoquastic driver Hamiltonian, is not superior to SA, also when it comes to finding one solution to a SAT instance. 38 satfilters 3.5 possible improvements Our results indicate that SQA finds a smaller number of different solutions than SA and that the found solutions are generally less disparate than the solutions found by the other solvers, which leads to a higher FPR and lower efficiency of filters constructed from them. We find no evidence that the solutions found by SQA are particularly hard to find for the other solvers tested. Furthermore, our results show no scaling advantage of SQA over SA, regarding the computational effort required to find one solution with fixed probability. SQA performs worse than other solvers on any metric that was investigated. Based on prior work, our expectations are that the observed behaviors and properties would also apply for annealing on analog quantum comput- ing devices, such that we do not expect any benefit of quantum annealing for the construction of SAT filters. The presented simulations are best-case scenarios for physical devices in the sense that even though we restricted our simulations to a simple enough driver Hamiltonian, we still assumed hardware with arbitrary connectivity and multi-spin couplings along the z-direction. We expect the performance to further decrease when the prob- lem is mapped to a specific hardware graph and few-qubit couplers. We did not investigate nonlinear annealing schedules, which might im- prove the efficiency of QA and SQA. Improvements to annealing by con- structing an adaptive schedule are discussed in the next chapter. Similarly, a non-stoquastic driver Hamiltonian may be beneficial. As theoretically discussed in Ref. [66] and indicated by recent experimental results [67] using a D-Wave 2X quantum annealing machine, QA needs more complex (non-stoquastic) driving Hamiltonians in order to find degenerate ground states with equal probability. Furthermore, Ref. [66] predicts that QA can indeed find all degenerate ground states, if quantum transitions between them are possible. This can be done by modifying the driver Hamiltonian in Eq. (3.2), so that it induces quantum transitions between all states: Hnew(t) = −Γ(t) σx + σx σx + σx σx σx + ... D ∑ i1 ∑ i1 i2 ∑ i1 i2 i3 i1 This chapter contains content from Publication VI. Numerical comparisons between the performance of quantum and classi- cal annealing for two-dimensional (2D) Ising spin glass systems have not shown any quantum speedup [68, 72]. The lack of speedup in this case may be due to the energy landscape of 2D spin glasses, with shallow but broad barriers that are easier to thermally surmount than to tunnel through [73]. Extending such simulations to three dimensions we find that whether classical or quantum annealing exhibits better performance depends on the specific choice of annealing schedules. An apparent advantage of one method may simply be due to a bad or suboptimal choice of annealing schedule for the other method. To achieve a fair comparison between classical annealing, quantum an- nealing, and other optimization methods, it is hence paramount that the parameters and schedules are properly optimized, otherwise wrong conclu- sions regarding the efficiency are drawn. In this chapter, we therefore introduce a heuristic approach for the op- timization of annealing schedules for quantum annealing by generalizing heuristics used to to optimize classical annealing, and apply it to 3D Ising spin glass problems. We demonstrated that the constructed nonlinear sched- ule is resistant against sub-optimally chosen initial values for the transverse field Γ0 on random 3D Ising spin glasses. The proposed heuristic further- more leads to improvements over naïve schedules and allows for a fair comparison of classical versus quantum annealing. 4.1 adaptive schedule In classical annealing the control parameter is the temperature, whose change over time is given by an annealing schedule. If the change is constant we call it a linear schedule and the update rule for the temperature is given by β(t) = β0 + λ˜ t, 39 40 annealing schedules or in a discretized form βk = β0 + λk = βk−1 + λ, where βk is the inverse temperature at the k-th update sweep. For such a lin- ear schedule, only the initial and final values of β may need to be optimized, with intermediate values that are obtained by linear interpolation. Instead of guessing a schedule, one can determine optimized adaptive schedules by using a heuristic algorithm to optimize the schedule in such a way that interesting regions where large changes to configurations may occur (e.g. close to phase transitions) are passed through more slowly. An indicator for the size of a temperature step can be the specific heat d2 d C = k β2 log Z = −k β2 hEi,(4.1) V B dβ2 B dβ where Z is the partition function. CV can be calculated from the fluctuation- dissipation theorem as d β2C ≡ σ ≡ − hEi = hE2i − hEi2.(4.2) V dβ In order to achieve a constant decrease in energy at each step, one aims for this quantity to be constant throughout the annealing process: dhEi = −λ, dt where the scale factor λ sets the targeted change in energy. The quantity hEi is only implicitly dependent on time through its dependence on the temperature, such that one can perform the chain rule dhEi dβ = −λ. dβ dt Inserting Eq. (4.2) one obtains dβ σ (β) = λ, dt which can be discretized to obtain the an update rule for the adaptive schedule λ βk+1 = βk + . σk 4.1 adaptive schedule 41 It can be observed that this schedule traverses slower in regions close to the phase transition, where CV is large. In order to derive a similarly optimized schedule for quantum annealing we use a quantity akin to the specific heat in classical systems. Starting from the quantum mechanical partition function Z(s) = tr e−βH(s) we first derive an adaptive schedule for the Hamiltonian H = sHP + (1 − s) HD.(4.3) Substituting the derivative with respect to β by one with respect to the quantum control parameter s in Eq. (4.1) we define 1 d2 C(s) = log (Z) , β ds2 which will determine the annealing schedule. Performing the derivatives we obtain d C(s) = − hH − H i ds P D s 2 2 = β h(HP − HD) is − hHP − HDis Note, that the expectation values in this equation are dependent on the parameter s. Similar to the classical procedure, we aim for a constant change in time: ds C (s) = λ. dt Thus we obtain an update rule for the quantum annealing schedule: 1 λ sk+1 = sk + q β 2 2 h(HP − HD) is − hHP − HDis Instead of following the “cross-over” schedule given in Eq. (4.3), one could also keep HP fixed and only vary the transverse field Γ: H = HP + (1 − s) HD.(4.4) 42 annealing schedules In that case, a similar derivation leads to the simpler rule 1 λ s + = s + . k 1 k p 2 βΓ0 1 − hσxis Γ0 corresponds to the initial transverse field of the annealing schedule and an appropriate value, depending on the couplings and field strengths in the target Hamiltonian, usually needs to be determined beforehand for the annealing to be effective. Using an adaptive schedule, our numerical simu- lations presented in the next section indicate resilience towards suboptimal choices of Γ0. Note that for classes of random instances, the idea is to not optimize the schedule for each individual instance but instead optimize over the average of a limited set of instances, and use the average of this set to define an adaptive schedule for the entire class. 4.2 calculation of observables To evaluate the expectation value of the SQA counterpart of the specific heat Cq, we need to compute the value of hσxi. A derivation on how to calculate this observable using the path integral Monte Carlo method can be found in [82] and will be reproduced in the following. Generally an observable can be evaluated as: 1 hOi = tr Oe−βH Z Thus the expectation value of hσxi will evaluate to the following: x −βH ∑σ hσi|σ e |σii hσ i = i i i h | −βH| i ∑σi σi e σi M β β βH M H Introducing the Trotter decomposition e = e with τ = M and adding identity operators will give h | x −βH| i ∑σi σi σi e σi hσii = . k h | −βH| i ∑σi σi e σi x But there is freedom to choose for which Trotter slice to evaluate σi . So one can also take the average of all these choices: 1 M hσii = hσii ∑ k M k=1 4.3 numerical results 43 Now with the introduction of a small error of order O(τ2) one can split −τ(H + σx) −τH −τ σx e p Γ ∑i i = e p e Γ ∑i i and then find for the expectation value k+1 −τ σx ! 1 M hσ |σxe Γ ∑i i |σki x = i i i hσi i ∑ + M k 1 −τΓ ∑i σi k k=1 hσi |e |σi i x x Using h↑ |eaσ | ↑i = cosh(a) and h↑ |eaσ | ↓i = sinh(a) one can obtain the expectation value of the Pauli spin x operator: M 1 k k+1 x si si hσi i = ∑ tanh (−τΓ) M k=1 For the more specific schedule relying on the Hamiltonian N i H = Hp + Γ(t) ∑ σx i=0 one can get an expectation value for Cq by the following formula: 2 1 d 2 Cq = log(Z) = βΓ 1 − hσxi β dΓ2 Finally one should note that any constant pre-factor in the measurement of Cq will cancel further on when λ is determined by fixing the number of MCS. 4.3 numerical results While the presented adaptive schedule is derived using the system Hamilto- nian given in Eq. (4.3) for the sake of generality, a more common annealing procedure [68, 71] is the one given by Eq. (4.4), where the problem Hamil- tonian is kept at constant strength while the transverse field is decreased from Γ0 to 0. For the remainder of this chapter, we will hence use the latter schedule, obtained by an ensemble average of hσxis over a set of 1000 random, uniformly distributed 3D Ising spin glass instances on a simple cubic lattice. We investigate 3D spin glasses because of the argument [73] that random 3D Ising spin glasses are more likely to profit from quantum tunneling since they exhibit a non-zero temperature phase transition [83]. In Figure 4.1a we show the expectation value of the denominator of the step size, averaged over 1000 instances. In the beginning, when the 44 annealing schedules transverse field is strong, the system is close to an eigenstate of σx and the problem Hamiltonian does not influence the dynamics much. Thus, the step size is large. Figure 4.1b shows the linear and the adaptive schedules for optimized and unoptimized initial field Γ0. Determining the best choice of the starting value Γ0 for a linear schedule yields Γ0 = 1.5. The final value of the trans- verse field needs to be Γ = 0 in order to recover the problem Hamiltonian at the end of the annealing process. Consistent with Figure 4.1a one can see that the adaptive schedules are slower in regions, where the transverse field is weak. 35 7 opt linear opt adaptive unopt linear unopt adaptive 30 6 25 5 2