**The QPath Blog**

**The QPath approach for Quantum Annealing**

**Annealing as a foreign concept in computing science.**

**Theory with practice.**

How frequently do you find the dichotomy about theory vs practice whenever you consult technical or scientific literature, attend a webinar or even a lecture at the University? I think it is a misconception, a partial point of view.

Let me introduce a short example to support my idea. Since so many years ago, in glass industry, there is a process that consists in warming a glass and, then, a slow cooling driven by a time step protocol. Why we want to do that? Well, in the case of glass pieces,a physical-chemistry property is modified: the material adopts a different molecular structure that prevents spontaneous breakage. The technique is called annealing.

We can try a more theoretical description. A perturbation of a system followed by a controlled trajectory to the equilibrium may allow to visit a new stable state that could be more interesting for our purposes.

Annealing technique was probably initially applied in material industry before the development of a thermodynamic theory that explains the phenomena at a molecular level. Later, the improvement of the annealing processes in industry was possible due a theory that explains which are and how to tune the critical parameters involved.

So, both theory and practice are like the two faces of the same coin. There is a constant interaction between these two approaches of reality as a synergy that lets us to change our world and make it more comfortable for living.

During the interaction between theory and practice, it is common that, in an abstraction stage in order to develop a theory, a migration of concepts among different disciplines occurs. Returning to the example presented above, annealing is a warming-cooling protocol applied in industries such as the glass production, but also a computational technique applied in theoretical chemistry (simulated annealing), as well as a process that takes place at a hardware level in quantum computing devices (quantum annealing). Thus, the annealing considered here is a technique in the field of computing science inspired by computational chemistry and, in the origin, by chemistry applied to the industry. This article will focus on what is quantum annealing, how works the first commercial quantum annealer, what we code, and what QPath offers in this regard.

**Quantum annealing for optimization**

Have you ever heard about entropy? I think so. Entropy is the driven force that establishes a directionality in the evolution of a physical system, a “movement towards”.

Have you ever heard about energy? Certainly sure! Energy is the counterpart of entropy. All the physical systems tend to evolve forward a minimum of energy (maximum of entropy). Figure 1 shows the scenario from the point of view of entropy and energy as driving forces.

Figure 1 Entropy action removes the inhomogeneity of a system (on the left). Equivalently, the energy of the system tends to “relax possible tensions” (on the right). We are talking about of an optimization process.

A lots of computational problems can be tackled using an optimization approach. It includes the definition of relevant variables that describes the properties of the problem we are interesting in and pair-wise interactions among these variables. In this context, energy is a real value mathematical function of the variables defined and gives us the information about the intensity of the interactions. We search the minimum values of energy sampling the variables.

The annealing starts when we apply a perturbation to the system (a warming) that lets it to access to a wider range of energetic states. Then, we apply a (slow) cooling protocol that allows the system evolve forward to a more stable state, i.e., to a minimum of energy.

The collection of the values given to the variables in each sampling step is called configuration. Going from one configuration to other with less energy requires to jump an energetic barrier in the majority of the cases. This demands more computing time. However, when we deal with a quantum system, a phenomenon called quantum tunneling may occur. Quantum tunneling makes it possible to overcome an energetic barrier without jumping it but “crossing trough the base”. Therefore, there is a less demand of computing time. Figure 2 illustrates a conceptual equivalence (remember there are no quantum effects in macroscopic systems) of a tunneling phenomenon at human being length scale.

Figure 2 Quantum tunneling may occur during a quantum annealing protocol. It is a direct road between two local minimums separated by an energetic barrier. Computing time reduces regarding to the scenario in which it is necessary to classically “climb the hill to reach the other side”.

**A commercial quantum annealer**

A quantum annealer is a hardware device that carries out quantum annealing. D-Wave Systems company has released a commercial quantum annealer that is composed by many qubits spatially ordered in a graph geometry and able to interact among them and with two external magnetic fields. The exponential scalability in the number of (stable) qubits is one of the most interesting features of this technology.

