Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave),...

37
CONTACT Corporate Headquarters 3033 Beta Ave Burnaby, BC V5G 4M9 Canada Tel. 604-630-1428 US Oce 2650 E Bayshore Rd Palo Alto, CA 94303 Email: [email protected] www.dwavesys.com Overview This document introduces the D-Wave quantum computer, provides some key background information on how the system works, and ex- plains how to construct a simple problem that the system can solve. Getting Started with the D-Wave System USER MANUAL 2020-05-23 D-Wave User Manual 09-1076A-Y Copyright © D-Wave Systems Inc.

Transcript of Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave),...

Page 1: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

CONTACT

Corporate Headquarters3033 Beta AveBurnaby, BC V5G 4M9CanadaTel. 604-630-1428

US O�ce2650 E Bayshore RdPalo Alto, CA 94303

Email: [email protected]

www.dwavesys.com

Overview

This document introduces the D-Wave quantum computer, providessome key background information on how the system works, and ex-plains how to construct a simple problem that the system can solve.

Getting Started with the D-Wave System

USER MANUAL

2020-05-23

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 2: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Notice and DisclaimerD-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure that the information in this document is accurate and up to date, but errors mayoccur. NONE OF D-WAVE SYSTEMS INC., its subsidiaries and affiliates, OR ANY OF ITS RESPEC-TIVE DIRECTORS, EMPLOYEES, AGENTS, OR OTHER REPRESENTATIVES WILL BE LIABLEFOR DAMAGES, CLAIMS, EXPENSES OR OTHER COSTS (INCLUDING WITHOUT LIMITATIONLEGAL FEES) ARISING OUT OF OR IN CONNECTION WITH THE USE OF THIS DOCUMENTOR ANY INFORMATION CONTAINED OR REFERRED TO IN IT. THIS IS A COMPREHENSIVELIMITATION OF LIABILITY THAT APPLIES TO ALL DAMAGES OF ANY KIND, INCLUDING(WITHOUT LIMITATION) COMPENSATORY, DIRECT, INDIRECT, EXEMPLARY, PUNITIVE ANDCONSEQUENTIAL DAMAGES, LOSS OF PROGRAMS OR DATA, INCOME OR PROFIT, LOSS ORDAMAGE TO PROPERTY, AND CLAIMS OF THIRD PARTIES.

D-Wave reserves the right to alter this document and other referenced documents without noticefrom time to time and at its sole discretion. D-Wave reserves its intellectual property rights in andto this document and its proprietary technology, including copyright, trademark rights, industrialdesign rights, and patent rights. D-Wave trademarks used herein include D-Wave®, LeapTM quan-tum cloud service, OceanTM, AdvantageTM quantum system, D-Wave 2000QTM, D-Wave 2XTM, andthe D-Wave logos (the D-Wave Marks). Other marks used in this document are the property of theirrespective owners. D-Wave does not grant any license, assignment, or other grant of interest in orto the copyright of this document, the D-Wave Marks, any other marks used in this document, orany other intellectual property rights used or referred to herein, except as D-Wave may expresslyprovide in a written agreement. This document may refer to other documents, including documentssubject to the rights of third parties. Nothing in this document constitutes a grant by D-Wave of anylicense, assignment, or any other interest in the copyright or other intellectual property rights of suchother documents. Any use of such other documents is subject to the rights of D-Wave and/or anyapplicable third parties in those documents.

Page 3: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Contents

1 Welcome to D-Wave 11.1 What We Do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.2.1 Hardware Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.2 Software Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 What is Quantum Annealing? 52.1 Applicable Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 How Quantum Annealing Works in D-Wave Systems . . . . . . . . . . . . . . . . 62.3 Underlying Quantum Physics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3.1 The Hamiltonian and the Eigenspectrum . . . . . . . . . . . . . . . . . . 82.3.2 Annealing in Low-Energy States . . . . . . . . . . . . . . . . . . . . . . . 92.3.3 Evolution of Energy States . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.4 Annealing Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Problem Formulation: Key Concepts 113.1 Objective Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.2 Problem Formulations: Ising and QUBO . . . . . . . . . . . . . . . . . . . . . . . 12

3.2.1 Ising Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2.2 QUBO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2.3 Notation Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.3 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

4 D-Wave QPU Architecture: Chimera 154.1 Chimera Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154.2 Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154.3 Chains and Minor Embedding . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

5 De�ning a Simple Problem 195.1 De�ne the Objective Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195.2 Problem Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

6 Using QUBOs to Represent Constraints 236.1 Build a Truth Table for the Objective Function . . . . . . . . . . . . . . . . . . . 236.2 Develop a QUBO Favoring States with One True . . . . . . . . . . . . . . . . . . 246.3 Convert the QUBO into a Graph . . . . . . . . . . . . . . . . . . . . . . . . . . 25

7 Minor-Embedding a Problem onto the Chimera Graph 277.1 Create a Chain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277.2 Choose the Unit Cells to Work With . . . . . . . . . . . . . . . . . . . . . . . . . 277.3 Map the Problem Parameters to the Working Graph . . . . . . . . . . . . . . . . 297.4 Unembed the Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

8 Submitting a Problem to the D-Wave System 318.1 Submit the Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

8.1.1 Manual Minor-Embedding . . . . . . . . . . . . . . . . . . . . . . . . . . 318.1.2 Automated Minor-Embedding . . . . . . . . . . . . . . . . . . . . . . . . 32

Page 4: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

8.2 Check the Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328.3 Increase the Number of Reads . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 5: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

CHAPTER 1

WELCOME TO D-WAVE

I’m not happy with all the analyses that go with just the classical theory, because Natureisn’t classical, dammit, and if you want to make a simulation of nature, you’d bettermake it quantum mechanical, and by golly it’s a wonderful problem, because it doesn’tlook so easy.

It’s not a Turing machine, but a machine of a different kind.

—Richard Feynman, 1981

1.1 What We DoDespite the incredible power of today’s supercomputers, many complex computing prob-lems cannot be addressed by conventional systems. The huge growth of data and our needto better understand everything from the universe to our own DNA leads us to seek newtools that can help provide answers. Quantum computing is the next frontier in computing,providing an entirely new approach to solving the world’s most difficult problems.

While certainly not easy, much progress has been made in the field of quantum computingsince 1981, when Feynman gave his famous lecture at the California Institute of Technol-ogy. Still a relatively young field, quantum computing is complex and different approachesare being pursued around the world. Today, there are two leading candidate architecturesfor quantum computers: gate model and quantum annealing. In gate-model quantumcomputing, the aim is to control and manipulate the evolution of the quantum states overtime—a difficult challenge, especially at large scales, because quantum systems are incred-ibly delicate.

At D-Wave, our approach is quantum annealing, which harnesses the natural evolution ofquantum states: we initialize the system in a delocalized state, we gradually turn on thedescription of the problem we wish to solve, and quantum physics allows the system to fol-low these changes. The configuration at the end corresponds to the answer we are tryingto find. Quantum annealing is implemented in D-Wave systems as a single quantum algo-rithm, and this scalable approach to quantum computing has enabled us to create quantumprocessing units (QPUs) with more than 2000 quantum bits (qubits)—far beyond the state ofthe art for gate-model quantum computing. Furthermore, D-Wave’s hybrid solvers, whichuse a combination of classical and quantum resources, accept problems greatly exceedingthe size of the QPU.

D-Wave has been developing various generations of our “machine of a different kind,” touse Feynman’s words, since 1999. We are the world’s first commercial quantum computercompany.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

1

Page 6: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

1.2 System Overview

1.2.1 Hardware OverviewThe D-Wave system contains a QPU that must be kept at a temperature near absolute zeroand isolated from the surrounding environment in order to behave quantum mechanically.The system achieves these requirements as follows:

• Cryogenic temperatures, achieved using a closed-loop cryogenic dilution refrigeratorsystem. The QPU operates at temperatures below 15 mK.

• Shielding from electromagnetic interference, achieved using a radio frequency(RF)–shielded enclosure and a magnetic shielding subsystem.

Figure 1.1: D-Wave system.

The D-Wave QPU (Figure 1.2) is a lattice of tiny metal loops, each of which is a qubit or acoupler. Below temperatures of 9.2 kelvin, these loops become superconductors and exhibitquantum-mechanical effects.

The D-Wave 2000Q QPU has up to 2048 qubits and 6016 couplers. To reach this scale, ituses 128,000 Josephson junctions, which makes the D-Wave 2000Q QPU by far the mostcomplex superconducting integrated circuit ever built.

For details on the topology of the QPU, see the D-Wave QPU Architecture: Chimera section.

Figure 1.2: D-Wave QPU.

2 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 7: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

Note: For more details on the physical system, including specifications and essential safetyinformation required for anyone who accesses the hardware directly, see the D-Wave Quan-tum Computer Operations manual, available from D-Wave.

1.2.2 Software Environment

Solver APIUsers interact with the D-Wave system through a web user interface (UI), and using clientsthat communicate with the Solver API (SAPI).1 The SAPI components are responsible foruser interaction, user authentication, and work scheduling. In turn, SAPI connects to back-end servers that send problems to and return results from the QPU and hybrid solvers. SeeFigure 1.3 for a simplified view of the D-Wave software environment.

Figure 1.3: D-Wave software environment.

1 In the D-Wave system, a solver is simply a resource that runs a problem. Some solvers interface to the QPU;others leverage CPU and GPU resources.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

3

Page 8: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

Software clients communicate with SAPI using the REST/HTTPS protocol and allow youto:

• Query available solvers and solver properties

• Submit problems

• Cancel previously submitted problems

• Retrieve problem status

• Fetch results if successful

• Retrieve errors if unsuccessful

Clients use a traditional request/response paradigm, where the application code runs ona client system, and the client commands are translated to REST/HTTP calls and thentransmitted to the server. See Solver API REST Web Services Developer Guide for details.

Leap™ Quantum Cloud ServiceLeap™ is the quantum cloud service from D-Wave Systems.

Leap brings quantum computing to the real world by providing real-time cloud access toour systems. Through Leap, you can connect to D-Wave QPUs and hybrid solvers, rundemos and interactive coding examples, contribute your ideas to our GitHub repositoriesof open-source code, use the prebuilt cloud-based IDE, and join the growing conversationin our community of like-minded users.

Sign up for Leap here: https://cloud.dwavesys.com/leap.

Ocean SDKD-Wave’s Python-based software development kit (SDK), Ocean, makes application devel-opment for D-Wave solvers more rapid and efficient. Open-sourced on GitHub, Oceanfacilitates collaborative projects that can leverage quantum and hybrid resources. Seehttps://github.com/dwavesystems to access the Ocean SDK, and https://docs.ocean.dwavesys.com for the associated documentation.

4 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 9: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

CHAPTER 2

WHAT IS QUANTUM ANNEALING?

This section explains what quantum annealing is and how it works, and introduces theunderlying quantum physics that governs its behavior. For more in-depth information onquantum annealing in D-Wave systems, see Technical Description of the D-Wave QuantumProcessing Unit.

2.1 Applicable ProblemsQuantum annealing processors naturally return low-energy solutions; some applicationsrequire the real minimum energy (optimization problems) and others require good low-energy samples (probabilistic sampling problems).

Optimization problems. In an optimization problem, we search for the best of many possi-ble combinations. Optimization problems include scheduling challenges, such as “ShouldI ship this package on this truck or the next one?” or “What is the most efficient route atraveling salesperson should take to visit different cities?”

Physics can help solve these sorts of problems because we can frame them as energy mini-mization problems. A fundamental rule of physics is that everything tends to seek a mini-mum energy state. Objects slide down hills; hot things cool down over time. This behavioris also true in the world of quantum physics. Quantum annealing simply uses quantumphysics to find low-energy states of a problem and therefore the optimal or near-optimalcombination of elements.

Sampling problems. Sampling from many low-energy states and characterizing the shapeof the energy landscape is useful for machine learning problems where we want to build aprobabilistic model of reality. The samples give us information about the model state for agiven set of parameters, which can then be used to improve the model.