In D-Wave hardware, qubits initialize in a quantum superposition state due to the action a transversal magnetic field. The quantum annealing protocol starts when a longitudinal magnetic field is slowly turned on while the transversal one is slowly turned off, as it is shown in figure 3. The protocol ends when all the qubits collapse into bit states that encode one of the possible optimized solutions for our computational problem.

Figure 3 Quantum annealing protocol as it is implemented in D-Wave hardware. The Hamiltonian H (the energy of the system, i.e., the energy of the set of qubits) includes the interaction with the transversal (red) and longitudinal (green) external magnetic fields, as well as pair the-wise interaction between the qubits (purple).

What the programmers code

Quantum annealing in computing science promises to resolve NP-hard problems, among others, in an easier way, along with the reduction of the computational resource requirements. The impact of annealing technology will be big thought solutions to NP-hard problems are currently strongly demanded in many industries.

Focusing on software development, QUBO (Quadratic Unconstraint Binary Optimization) approach is the logical-mathematical bridge that makes possible the coding of an NP-hard problem, among others, into binary variables and its corresponding pair-wise interactions. The model of the system, i.e., the definition of the variables and the interactions, becomes critical in order to get the information you need below an error tolerance threshold.

Pair-wise interactions are modeled as quadratic terms. That means products that include the variables involved (“purple” term in Figure 3). The interaction of the qubits with the longitudinal external magnetic field is represented as a linear term (“green” term in Figure 3). Both, quadratic and linear term of the Hamiltonian constitute the called Ising model that is equivalent to a QUBO formulation. The Ising Hamiltonian is what the programmer code according to the computational problem she/he wants to resolve. Eventually, a constant energetic term appears. However, it just modifies the absolute value of the total energy which is irrelevant in a minimization interpretation of the results. On the other hand, the first term in the Hamiltonian of Figure 3 (“red” term) is not controlled by the programmer but by a standalone process the annealer executes. In fact, the transversal term is the quantum part of the Hamiltonian that favors the quantum tunneling effect.

**QPath towards a commercial quantum software development**

Quantum coding can be a pain in your neck even for those with a scientific background. We are in the early years of quantum computing. On the one hand, quantum programming languages, hardware devices, and quantum algorithms are in constant evolution. On the other hand, there is a lack of the work force required. Therefore, the development of quantum software for industry represents a big challenge nowadays.

In this scenario, QPath appears as a way to make possible the commercial quantum software development. QPath is a quantum development and application lifecycle platform. From the creation of the quantum algorithm through its development, testing and implementation, to its deployment and reuse. It will integrate and support a set of critical software engineering methods and techniques to boost large-scale production of high-quality quantum algorithms & software. For further information, you can read the article titled “Introduction to quantum software development with QPath”[1] in the QPath Blog. The following paragraph focuses in what QPath offers regarding to quantum annealing.

As was mentioned above, DWave System company has released the first commercial quantum annealer together with a SDK called Ocean. Programming the annealear basically consists in coding an interaction matrix whose dimension scales with the number of variables defined to describe our computational problem. Ocean works with Python as a programming language. QPath can help you in the design, deployment and execution of your quantum annealing algorithm. QPath provides you a set of abstractions, tools, scalable executions and unified results that simplifies the development stage, being aware the underlying technological details. All this software technology is agnostic to a specific hardware. Hence, it can be used in other quantum annealers that would be released by different companies in the near future.

Good news is coming. A lot of work in progress, a lot of ideas becoming a reality. Just a quantum path to the commercial quantum software development.

[1] Peterssen Nodarse, Guido; Hevia, José Luis. Introduction to quantum software development with QPath. The QPath Blog. https://www.quantumpath.es/index.php/2021/01/13/introduction-to-quantum-software-development-with-qpath/. 2021