Probabilistic models explicitly handle uncertainty by accounting for gaps in our knowl-edge and errors in data sources. Probability distributions represent the unobserved quan-tities in a model (including noise effects) and how they relate to the data. The distributionof the data is approximated based on a finite set of samples. The model infers from theobserved data, and learning occurs as it transforms the prior distribution, defined beforeobserving the data, into the posterior distribution, defined afterward. If the training pro-cess is successful, the learned distribution resembles the distribution that generated thedata, allowing predictions to be made on unobserved data. For example, when trainingon the famous MNIST dataset of handwritten digits, such a model can generate imagesresembling handwritten digits that are consistent with the training set.

Sampling from energy-based distributions is a computationally intensive task that is anexcellent match for the way that the D-Wave system solves problems; that is, by seeking

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

5

Page 10: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

low-energy states.

2.2 How Quantum Annealing Works in D-WaveSystemsThe quantum bits—also known as qubits—are the lowest energy states of the supercon-ducting loops that make up the D-Wave QPU. These states have a circulating current anda corresponding magnetic field. As with classical bits, a qubit can be in state of 0 or 1; seeFigure 2.1. But because the qubit is a quantum object, it can also be in a superposition ofthe 0 state and the 1 state at the same time. At the end of the quantum annealing process,each qubit collapses from a superposition state into either 0 or 1 (a classical state).

Figure 2.1: A qubit’s state is implemented as a circulating current, shown clockwise for 0 and counterclockwise for 1, with a corresponding magnetic field.

The physics of this process can be shown (visualized) with an energy diagram as in Figure2.2. This diagram changes over time, as we can see in (a), (b), and (c). To begin, there is justone valley (a), with a single minimum. The quantum annealing process runs, the barrier israised, and this turns the energy diagram into what is known as a double-well potential (b).Here, the low point of the left valley corresponds to the 0 state, and the low point of theright valley corresponds to the 1 state. The qubit ends up in one of these valleys at the endof the anneal.

Figure 2.2: Energy diagram changes over time as the quantum annealing process runs and a bias isapplied.

Everything else being equal, the probability of the qubit ending in the 0 or the 1 state isequal (50 percent). We can, however, control the probability of it falling into the 0 or the1 state by applying an external magnetic field to the qubit (c). This field tilts the double-well potential, increasing the probability of the qubit ending up in the lower well. The

6 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 11: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

programmable quantity that controls the external magnetic field is called a bias, and thequbit minimizes its energy in the presence of the bias.

The bias term alone is not useful, however. The real power of the qubits comes whenwe link them together so they can influence each other. This is done with a device called acoupler. A coupler can make two qubits tend to end up in the same state—both 0 or both 1—or it can make them tend to be in opposite states. Like a qubit bias, the correlation weightsbetween coupled qubits can be programmed by setting a coupling strength. Together, theprogrammable biases and weights are the means by which a problem is defined in theD-Wave system.

When we use a coupler, we are using another phenomenon of quantum physics called en-tanglement. When two qubits are entangled, they can be thought of as a single object withfour possible states. Figure 2.3 illustrates this idea, showing a potential with four states,each corresponding to a different combination of the two qubits: (0,0), (0,1), (1,1), and (1,0).The relative energy of each state depends on the biases of qubits and the coupling betweenthem. During the anneal, the qubit states are potentially delocalized in this landscape be-fore finally settling into (1,1) at the end of the anneal.

Figure 2.3: Energy diagram showing the best answer.

As we have seen, each qubit has a bias and qubits interact via the couplers. When formu-lating a problem, users choose values for the biases and couplers. The biases and couplingsdefine an energy landscape, and the D-Wave quantum computer finds the minimum en-ergy of that landscape: this is quantum annealing.

As we add qubits, systems get increasingly complex. With two qubits, we have four pos-sible states over which to define an energy landscape. At three qubits, we have eight. Foreach qubit we add, we double the number of states over which we can define the energylandscape: the number of states goes up exponentially with the number of qubits.

In summary, we start with a set of qubits, each in a superposition state of 0 and 1. Theyare not yet coupled. When they undergo quantum annealing, the couplers and biases areintroduced and the qubits become entangled. At this point, the system is in an entangledstate of many possible answers. By the end of the anneal, each qubit is in a classical statethat represents the minimum energy state of the problem, or one very close to it. All of thishappens in D-Wave systems in a matter of microseconds.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

7

Page 12: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

2.3 Underlying Quantum PhysicsThis section discusses some concepts essential to understanding the quantum physics thatgoverns the D-Wave quantum annealing process.

2.3.1 The Hamiltonian and the EigenspectrumA classical Hamiltonian is a mathematical description of some physical system in terms ofits energies. We can input any particular state of the system, and the Hamiltonian returnsthe energy for that state. For most non-convex Hamiltonians, finding the minimum energystate is an NP-hard problem that classical computers cannot solve efficiently.

As an example of a classical system, consider an extremely simple system of a table andan apple. This system has two possible states: the apple on the table, and the apple on thefloor. The Hamiltonian tells us the energies, from which we can discern that the state withthe apple on the table has a higher energy than that when the apple is on the floor.

For a quantum system, a Hamiltonian is a function that maps certain states, called eigen-states, to energies. Only when the system is in an eigenstate of the Hamiltonian is its energywell defined and called the eigenenergy. When the system is in any other state, its energy isuncertain. The collection of eigenstates with defined eigenenergies make up the eigenspec-trum.

For the D-Wave system, the Hamiltonian may be represented as

Hising = −A(s)2

(∑

iσ̂(i)x

)︸ ︷︷ ︸

Initial Hamiltonian

+B(s)

2

(∑

ihiσ̂

(i)z + ∑

i>jJi,jσ̂

(i)z σ̂

(j)z

)︸ ︷︷ ︸

Final Hamiltonian

(2.1)

where σ̂(i)x,z are Pauli matrices operating on a qubit qi, and hi and Ji,j are the qubit biases and

coupling strengths.1

The Hamiltonian is the sum of two terms, the initial Hamiltonian and the final Hamiltonian:

• Initial Hamiltonian (first term)—The lowest-energy state of the initial Hamiltonian iswhen all qubits are in a superposition state of 0 and 1. This term is also called thetunneling Hamiltonian.

• Final Hamiltonian (second term)—The lowest-energy state of the final Hamiltonianis the answer to the problem that we are trying to solve. The final state is a classicalstate, and includes the qubit biases and the couplings between qubits. This term isalso called the problem Hamiltonian.

In quantum annealing, we begin in the lowest-energy eigenstate of the initial Hamiltonian.As we anneal, we introduce the problem Hamiltonian, which contains the biases and cou-plers, and we reduce the influence of the initial Hamiltonian. At the end of the anneal, weare in an eigenstate of the problem Hamiltonian. Ideally, we have stayed in the minimumenergy state throughout the quantum annealing process so that—by the end—we are inthe minimum energy state of the problem Hamiltonian and therefore have an answer tothe problem we want to solve. By the end of the anneal, each qubit is a classical object.

1 Nonzero values of hi and Ji,j are limited to those available in the working graph; see the D-Wave QPU Archi-tecture: Chimera chapter.

8 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 13: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

2.3.2 Annealing in Low-Energy StatesA plot of the eigenenergies versus time is a useful way to visualize the quantum annealingprocess. The lowest energy state during the anneal—the ground state—is typically shownat the bottom, and any higher excited states are above it; see Figure 2.4.

Figure 2.4: Eigenspectrum, where the ground state is at the bottom and the higher excited states areabove.

As an anneal begins, the system starts in the lowest energy state, which is well separatedfrom any other energy level. As the problem Hamiltonian is introduced, other energylevels may get closer to the ground state. The closer they get, the higher the probabilitythat the system will jump from the lowest energy state into one of the excited states. Thereis a point during the anneal where the first excited state—that with the lowest energy apartfrom the ground state—approaches the ground state closely and then diverges away again.The minimum distance between the ground state and the first excited state throughout anypoint in the anneal is called the minimum gap.

Certain factors may cause the system to jump from the ground state into a higher energystate. One is thermal fluctuations that exist in any physical system. Another is running theannealing process too quickly. An annealing process that experiences no interference fromoutside energy sources and evolves the Hamiltonian slowly enough is called an adiabaticprocess, and this is where the name adiabatic quantum computing comes from. Because noreal-world computation can run in perfect isolation, quantum annealing may be thoughtof as the real-world counterpart to adiabatic quantum computing, a theoretical ideal. Inreality, for some problems, the probability of staying in the ground state can sometimes besmall; however, the low-energy states that are returned are still very useful.

For every different problem that you specify, there is a different Hamiltonian and a dif-ferent corresponding eigenspectrum. The most difficult problems, in terms of quantumannealing, are generally those with the smallest minimum gaps.

2.3.3 Evolution of Energy StatesFigure 2.5 shows the evolution of the energy functions over time while physical temper-ature remains constant. This chart plots Energy

h in GHz, where h is the Planck constant,2

against s, the normalized anneal fraction, an abstract parameter ranging from 0 to 1. The A(s)curve is the tunneling energy and the B(s) curve is the problem Hamiltonian energy at s.

2 6.6× 10−34 joule-seconds

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

9

Page 14: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

A linear anneal sets s = t/t f , where t is time and t f is the total time of the anneal. At t = 0,A(0) � B(0), which leads to the quantum ground state of the system where each spin isin a delocalized combination of its classical states. As the system is annealed, A decreasesand B increases until t f , when the final state of the qubits represents a low-energy solution.

At the end of the anneal, the Hamiltonian contains the only B(s) term. It is a classicalHamiltonian where every possible classical bitstring (that is, list of qubit states that areeither 0 or 1) corresponds to an eigenstate and the eigenenergy is the classical energy ob-jective function we have input into the system.

Figure 2.5: Annealing functions A(s), B(s). Annealing begins at s = 0 with A(s)� B(s) and ends ats = 1 with A(s)� B(s). Data shown are representative of D-Wave 2X systems.

2.4 Annealing ControlsWe continue to understand more deeply the fine details of quantum annealing and de-vise better controls for it. The D-Wave 2000Q system includes features that give users pro-grammable control over the annealing schedule, which enable a variety of searches throughthe energy landscape. These controls can improve both optimization and sampling perfor-mance for certain types of problems, and can help investigate what is happening partwaythrough the annealing process.

For more information about the available annealing controls, see Technical Description of theD-Wave Quantum Processing Unit.

10 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 15: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

CHAPTER 3

PROBLEM FORMULATION: KEY CONCEPTS

This section introduces some key concepts you must understand before you can formulatea problem for the D-Wave QPU: objective functions, Ising model, quadratic unconstrainedbinary optimization problems (QUBOs), and graphs.

3.1 Objective FunctionsTo understand how to express a problem in a form that the D-Wave system can solve, wemust first develop an objective function, which is a mathematical expression of the energy ofa system as a function of binary variables representing the qubits. In most cases, the lowerthe energy of the objective function, the better the solution. Sometimes any low-energystate is an acceptable solution to the original problem; for other problems, only optimalsolutions are acceptable. The best solutions typically correspond to the global minimumenergy in the solution space; see Figure 3.1.

Figure 3.1: Energy of objective function.

Consider quadratic functions, which have one or two variables per term:

D = Ax + By + Cxy (3.1)

where A, B, and C are constants. Single variable terms—Ax and By, for example—arelinear and act to bias the variable. Two-variable terms—Cxy, for example—are quadraticwith a relationship between the variables.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

11

Page 16: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

3.2 Problem Formulations: Ising and QUBOTwo formulations we look at for objective functions are found in the Ising model and inQUBO problems. Conversion between these two formulations is trivial.

3.2.1 Ising ModelThe Ising model is traditionally used in statistical mechanics. Variables are “spin up” (↑)and “spin down” (↓), states that correspond to +1 and −1 values. Relationships betweenthe spins, represented by couplings, are correlations or anti-correlations. The objectivefunction expressed as an Ising model is as follows:

Eising(sss) =N

∑i=1

hisi +N

∑i=1

N

∑j=i+1

Ji,jsisj (3.2)

where the linear coefficients corresponding to qubit biases are hi, and the quadratic coeffi-cients corresponding to coupling strengths are Ji,j.

3.2.2 QUBOQUBO problems are traditionally used in computer science. Variables are TRUE andFALSE, states that correspond to 1 and 0 values.

A QUBO problem is defined using an upper-diagonal matrix Q, which is an N x N upper-triangular matrix of real weights, and x, a vector of binary variables, as minimizing thefunction

f (x) = ∑i

Qi,ixi + ∑i<j

Qi,jxixj (3.3)

where the diagonal terms Qi,i are the linear coefficients and the nonzero off-diagonal termsare the quadratic coefficients Qi,j.

This can be expressed more concisely as

minx∈{0,1}n

xTQx. (3.4)

In scalar notation, used throughout most of this document, the objective function expressedas a QUBO is as follows:

Equbo(ai, bi,j; qi) = ∑i

aiqi + ∑i<j

bi,jqiqj. (3.5)

Note: Quadratic unconstrained binary optimization problems—QUBOs—are uncon-strained in that there are no constraints on the variables other than those expressed in Q.

3.2.3 Notation ComparisonThe transformation between Ising and QUBO is

s = q2− 1. (3.6)

12 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 17: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

Figure 3.2 compares Ising and QUBO notation and related terminology.

Figure 3.2: Notation conventions.

3.3 GraphsObjective functions can be represented by graphs. A graph comprises a collection of nodes(representing variables) and the connections between them (edges).

For example, to represent two variables in a quadratic equation,

H(a, b) = 5a + 7ab− 3b, (3.7)

we need two nodes, a and b, with biases of 5 and −3 and a connection between them witha strength of 7; see Figure 3.3.

Figure 3.3: Two-variable objective function.

On the D-Wave system, a node is a qubit and an edge is a coupler.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

13

Page 18: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

14 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 19: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

CHAPTER 4

D-WAVE QPU ARCHITECTURE: CHIMERA

The layout of the D-Wave QPU is critical to translating a QUBO or Ising objective functioninto a format that a D-Wave system can solve. We know that binary objective functions canbe represented as graphs; this chapter explains the mapping between a problem graph andthe QPU topology.

Note: Although Ocean software automates this mapping, you should understand it if youare directly programming the QPU because it has implications for the problem-graph sizeand solution quality. If you are sending your problem to a Leap quantum-classical hybridsolver, the solver handles all interactions with the QPU.

The D-Wave QPU is a lattice of interconnected qubits. While some qubits connect to othersvia couplers, the D-Wave QPU is not fully connected. Instead, the qubits interconnect inan architecture known as Chimera.

4.1 Chimera GraphThe Chimera architecture comprises sets of connected unit cells, each with four horizontalqubits connected to four vertical qubits via couplers. Unit cells are tiled vertically andhorizontally with adjacent qubits connected, creating a lattice of sparsely connected qubits.See Figure 4.1.

The notation CN refers to a Chimera graph consisting of an NxN grid of unit cells. TheD-Wave 2000Q QPU supports a C16 Chimera graph: its 2048 qubits are logically mappedinto a 16x16 matrix of unit cells of 8 qubits.

In a D-Wave QPU, the set of qubits and couplers that are available for computation isknown as the working graph. The yield of a working graph is typically less than the totalnumber of qubits and couplers that are fabricated and physically present in the QPU.

4.2 ConnectivityA unit cell can be rendered as either a cross or a column; see Figure 4.2.

In each of these renderings, we can see that there are two sets of four qubits. Each qubit inone set of four is connected to all qubits in the other set, but no qubits connect to the otherswithin its own set of four. Within a unit cell, the qubits have bipartite connectivity.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

15

Page 20: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

Figure 4.1: A 3x3 Chimera graph, denoted C3. Qubits are arranged in 9 unit cells.

16 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 21: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

Figure 4.2: Cross or column layout of qubits in a unit cell.

4.3 Chains and Minor EmbeddingThe nodes and edges on the graph that represents an objective function translate to thequbits and couplers in Chimera. Each logical qubit, in the graph of the objective function,may be represented by one or more physical qubits. The process of mapping the logicalqubits to physical qubits is known as minor embedding.

Note: While tools for minor embedding are available in the Ocean SDK, you can also dothis manually as explained in the Minor-Embedding a Problem onto the Chimera Graph chapter.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

17

Page 22: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

18 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 23: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

CHAPTER 5

DEFINING A SIMPLE PROBLEM

One type of problem that we expect the D-Wave system to be good at solving is an optimiza-tion of binary variables problem. Binary variables can only have values 0 (NO, or FALSE) or1 (YES, or TRUE). These are problems that answer questions like: “Should a package beshipped on this truck?”

Conventional computers—even the biggest supercomputers—can be thought of as beingcomposed of logic gates, simple decision devices that produce outputs based on their inputs.While the D-Wave system is not based on gates, it so happens that a particular gate formsa good first optimization problem for the system to solve.

The XNOR (Exclusive NOR) gate returns TRUE output only if both inputs are the same(both TRUE or both FALSE), and FALSE if the inputs are different (one TRUE and oneFALSE):

• We have two binary inputs, a and b

• If a = 0 and b = 0, output 1

• If a = 1 and b = 1, output 1

• Otherwise, output 0

5.1 De�ne the Objective FunctionConsider a simple two-qubit problem, in which we want the qubits to have the same valueafter annealing. There are four possible final states of the qubits, as is apparent in thefollowing table

q0 q10 00 11 01 1

and we want the D-Wave system to favor the states (0,0) and (1,1) and penalize the states(0,1) and (1,0). We need to define an objective function that will do so.

In an objective function, the qubits are the variables. The biases and strengths are the coef-ficients on the linear and quadratic terms. The objective function for a two-qubit problemhas three terms, two linear and one quadratic. The linear coefficients correspond to qubitbiases, and the quadratic coefficients to coupler strengths.

The objective function we need is written as follows:

f (sss) = a1q1 + a2q2 + b1,2q1q2 (5.1)

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

19

Page 24: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

where sss is a vector of the variables q = [qi, q2], a1 and a2 are the qubit biases, q1 and q2 arethe binary variables representing qubits 1 and 2, and b1,2 is the strength of the coupler.

We now set a1 and a2 and b1,2 to satisfy our original goal. First, notice that when q1 and q2both equal 0—state 1, written as (0,0)—the value of the objective function is 0, and we haveno other adjustable parameters. Since we want to favor this state, the minimum energy,corresponding to the ground state, should equal 0.

We also want to penalize states 2 and 3, (0,1) and (1,0), relative to state 1 (0,0). One way todo this is to assign a bias of 0.1 to qubits 1 and 2 by setting both a1 and a2 to 0.1:

q0 q1 Objective Value0 0 00 1 0.11 0 0.11 1 0.2 + b1,2

Remember we also want to favor state 4 (1,1) along with state 1 (0,0). One way to do this isto set the coupler strength to b1,2 = −0.2. The resulting objective function is

f (sss) = 0.1q1 + 0.1q2 − 0.2q1q2, (5.2)

and the table of possible outcomes is now as shown below.

q0 q1 Objective Value0 0 00 1 0.11 0 0.11 1 0

Thus, when we run many anneals—also known as samples or reads—of this problem on theD-Wave system, we expect the ground states (0,0) and (1,1) to be strongly favored over theexcited states (0,1) and (1,0) in the returned results.

Here are the results from running this problem on a D-Wave 2000Q system 1000 times, toobtain a sample of 1000 solutions:

Energy State Occurrences0 (0,0) 5550 (1,1) 4430.1 (0,1) 10.1 (1,0) 1

If we run this problem again, we expect the numbers associated with energy 0 to vary, butto stay near the number 500 (50% of the samples). In a perfect system, we do not expecteither of the ground states to be dominant over the other, in a statistical sense; however,each run will yield different numbers.

Notice that—although the vast majority of the results are (0,0) and (1,1)—if we call theQPU enough times, we occasionally see some (0,1) and (1,0) solutions. For more complexQUBOs, this process of repeatedly solving the same problem to get a range of answers iscalled sampling and has powerful applications in many areas including machine learning.

20 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 25: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

5.2 Problem ScalingConsider another 2-qubit problem, this time with different values assigned to the qubitbiases (0.5) and coupler strength (-1). Notice that this problem is scaled uniformly from theprevious (multiplied by 5):

f (sss) = 0.5q1 + 0.5q2 − q1q2 (5.3)

This problem, too, favors the states (0,0) and (1,1), but the objective value for the excitedstates is now 0.5 as opposed to 0.1 in the first problem; see below.

q0 q1 Objective Value0 0 00 1 0.51 0 0.51 1 0

Because the values for the excited states are different from those in the previous problem,resulting in a larger energy gap between the ground state and the excited states (0.5 versus0.1), we might expect to see different results this time. In other words, when there is a largergap between the ground state and the excited states, we expect that the excited states areharder to reach and therefore less favored.

Recall that in the first problem, we saw a tiny fraction of excited states in the returnedresults. Contrary to what we might expect, if we run both problems many times, we gen-erally observe the same results despite the (apparent) larger gap in the second problem.

This result is caused by a feature of the D-Wave system known as auto-scaling. Each QPUhas an allowed range of values for the biases and strengths of a and b. Unless we explicitlydisable auto-scaling, the D-Wave software adjusts the a and b values of a problem to takethe entire (a, b) range available before sending it to the QPU. As a result, by the time thesetwo problems are run, they present the same (a, b) values to the QPU, and therefore thereturned solutions are effectively the same. When the energies and objective values arereported at the end of the runs, we are using the pre-scaling values.

To test this, let’s run 1000 reads of the first problem (in which the objective value for theexcited states is 0.1) with auto-scaling disabled. This time, we see results like those shownbelow.

Energy State Occurrences0 (0,0) 2720 (1,1) 5360.1 (0,1) 1240.1 (1,0) 68

When we run 1000 reads of the second problem (in which the objective value for the excitedstates is 0.5) with auto-scaling disabled, we see results such as those shown below.

Energy State Occurrences0 (0,0) 4360 (1,1) 5630.5 (0,1) 10.5 (1,0) 0

These results illustrate that without scaling, the first problem has a smaller gap than thesecond, and returns more samples of the excited states.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

21

Page 26: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

22 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 27: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

CHAPTER 6

USING QUBOS TO REPRESENT CONSTRAINTS

We can use QUBOs to define simple constraints that are important building blocks forlarger, more complex problems. The exactly-one-true constraint is a Boolean satisfiabilityproblem in which we want to know, given a set of variables, when exactly one variableequals 1 (is TRUE).

For example, when optimizing a traveling salesperson’s route through a series of cities, weneed a constraint forcing the salesperson to be in exactly one city at each stage of the trip:a solution that puts the salesperson in two or more places at once is invalid.

Figure 6.1: The traveling salesperson problem is an optimization problem that can be solved usingexactly-one-true constraints. Map data © 2017 GeoBasis-DE/BKG (© 2009), Google.

This chapter describes how to construct a simple exactly-one-true constraint in a form thatthe D-Wave system can solve. It covers the following steps:

1. Start with the objective: in this case, start with an exactly-one-true constraint with 3variables and build a truth table that satisfies this objective.

2. Develop a QUBO that favors the desired states and penalizes other states.

3. Convert the QUBO into a graph.

6.1 Build a Truth Table for the Objective FunctionConsider a simple example: Given three variables a, b, and c, we want to know whenexactly one variable is 1. (That is, when only one of a, b, and c equals 1; the other two are0.) This translates into the following truth table:

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

23

Page 28: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

a b c Exactly 10 0 0 FALSE1 0 0 TRUE0 1 0 TRUE1 1 0 FALSE0 0 1 TRUE1 0 1 FALSE0 1 1 FALSE1 1 1 FALSE

6.2 Develop a QUBO Favoring States with OneTrueWe want to find a function E(a, b, c) that is at a minimum when this objective is true. Wecan express this as

a + b + c = 1 (6.1)or as

a + b + c− 1 = 0. (6.2)The problem with the second expression above is that when a, b, and c are all 0, we get aresult of −1, which is a lower energy than the TRUE states. The solution is to square theoriginal equation:

(a + b + c− 1)2. (6.3)Taking a closer look at the squared expression,

E(a, b, c) = (a + b + c− 1)2 (6.4)

we can see that because the variables are binary (0 or 1),

a2 = a (6.5)

our objective function becomes the quadratic equation

E(a, b, c) = 2ab + 2ac + 2bc− a− b− c + 1 (6.6)

where the energy of the function E(a, b, c) is the value of the objective function.

Let’s look at the truth table again, this time adding a column to show the energy. Note thatthe lowest energy states are those that match our exactly-one-true constraint. Rememberthat the better the solution, the lower the energy.

a b c Exactly 1 Energy0 0 0 FALSE 11 0 0 TRUE 00 1 0 TRUE 01 1 0 FALSE 10 0 1 TRUE 01 0 1 FALSE 10 1 1 FALSE 11 1 1 FALSE 4

When expressed as a QUBO, we obtain

E(x0, x1, x2) = 2x0x1 + 2x0x2 + 2x1x2 − x0 − x1 − x2 + 1. (6.7)

24 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 29: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

6.3 Convert the QUBO into a GraphThe QUBO energy function can be represented by the triangular graph shown in Figure6.2. Each binary variable becomes a node biased with its linear coefficient. Each quadraticterm becomes an edge between the nodes.

Figure 6.2: Triangular graph showing biased nodes and edges.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

25

Page 30: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

26 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 31: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

CHAPTER 7

MINOR-EMBEDDING A PROBLEM ONTO THECHIMERA GRAPH

In this chapter, we show how to minor-embed the QUBO created in the previous chapterinto a Chimera graph. Minor embedding often requires chains, which are described here.A solution received from the QPU can be unembedded by reversing the embedding steps.

Note: This example is intended to walk you through the minor-embedding and unem-bedding process for a simple problem so that you understand how it works. D-Wave hasautomatic embedding and unembedding tools available to streamline this process and ifyou are submitting your problem to a Leap quantum-classical hybrid solver, the solverhandles all interactions with the QPU. For more information, see the Ocean software doc-umentation.

7.1 Create a ChainTo determine how a triangular graph fits on the Chimera graph, we need to take a closerlook at the Chimera structure shown in Figure 7.1. Notice that there is no way to set up 3qubits in a closed loop to achieve the triangle graph configuration of Figure 6.2. However,we can make a closed loop of 4 qubits using, say, qubits 0, 1, 4, and 5.

To fit the 3-qubit loop into a 4-sided structure, we create a chain of 2 physical qubits thatwill represent a single variable; see Figure 7.2. In this case, we chain qubit 0 and qubit 5 torepresent variable b.

The strength of the coupler between q0 and q5, which we want to represent variable b, mustbe set to correlate the qubits strongly (discussed next), so that in most optimal solutions,q0 = q5 = b. The mapping from variables to qubits is known as minor embedding.

7.2 Choose the Unit Cells to Work WithAs explained in the D-Wave QPU Architecture: Chimera chapter, the subset of the Chimeragraph accessible to users is the working graph. Before embedding a problem on the work-ing graph, review the physical layout of the QPU to understand which qubits and couplersare absent from the fabric and therefore which unit cells are good choices.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

27

Page 32: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

Figure 7.1: Chimera unit cell.

Figure 7.2: Embedding a triangular graph into Chimera by using a chain.

28 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 33: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

7.3 Map the Problem Parameters to the WorkingGraphNow, we translate the work we did in the previous step to map the problem to the actualworking graph of the physical QPU. We already know which variables we want to mapto which qubit, and we know the node biases and edge strengths from our original graph.Node biases translate to qubit biases for the qubits that represent variables a and c. See thetables below.

Qubit 0 5 4 1Variable b b a cBias ? ? -1 -1

Coupler (0,4) (5,0) (4,1) (1,5)Strength 2 ? 2 2

But what about the 2 qubits that represent variable b and the coupling strength betweenthem? We need a strong negative coupler to chain qubits 0 and 5 thereby create a singlelogical qubit with the connectivity we need. We also need to add to the existing qubitvalues to compensate for the negative coupling we are adding.1

This process requires a few steps:

1. Evenly split the bias of −1 from variable b between q0 and q5. Now the bias of these2 qubits is −0.5.

2. Choose a strong negative coupling strength for the chain between q0 and q5. In thisexample, we arbitrarily choose −3 as a coupling strength because it is a strongervalue than the other couplers around it and is negative, which forces the 2 qubits tobe equal.

3. We now need to add 1.5 to each bias of q0 and q5 to compensate for the −3 we addedin step 2. Now the bias for both q0 and q5 is 1.

4. Finally, we normalize the entire graph to fit within the physical bounds of the systemby dividing by all values by 3 so that the largest coupler strength is −1.

Our resulting values are as follows, with the chained qubits having a strong negative cou-pling (−1):2

Qubit 0 5 4 1Variable b b a cBias 0.33 0.33 -0.33 -0.33

Coupler (0,4) (5,0) (4,1) (1,5)Strength 0.667 -1 0.667 0.667

The problem can be sent to the QPU for solution.

1 In the Ising model, we can introduce a bias on the quadratic term without changing the ground state of theproblem. For a QUBO problem, however (as we have here), changing the bias on the quadratic term changes theground state unless we compensate by adding biases (0.5 of the quadratic bias) to each of the two linear terms.

2 Some solvers support an extended J range to allow for even stronger couplings. For more information onextended J ranges and related controls, see Technical Description of the D-Wave Quantum Processing Unit.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

29

Page 34: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

7.4 Unembed the SolutionAfter the QPU has solved the exactly-one-true problem and returned a sample of solutionsto the embedded problem, those solutions must be unembedded to obtain solutions to theoriginal problem.

Possible returned values for our problem are:

• q0 = 1

• q5 = 1

• q4 = 0

• q1 = 0

Reverse the embedding process to get the solution to our original problem:

• a = q4 = 0

• b = q0, q5 = 1

• c = q1 = 0

And this gives us one of the three expected solutions:

(a, b, c) = (0, 1, 0).

Other possible solutions are (1, 0, 0) and (0, 0, 1).

30 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 35: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

CHAPTER 8

SUBMITTING A PROBLEM TO THE D-WAVE SYSTEM

This section shows what it looks like to use the Ocean software to submit an exactly-one-true problem and output the states returned. It assumes that you have already defined aproblem that can be expressed on the working graph; see the preceding sections to see howto get to this point.

Before you can submit a problem to the system, you must have an account and an APItoken; visit Leap to sign up for an account and get your token.

Note: The example that follows assumes that the requisite information for problem sub-mission through SAPI has been configured. This is typically done as a first step when youinstall the Ocean SDK. For more information, including Ocean SDK installation instruc-tions and detailed examples, see the Ocean software documentation.

8.1 Submit the ProblemWhen you submit a problem, you can either minor-embed it onto the Chimera topologymanually, or use the Ocean tools to determine a minor-embedding automatically for you.

8.1.1 Manual Minor-EmbeddingBecause we previously worked out an embedding for a system with the necessary qubitspresent, we can directly set qubits on the QPU. In the Automated Minor-Embedding section,we use an Ocean software tool to automate the minor-embedding so we can submit theproblem using the original QUBO variables.

>>> from dwave.system.samplers import DWaveSampler

>>> # Set Q for the minor-embedded problem QUBO

>>> qubit_biases = {(0, 0): 0.3333, (1, 1): -0.333, (4, 4): -0.333, (5, 5): 0.333}

>>> coupler_strengths = {(0, 4): 0.667, (0, 5): -1, (1, 4): 0.667, (1, 5): 0.667}

>>> Q = dict(qubit_biases)

>>> Q.update(coupler_strengths)

>>> # Sample once on a D-Wave system and print the returned sample

>>> response = DWaveSampler().sample_qubo(Q, num_reads=1)

>>> print(next(response.samples()))

{0: 1, 1: 0, 4: 0, 5: 1}

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

31

Page 36: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

Note: Because the yield of a working graph is typically less than the total number of qubitsand couplers that are fabricated and physically present in a QPU, we must first verify thatthe qubits we selected are active. For example, to check the qubits in the first unit cell:

>>> print(DWaveSampler().nodelist[0:8])

[0, 1, 2, 3, 4, 5, 6, 7]

Likewise for the selected couplers. If any are inactive, we can use a different unit cell.

8.1.2 Automated Minor-EmbeddingThe Ocean software can accept problems defined with the QUBO or Ising variables byheuristically finding a minor-embedding.

>>> from dwave.system.samplers import DWaveSampler

>>> from dwave.system.composites import EmbeddingComposite

>>> # Set Q for the problem QUBO

>>> linear = {('x0', 'x0'): -1, ('x1', 'x1'): -1, ('x2', 'x2'): -1}

>>> quadratic = {('x0', 'x1'): 2, ('x0', 'x2'): 2, ('x1', 'x2'): 2}

>>> Q = dict(linear)

>>> Q.update(quadratic)

>>> # Minor-embed and sample 1000 times on a default D-Wave system

>>> response = EmbeddingComposite(DWaveSampler()).sample_qubo(Q, num_reads=1000)

>>> for sample, energy, num_occurrences in response.data():

... print(sample, "Energy: ", energy, "Occurrences: ", num_occurrences)

{'x0': 0, 'x1': 0, 'x2': 1} Energy: -1.0 Occurrences: 254

{'x0': 0, 'x1': 1, 'x2': 0} Energy: -1.0 Occurrences: 408

{'x0': 1, 'x1': 0, 'x2': 0} Energy: -1.0 Occurrences: 337

{'x0': 1, 'x1': 1, 'x2': 0} Energy: 0.0 Occurrences: 1

Again in the results of 10000 reads, we see that the lowest energy occurs for the 3 validstates for our problem. Although 4 unique states are returned, the lowest energy occurs forthe 3 valid states, which are the most frequent solution.

8.2 Check the SolutionLet’s take a look at the solution, mapping it back to the variables in our original problem.We have a valid solution to the exactly-one-true problem: a and c are FALSE; b is TRUE.Both of the chained qubits, 0 and 5, return the same value.

Variables b c a bQubit 0 1 4 5Returned Values 1 0 0 1

8.3 Increase the Number of ReadsHere, we increase the number of reads to 10000. Increasing the number of reads usuallyreturns more variation in the returned solutions.

32 D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

Page 37: Getting Started with the D-Wave System€¦ · Notice and Disclaimer D-Wave Systems Inc. (D-Wave), its subsidiaries and affiliates, makes commercially reasonable ef-forts to ensure

Getting Started with the D-Wave System

>>> response = DWaveSampler().sample_qubo(Q, num_reads=1000)

>>> for (sample, energy, num) in response.data():

... print(sample, "Energy: ", energy, "Occurrences: ", num)

{0: 1, 1: 0, 4: 0, 5: 1} -0.33370000000000005 322

{0: 0, 1: 0, 4: 1, 5: 0} -0.33300000000000013 340

{0: 0, 1: 1, 4: 0, 5: 0} -0.333 335

{0: 0, 1: 0, 4: 1, 5: 1} 0.0 1

{0: 1, 1: 1, 4: 0, 5: 1} 0.00030000000000002247 1

{0: 0, 1: 1, 4: 1, 5: 0} 0.0010000000000000009 1

In the results of 10000 reads, we can see that the lowest energy occurs for the 3 valid statesfor our problem. Although there are only 3 valid answers to our 3-variable exactly-one-true problem, 6 unique states are returned. The lowest energy occurs for the 3 valid states,which are by far the most frequent solution. Returning a range of solutions is useful forsampling problems.

D-Wave User Manual 09-1076A-YCopyright © D-Wave Systems Inc.

33