1 Introduction

Theoretical quantum computing was first proposed in the early 1980s by Yuri Manin, Richard Feynman, and Paul Benioff as a new way to leverage quantum phenomena to process information (Hidary, 2019). Later, in 1985, David Deutsch formalized the concept of quantum computing by describing the first quantum Turing machine (Deutsch, 1985), which laid the foundations for the emergence of quantum algorithms (e.g., Deutsch and Jozsa, 1992; Simon, 1997; Grover, 1996). Additionally, Shor’s algorithm, a polynomial-time quantum computer algorithm for integer factorization devised by Shor (1995), with the capacity to break the Rivest–Shamir–Adleman (RSA) encryption system, was one of the great motivators for the development of quantum computers. A few years later, in 1998, Chuang et al. (1998) presented the first complete experimental implementation of Grover’s search algorithm in a quantum computer, and in 2001, IBM and Stanford University factorized 15 in a 7-qubits quantum computer using Shor’s algorithm (IBM, 2001). In 2011, D-Wave Systems Inc. (Merali, 2011) and IBM in 2016 (Santos, 2016) were the first companies to develop commercially available quantum computers.

Despite their huge capabilities, quantum computers are not a replacement for classical computers. The fundamental principles of superposition and entanglement make quantum computers faster for calculations in which one can take advantage of simultaneously evaluating multiple solutions (computational parallelism). This characteristic makes quantum computing a good option for solving NP-hard and NP-complete combinatorial problems. Today, quantum computing has applications in cryptography (Fernández-Carames and Fraga-Lamas, 2020; Mavroeidis et al., 2018), computer-aided drug design (Cao et al., 2018; Outeiral et al., 2021), finance (Egger et al., 2020; Orus et al., 2019), artificial intelligence (Abdelgaber & Nikolopoulos, 2020; Choi et al., 2020), and optimization (Harwood et al., 2021).

In this paper, we seek to contribute to the insertion of quantum computing in urban and regional science. For this, we employ one of the best-known NP-hard problems in regional science, the maximal covering location problem (MCLP) proposed by Church and ReVelle (1974). The MCLP seeks to maximize the population covered within a desired service distance \(S\) by locating a fixed number of facilities. We start by taking the reader through the nontrivial process that begins with the transformation of the binary integer programming formulation of the MCLP to its solution in the two currently available quantum computing paradigms: adiabatic quantum computing (D-Wave) and gate-based quantum computing (IBM). We perform a computational experiment on real quantum devices and classical quantum simulators. Our main objective is to show urban and regional scientists the potential of this technology and to point out the steps of the process in which we can contribute without expertise in quantum computing.

This article is not a simple application of quantum computing. As will be seen later, the transformation of an integer binary programming formulation into the expression required to be processed by a quantum computer is an important contribution to the state-of-the-art methods in this area. Although quantum computing is in its early stages of development, our contribution will motivate urban and regional scientists to be better prepared to take advantage of a technology that will soon allow us to solve various optimization problems in urban and regional science regardless of their size. The ability of quantum computing to solve NP-hard and NP-complete combinatorial problems makes it a promising technology for solving problems such as location, routing, region design, urban planning, and ecological and environmental resource planning, to name a few. Although computing power is currently limited, this technology is advancing rapidly. When the number of qubits in a quantum computer allows solving large instances, it will be possible to know the optimal solution of large instances in fractions of a second. Unlike classical computing, the solution time of an instance in a quantum computer does not increase with its size.

The remainder of the paper is presented as follows: the next section contains a literature review on quantum computing and the MCLP. The third section contains the general steps for solving an integer programming problem with a quantum computer. The fourth and fifth sections present a computational experiment that solves small instances of the MCLP using both adiabatic quantum computing and gate-based quantum computing paradigms in quantum computing. Finally, the sixth section presents the conclusions and possible future lines of research.

2 Literature review

2.1 Quantum computing

Quantum computation and quantum information address the study of information processing tasks that can be accomplished by using quantum mechanical systems (Nielsen & Chuang, 2010). This area of study started almost simultaneously with quantum theory; however, it was only in 1980 with the no-cloning theorem that the first relevant steps in this area were taken. Benioff (Benioff, 1980) and Feynman (Feynman, 1960, 1982) proposed the idea of making quantum mechanical simulations with the help of quantum phenomena. Later, this idea was formalized by David Deutsch in the form of quantum Turing machines (Deutsch, 1985) and quantum gates (Deutsch, 1989). The first quantum algorithms were the Deutsch-Jozsa (Deutsch & Jozsa, 1992), Grover (Grover, 1996), and Simon algorithms (Simon, 1997). In 1994, Shor’s algorithm highlighted the possibilities of quantum computing in the factorization of prime numbers, which is an essential part of the worldwide RSA encryption system, and increased the interest of the scientific community in this area.

Although there are several ways in which quantum mechanics can be used in quantum computing, by far the most dominant paradigms are quantum annealing (de Falco et al., 1988) and gate-based quantum computing, also known as quantum circuits (Deutsch, 1985). Quantum annealing is based on the natural behavior of a quantum system (i.e., a network of qubits). It begins by mapping the problem into a quantum system that evolves naturally until it reaches its minimum energy level that corresponds to the optimal solution to the original optimization problem. In gate-based quantum computing, the problem is mapped onto a circuit containing qubits and quantum logic gates (Scherer, 2019). The gates perform specific transformations to the qubits until they converge to a state that corresponds to the optimal solution to the original optimization problem. The main difference is that gated-based quantum computing is Turing-universal, i.e., any computational problem can be solved using this technology, while quantum annealing uses a quantum phenomenon for solving a specific family of problems. On the other hand, current quantum annealing machines are larger and can be used for larger problems.

Quantum computing is a young field, and although its impact on urban and regional science is still low, it holds much promise. The areas of location, routing, region design, urban planning, and ecological and environmental resource planning, to name a few, have NP-hard and NP-complete combinatorial problems that are excellent candidates for quantum computing solutions. To the best of our knowledge, Harwood et al. (2021) is the only publication that uses quantum computing to solve a problem within the area of regional science, namely, the routing problem. Harwood et al. (2021) use the IBM quantum simulators, which is a resource offered by IBM for prototyping quantum circuits and algorithms, to solve an instance with three demand nodes and with time windows originally solved in Desrochers et al. (1992).

Recently, great advances have been made in terms of the accessibility and usability of quantum computers. On the one hand, Python libraries have been developed, such as DOcplex (IBM, 2021), which help in the process of converting a classical optimization formulation to the quadratic unconstrained binary optimization formulation required to interact with a quantum computer (Glover et al., 2019). On the other hand, libraries have also been created in Python to interact with quantum computers such as that of IBM (in the case of gate-based quantum computers) and D-Wave (in the case of quantum annealing computers). IBM developed the Qiskit framework that allows the simulation of quantum circuits that can then be sent to real IBM quantum computers (Santos, 2016). Amazon created Amazon Braket, a library that allows simulation and interaction with different types of quantum computers, including those of D-Wave (Gonzalez, 2021). Other open-source programming languages for developing and running quantum algorithms are Q# and Cirq. For more information about these and other platforms, see Matthews (2021).

As this article is addressed to nonexperts in quantum computing, we consider it important to briefly describe the basis of quantum computing. A classical computer performs operations using bits, which can be either one or zero. In contrast, a quantum computer uses qubits (a photon, an electron, or a nucleus), which, due to the property of superposition, can be in both states (one and zero) at the same time. Therefore, in a state of superposition, the qubit is expressed as a linear combination of two states, i.e., \(\left|\psi \rangle ={c}_{0}\right|0\rangle +{c}_{1}|1\rangle , {c}_{0},{c}_{1}\in {\mathbb{C}}\), where the coefficients \({c}_{0}\) and \({c}_{1}\) are complex numbers that describe how much goes into each state (Hidary, 2019). Note that if we have a classical bit, we just need a number (a piece of information) to know the state of the bit: zero or one. However, if we have a qubit, we need two pieces of information to describe its state: \({c}_{0}\) and \({c}_{1}\).

Now, let us suppose that we have two bits and two qubits. In both cases, we have four possible states: {0,0}, {0,1}, {1,0}, and {1,1}. If we want to describe the state of the two classical bits, all we need is two pieces of information: the state of the first bit and the state of the second bit (e.g., {1,0}). However, in the case of the two qubits, because of the property of superposition, {0,0}, {0,1}, {1,0}, and {1,1} exist at the same time. The four states are in superposition; therefore, we can write a quantum mechanical state that is a linear combination of the four basic states, i.e., \(\left|\psi \rangle ={c}_{00}\right|00\rangle +{c}_{01}\left|01\rangle +{c}_{10}\right|10\rangle +{c}_{11}|11\rangle\). Thus, we need four numbers (i.e., \({c}_{00}\), \({c}_{01}\), \({c}_{10}\), and \({c}_{11}\)) to determine the state of a system with two qubits. Therefore, a system with two qubits contains four bits of information. In general, a system with \(N\) qubits contains information equivalent to \({2}^{N}\) classical bits (Nielsen & Chuang, 2010).

Although all the states in a quantum system are in superposition, when the system is measured (i.e., when a physical system is manipulated to yield a numerical result), all the states collapse into one of the basic states (e.g., {0,0}, {0,1}, {1,0}, or {1,1}) (Hardy & Steeb, 2001). Therefore, the big challenge in quantum computing is to design quantum systems in such a way that the final result is one of the basis states (i.e., something that can be measured).

Qubits in a quantum system can interact in a highly correlated manner, known as entanglement, a quantum phenomenon without a classical counterpart. When quantum states (qubits) are entangled, they cannot be described independently (Nielsen & Chuang, 2010). Therefore, entangled qubits lose their individuality and behave as a single entity (i.e., a change in one qubit leads to an immediate response in the others).

Finally, due to a phenomenon known as interference (Brassard et al., 1998), a quantum system can collapse into different results when observed. This makes quantum measurement a probabilistic process. Therefore, solving a problem with quantum technology requires that the problem be solved multiple times. The final solution will then be the one with the highest probability.

In summary, the quantum properties of superposition and entanglement make quantum computing extremely fast in problems in which parallelism can be taken advantage of. For example, in combinatorial optimization, one can use superposition to make an instant evaluation of all possible combinations. In other words, quantum computers allow one to perform an instant evaluation of the solution space.

2.2 The maximal covering location problem—MCLP

The maximal covering location problem (MCLP), devised by Church and ReVelle (1974), is a classic problem in location analysis that seeks to maximize the population covered within a desired service distance \(S\) by locating a fixed number of facilities. For the sake of completeness, we present the minimization version of the MCLP model.

Minimize

$$z=\sum\limits_{\mathrm i\in\mathrm I}\;\alpha_{\mathrm i}\;{\overline y}_i$$
(1)

S.T.

$$\sum\limits_{j\in N_i}x_j+{\overline y}_i \geq 1\text{ for all }i\in I$$
(2)
$$\begin{array}{c}\sum\limits_{j\in J}x_j=p\\x_j=\left(0,1\right)\text{ for all }j\in J\\{\overline y}_i=\left(0,1\right)\text{ for all }i\in I\end{array}$$
(3)

Parameters:

$$I=\mathrm{denotes}\;\mathrm{the}\;\mathrm{set}\;\mathrm{of}\;\mathrm{demand}\;\mathrm{nodes};$$
$$J=\mathrm{denotes}\;\mathrm{the}\;\mathrm{set}\;\mathrm{of}\;\mathrm{candidate}\;\mathrm{facility}\;\mathrm{sites};$$
$$S=\mathrm{the}\;\mathrm{distance}\;\mathrm{beyond}\;\mathrm{which}\;a\;\mathrm{demand}\;\mathrm{point}\;\mathrm{is}\;\mathrm{considered}\;\mathrm{``}\text{uncovered''}\;(\mathrm{the}\;\mathrm{value}\;\mathrm{of}\;S\;\mathrm{can}\;\mathrm{be}\;\mathrm{chosen}\;\mathrm{differently}\;\mathrm{for}\;\mathrm{each}\;\mathrm{demand}\;\mathrm{point}\;\mathrm{if}\;\mathrm{desired});$$
$${\mathrm d}_{ij}=\mathrm{the}\;\mathrm{shortest}\;\mathrm{distance}\;\mathrm{from}\;\mathrm{node}\;i\;\mathrm{to}\;\mathrm{node}\;j$$
$${N}_{i}= \left\{j\in J\mid {d}_{ij}\le S\right\};$$
$$a_i=\mathrm{population}\;\mathrm{to}\;\mathrm{be}\;\mathrm{served}\;\mathrm{at}\;\mathrm{demand}\;\mathrm{node}\;i;$$
$$p=\mathrm{the}\;\mathrm{number}\;\mathrm{of}\;\mathrm{facilities}\;\mathrm{to}\;\mathrm{be}\;\mathrm{located};$$

Decision variables:

$${x}_{j}= \left\{\begin{array}{l}1\text{ if a facility is allocated to site} \, j\\ 0\text{ otherwise;}\end{array}\right.$$
$${\overline{y} }_{i}= \left\{\begin{array}{l}1\text{ if a demand node }i\text{ is not covered by a facility within }S\\ \text{ distance }\\ 0\text{ otherwise;}\end{array}\right.$$

Objective function (1) minimizes the number of people who will not be served within the maximal service distance. Constraint (2) establishes that a demand node \(i\) is not covered if there is not a facility within \(S\) distance. Constraint (3) sets the number of facilities allocated to \(p\). Finally, all decision variables are binary.

The MCLP is related to a family of problems that are classified as nondeterministic polynomial-time complete (NP-complete) (Megiddo et al., 1983; Murray, 2016). To address this complexity, some authors have explored Lagrangian relaxation (Weaver & Church, 1986; Galvão and ReVelle, 1996), while others have proposed heuristic approaches (Church & Murray, 2018; Murray & Church, 1996; Tong et al., 2009). The contribution of our article to the MCLP literature consists of the exploration of the potential of quantum computing to solve this problem. We selected the MCLP not only because of its high impact in the literature but also because it has two characteristics that make it a good first case study: the simplicity of its formulation and the fact that all its decision variables are binary.

3 General steps for solving an integer programming problem in a quantum computer

The main steps for solving a linear optimization problem using a quantum computer are presented in Fig. 1, which consists of 9 demands nodes numbered from 0 to 8 from left to right and from top to bottom and with three eligible facility sites in nodes 0, 2 and 6 (marked as bold circles in the figure). In general, the process starts with a linear optimization problem (step one). Next, the problem is converted into a quadratic binary unconstrained optimization (QUBO) model, which is an expression with a linear component and a quadratic component, and all the variables are binary variables (step two). The QUBO expression can then be mapped onto a quantum gate or annealing computer (step three). Once the evolution of the quantum process is finished, the measurement is performed, and the solution vector is obtained (step four). Finally, the solution vector is decoded to obtain the final solution (step five). Each of these steps will be developed in more detail in the following subsections. We will use the MCLP instance presented in Fig. 2 to exemplify the process (we set \(p=2\)).

Fig. 1
figure 1

Main steps for solving an integer programming problem in a quantum computer

Fig. 2
figure 2

Example of an MCLP instance

3.1 Linear optimization problem

The process starts with the formulation of a linear optimization problem such as the one presented in Eq. 4; this formulation represents the MCLP problem of the instance presented in Fig. 2. In this paper, the nodes are numbered, starting with zero, from left to right and from top to bottom. We assume the service distance, \(S\), of all candidate facilities corresponds to horizontal and vertical neighboring nodes (i.e., a candidate facility in node \(0\) can serve nodes 0, 1, and 3, a candidate facility in node \(2\) can serve nodes 1, 2, and 5, and a candidate facility in node \(6\) can serve nodes 3, 6, and 7).

$$\begin{array}{ll}{\text{Minimize}}& \\ & 4{\overline{y} }_{0}+5{\overline{y} }_{1}+2{\overline{y} }_{2}+2{\overline{y} }_{3}+{\overline{y} }_{4}+4{\overline{y} }_{5}+2{\overline{y} }_{6}+2{\overline{y} }_{7}+{\overline{y} }_{8}\\ \text{Subject to}& \\ & {C}_{1}: {\overline{y} }_{0}+{x}_{0}\ge 1\\ & {C}_{2}: {\overline{y} }_{1}+{x}_{0}+{x}_{2}\ge 1\\ & {C}_{3}: {\overline{y} }_{2}+{x}_{2}\ge 1\\ & {C}_{4}: {\overline{y} }_{3}+{x}_{0}+{x}_{6}\ge 1\\ & {C}_{5}: {\overline{y} }_{4}\ge 1\\ & {C}_{6}: {\overline{y} }_{5}+{x}_{2}\ge 1\\ & {C}_{7}: {\overline{y} }_{6}+{x}_{6}\ge 1\\ & {C}_{8}: {\overline{y} }_{7}+{x}_{6}\ge 1\\ & {C}_{9}: {\overline{y} }_{8}\ge 1\\ & {C}_{10}: {x}_{0}+{x}_{2}+{x}_{6}=2\\ & \\ & {x}_{0},{x}_{2},{x}_{6} \in \{\mathrm{0,1}\}\\ & {\overline{y} }_{0},{\overline{y} }_{1},{\overline{y} }_{2},{\overline{y} }_{3},{\overline{y} }_{4},{\overline{y} }_{5},{\overline{y} }_{6},{\overline{y} }_{7},{\overline{y} }_{8} \in \{\mathrm{0,1}\}\end{array}$$
(4)

3.2 Transformation into a quadratic binary unconstrained optimization (QUBO) model

The QUBO formulation is an expression with a linear component and a quadratic component, and all the variables are binary variables (Kochenberger et al., 2014). This expression is the key to entering the world of quantum computing. The transformation consists of moving each constraint in the classical optimization model to the objective function as a penalty expression. The new unconstrained optimization model consists of a unique expression (the QUBO expression) that includes the objective function and penalties. The QUBO expression has the same optimal solution as the original optimization model.

A branch of the quantum computing literature consists of the formulation of penalty expressions. A detailed description of the creation of penalties is available in (Glover et al., 2019). Table 1 presents useful penalty expressions for certain types of constraints. According to Glover et al. (2019) P is an arbitrary constant that must be large enough to guarantee that the constraint is satisfied, but not too large to overwhelm the original objective function information (making it difficult to distinguish the quality of a solution). If P is too small, it could lead to unfeasible solutions. Glover et al. (2019) recommend a value for P between 75% and 150% of a ballpark estimate of the objective function value. See Verma and Lewis (2020) and Ayodele (2022) for more sophisticated strategies to set P. Additionally, note that the penalties are quadratic expressions that fall within the description of a QUBO model. In principle, there are different ways to convert a constraint into a penalty expression. One interesting problem is to find the most efficient conversion since this conversion has an impact on the complexity of the solution (see O’Donnell, 2014 for more on the generation of QUBO expressions).

Table 1 Conversion table

We can use Table 1 to transform each constraint in Eq. 4:

$$\begin{array}{lll}{C}_{1}: {\overline{y} }_{0}+{x}_{0}\ge 1& \stackrel{\text{to}}{\to }& P\left(1-{x}_{0}-{\overline{y} }_{0}+{x}_{0}{\overline{y} }_{0}\right)\\ {C}_{2}: {\overline{y} }_{1}+{x}_{0}+{x}_{2}\ge 1& \stackrel{\text{to}}{\to }& P\left[{\left(1-{x}_{0}-{x}_{2}-{\overline{y} }_{1}+{s}_{0}+{s}_{1}\right)}^{2}\right]\\ {C}_{3}: {\overline{y} }_{2}+{x}_{2}\ge 1& \stackrel{\text{to}}{\to }& P\left(1-{x}_{2}-{\overline{y} }_{2}+{x}_{2}{\overline{y} }_{2}\right)\\ {C}_{4}: {\overline{y} }_{3}+{x}_{0}+{x}_{6}\ge 1& \stackrel{\text{to}}{\to }& P\left[{\left(1-{x}_{0}-{x}_{6}-{\overline{y} }_{3}+{s}_{2}+{s}_{3}\right)}^{2}\right]\\ {C}_{5}: {\overline{y} }_{4}\ge 1& \stackrel{\text{to}}{\to }& {\overline{y} }_{4}=1\\ {C}_{6}: {\overline{y} }_{5}+{x}_{2}\ge 1& \stackrel{\text{to}}{\to }& P\left(1-{x}_{2}-{\overline{y} }_{5}+{x}_{2}{\overline{y} }_{5}\right)\\ {C}_{7}: {\overline{y} }_{6}+{x}_{6}\ge 1& \stackrel{\text{to}}{\to }& P\left(1-{x}_{6}-{\overline{y} }_{6}+{x}_{6}{\overline{y} }_{6}\right)\\ {C}_{8}: {\overline{y} }_{7}+{x}_{6}\ge 1& \stackrel{\text{to}}{\to }& P\left(1-{x}_{6}-{\overline{y} }_{7}+{x}_{6}{\overline{y} }_{7}\right)\\ {C}_{9}: {\overline{y} }_{8}\ge 1& \stackrel{\text{to}}{\to }& {\overline{y} }_{8}=1\\ {C}_{10}: {x}_{0}+{x}_{2}+{x}_{6}=2& \stackrel{\text{to}}{\to }& P\left[{\left(2-{x}_{0}-{x}_{2}-{x}_{6}\right)}^{2}\right]\end{array}$$

Note that constraints \({C}_{5}\) and \({C}_{9}\) correspond to demand nodes \({\overline{y} }_{4}\) and \({\overline{y} }_{8}\), respectively. These two demand nodes cannot be served by any candidate facility. Thus, constraints \({C}_{5}\) and \({C}_{9}\) do not have \({x}_{i}\) variables. In both cases, the expressions are of type \({\overline{y} }_{i}\ge 1\), and since \({\overline{y} }_{i}\) is a binary variable, the expression can be transformed into \({\overline{y} }_{i}=1\) and can be removed from the QUBO expression.

Next, we add each penalty expression to the objective function (see Eq. 5). Finally, Eq. 6 presents the QUBO expression with \(P=6\). This expression is equivalent to the classical linear formulation in Eq. 4. In Table 2, we show that both the classical linear model and the quadratic model have the same optimal solution.

Table 2 Gurobi classical quadratic and linear program solutions
$$\begin{array}{c}4{\overline{y} }_{0}+5{\overline{y} }_{1}+2{\overline{y} }_{2}+2{\overline{y} }_{3}+4{\overline{y} }_{5}+2{\overline{y} }_{6}+2{\overline{y} }_{7}+P\left(1-{x}_{0}-{\overline{y} }_{0}+{x}_{0}{\overline{y} }_{0}\right)\\ +P\left[{\left(1-{x}_{0}-{x}_{2}-{\overline{y} }_{1}+{s}_{0}+{s}_{1}\right)}^{2}\right]+P\left(1-{x}_{2}-{\overline{y} }_{2}+{x}_{2}{\overline{y} }_{2}\right)\\ +P\left[{\left(1-{x}_{0}-{x}_{6}+{\overline{y} }_{3}+{s}_{2}+{s}_{3}\right)}^{2}\right]+P\left(1-{x}_{2}-{\overline{y} }_{5}+{x}_{2}{\overline{y} }_{5}\right)\\ +P\left(1-{x}_{6}-{\overline{y} }_{6}+{x}_{6}{\overline{y} }_{6}\right)+P\left(1-{x}_{6}-{\overline{y} }_{7}+{x}_{6}{\overline{y} }_{7}\right)\\ +P\left[{\left(2-{x}_{0}-{x}_{2}-{x}_{6}\right)}^{2}\right]\end{array}$$
(5)
$$\begin{array}{c}-54{x}_{0}-48{x}_{2}-48{x}_{6}-2{\overline{y} }_{0}-7{\overline{y} }_{1}-4{\overline{y} }_{2}-10{\overline{y} }_{3}\\ -2{\overline{y} }_{5}-4{\overline{y} }_{6}-4{\overline{y} }_{7}+12{s}_{0}+12{s}_{1}+12{s}_{2}+12{s}_{3}\\ +24{x}_{0}{x}_{2}+24{x}_{0}{x}_{6}+12{x}_{2}{x}_{6}\\ +18{x}_{0}^{2}+12{x}_{2}^{2}+12{x}_{6}^{2}+6{\overline{y} }_{1}^{2}+6{\overline{y} }_{3}^{2}+6{s}_{0}^{2}+6{s}_{1}^{2}+6{s}_{2}^{2}+6{s}_{3}^{2}\\ +6{x}_{0}{\overline{y} }_{0}+12{x}_{0}{\overline{y} }_{1}+12{x}_{0}{\overline{y} }_{3}-12{x}_{0}{s}_{0}-12{x}_{0}{s}_{1}-12{x}_{0}{s}_{2}-12{x}_{0}{s}_{3}\\ +12{x}_{2}{\overline{y} }_{1}+6{x}_{2}{\overline{y} }_{2}+6{x}_{2}{\overline{y} }_{5}-12{x}_{2}{s}_{0}-12{x}_{2}{s}_{1}\\ +12{x}_{6}{\overline{y} }_{3}+6{x}_{6}{\overline{y} }_{6}+6{x}_{6}{\overline{y} }_{7}-12{x}_{6}{s}_{2}-12{x}_{6}{s}_{3}\\ -12{\overline{y} }_{1}{s}_{0}-12{\overline{y} }_{1}{s}_{1}-12{\overline{y} }_{3}{s}_{2}-12{\overline{y} }_{3}{s}_{3}+12{s}_{1}{s}_{0}+12{s}_{2}{s}_{3}+66\end{array}$$
(6)

The QUBO expression can be mapped into a specific quantum computer. Each device (i.e., gate-based or annealing) has specific instructions and frameworks that allow the user to perform the mapping. In Qiskit, this work is performed using the QuadraticProgram from qiskit.optimization (IBM, 2022); in D-Wave (Shin et al., 2014), the reference has specific functions to send the quadratic program into the annealer.

It is important to note that transforming the classical formulation to a QUBO expression is not a matter of adapting the formulation to an input format. Quantum computers solve QUBO problems, and QUBO expressions are not another format (McGeoch & Wang, 2013). The classical formulation must be transformed into a QUBO problem to use a quantum computer. Currently, there is not, neither in classical nor in quantum computing, a library or process that performs an automatic transformation of a classical optimization problem to its QUBO formulation. In fact, this transformation is one of the main challenges when solving optimization problems in quantum computing and, at the same time, the main aspect in which urban and regional scientists and optimization experts can contribute to building the bridge to allow a greater penetration of quantum computing in urban and regional science.

3.3 Solving the QUBO expression into a quantum annealer computer

Quantum annealing computing (Albash and Lidar, 2018) uses the physical behavior of quantum systems to solve optimization and probabilistic sampling (D’Wave, 2022) problems. This technology is based on the fundamental principle of physics that dictates that every object or system always seeks its minimum energy state (Das & Chakrabarti, 2008). Solving a problem in a quantum annealing computer requires the design of an entangled quantum system in which each qubit represents a binary variable of the QUBO expression to be solved. The system must be designed in such a way that the minimum energy state of the system corresponds to the optimal solution of the problem. That is, when measuring the system, each qubit collapses to 0 or 1 as dictated by the optimal solution.

As an illustrative example, Fig. 3 shows a quantum system with three entangled qubits that represent the QUBO expression \(-43{y}_{1}-240{x}_{0}-240{x}_{2}+96{y}_{1}{x}_{0}+96{y}_{1}{x}_{2}\). Each qubit represents a binary variable of the QUBO expression (i.e., \({X}_{0}\), \({X}_{2}\), and \({Y}_{1}\)), and the quadratic relations between variables determine the entanglement relations between the qubits. Thus, the term \(96{y}_{1}{x}_{2}\) implies an entanglement relationship between the qubits that represent the variables \({y}_{1}\) and \({x}_{2}\). Each basic state of this system (i.e., the different combinations of values for \({x}_{0}\), \({x}_{2}\), and \({y}_{1}\)) has an associated energy level that allows the construction of what is known as the energy landscape. Figure 4 presents the energy landscape of our example and indicates that the lowest energy level corresponds to the basic state \({x}_{0}=1\), \({x}_{2}=1\), and \({y}_{1}=0\), which is the optimal solution that minimizes the QUBO expression. If the quantum system is well designed, then quantum physics takes the system to that basic state of minimum energy. The calculation of the total energy of a quantum system, given its state, is calculated with the Hamiltonian (Dirac, 1981).

Fig. 3
figure 3

Quantum system and energy landscape for the QUBO expression \(-43{y}_{1}-240{x}_{0}-240{x}_{2}+96{y}_{1}{x}_{0}+96{y}_{1}{x}_{2}\)

Fig. 4
figure 4

Example of a quantum circuit for the QUBO expression \(-43{y}_{1}-240{x}_{0}-240{x}_{2}+96{y}_{1}{x}_{0}+96{y}_{1}{x}_{2}\)

3.4 Solving the QUBO expression in a gate-based quantum computer

While quantum annealing computation seeks to take advantage of the natural evolution of quantum states, the quantum gate model seeks to manipulate the way in which the state of the quantum system evolves over time. This manipulation is done by means of quantum gates that can be arranged in sequences to build a more complex algorithm. Quantum gates can be unary (one qubit), binary (two qubits), or ternary (three qubits). The main difference between classical gates (e.g., AND, OR, NAND, etc.) and quantum gates (e.g., Pauli-X, Hadamard, Phase, etc.) is that the latter are reversible (i.e., no information is lost in the process as it is with classical gates), which guarantees the preservation of entanglement and superpositions. The possibility of creating intricate circuits connecting multiple qubits with a variety of quantum gates is what makes gate-based quantum computers more general-purpose than quantum annealing computers. For illustrative purposes only, Fig. 4 illustrates the quantum circuit of the QUBO expression \(-43{y}_{1}-240{x}_{0}-240{x}_{2}+96{y}_{1}{x}_{0}+96{y}_{1}{x}_{2}\).

3.5 Solution vector decoding

Once the quantum process is finished, the system is measured, and all the qubits collapse into basic 0,1 states. Since each qubit represents a binary variable in the QUBO expression, we end up with a binary vector. Table 3 shows the solution vectors resulting from solving our example instance from Fig. 2. The second column (Gurobi) shows the solution vector when solving the original linear formulation in Gurobi. The third column (Gate-based) shows the solution vector when solving the problem using a quantum annealer computer. The remaining columns show the solution vectors resulting from the 10 experiments carried out in the annealing quantum computer (note that, in this case, all 10 experiments produced the same optimal solution). Finally, Fig. 5 shows the graphical representation of the optimal solution.

Table 3 Solution vectors of the MCLP instance presented in Fig. 2 (\(p=2\))
Fig.5
figure 5

Optimal solution of the MCLP instance presented in Fig. 2 (\(p=2\))

4 Computational experiment

In this section, we present the computational experiment in which we use both quantum technologies to solve small instances of the MCLP. We work with small instances because, as shown in Sect. 3, a small MCLP instance generates a QUBO expression with many binary variables that quickly make use of all the qubits that are available for experimentation. We expect that as quantum technology evolves, it will be possible to solve larger instances of the MCLP.

Figure 6 presents the nine instances used in the experiment. They range from 9 to 25 demand nodes (\(I\)) and 3 to 7 eligible or candidate facility sites (\(J\)). In all cases, the aim was to locate 2 facilities (i.e., \(p=2\)).

Fig. 6
figure 6

MCLP Instances

For the annealing technology, we used a quantum computer from D-Wave (specifically the DW_2000_Q6) with 2000 qubits and Chimera topology. For gate technology, we used Qiskit’s matrix product simulator (MPS) quantum simulator with 100 qubits. We ran Qiskit on a classic supercomputer with 464 CPU cores and an Intel (R) Xeon (R) × 8664 processor. We also ran Qiskit on Amazon Web Services (specifically ml.m5.24xlarge), with 96 CPU cores, and an Intel (R) Xeon (R) Platinum 8175 M CPU, 2.50 GHz. Table 4 reports the different libraries used in the experiment. We recognize that these libraries are continuously evolving, but they are a good reference for practitioners. The instances and codes utilized in this experiment are available in the following repository: https://github.com/Rise-group/Quantic_MCLP.

Table 4 Python libraries and associated function

As we explained in Sect. 2.1, the interference phenomenon makes it necessary for a quantum problem to be solved multiple times to find the final solution as the most likely one. For this reason, each of the nine instances was solved 10,000 times (this is what we call an experiment). In the jargon of quantum computing, each solution is known as a “shot.” From those 10,000 shots, we kept the solution with the lowest level of energy. To guarantee that the obtained solution was the optimal solution, we repeated the process 10 times for each instance. In summary, we solved each instance 10 × 10,000 times (i.e., 10 experiments × 10,000 shots). This is only necessary for instances solved with annealing technology (D-Wave), as this is where we use a real quantum computer. In the case of gate-based technology (Qiskit), the solution obtained is deterministic because a simulator on a classic computer is used.

5 Results

Figure 7 shows the graphical representation of the optimal solutions. All the instances were solved to optimality with quantum annealing technology. These are therefore the first MCLP instances ever solved with a quantum computer. Regarding the gate-based quantum simulator, only the instances ID = 1, ID = 2, and ID = 3 were solved optimally.

Fig. 7
figure 7

MCLP Instance solutions

5.1 Quantum annealer results

The results of the annealer experiments are summarized in Table 5. Columns 3 and 4 report the optimal solution when solving the instance in Gurobi. “OF” indicates the optimal value of the objective function in terms of the uncovered population, and “Time (s)” contains the running time (in seconds). The results of the annealing experiments are described in Columns 5 to 9. Column 5 (Optimal Yes/No) indicates whether the quantum annealing computer found the optimal solution. In this case, all instances were solved to optimality. Therefore, to the best of our knowledge, our results are the first nine instances of the MCLP successfully solved with a quantum computer. As we explained above, the probabilistic nature of quantum technology requires solving each instance multiple times to find the most likely solution. In our experiment, each instance was solved 10 times (each time we kept the solution with the lowest energy level from 10,000 shots). Column 6 (Success rate) indicates the number of times out of 10 that the quantum computer found the optimal solution. In eight instances, the optimal solution was reached in most experiments. However, only 2 of the 10 experiments reached the optimal solution of instance ID = 8. This instability in the behavior of quantum annealing seems to be associated with the greater number of eligible facility sites, which for this instance is \(J=7\). In instance ID = 9, where \(J=5\), this instability is also noticeable. According to Column 7 (Number of qubits), instances ID = 8 and ID = 9 are the most complex in terms of the number of qubits required to solve the instances. Column 8 (OF) reports the objective function (uncovered demand). We report the maximum and minimum values of the objective function in the cases in which the optimal solution was not found in all experiments (i.e., IDs 5, 7, 8, and 9). Last, Column 9 (Time per experiment) indicates the time required to solve one experiment, which is equivalent to 10,000 shots. As explained in Sect. 3.3, the annealing process takes \(20\mu s\) per shot regardless of the size of the instance to solve. Therefore, the running time is the same for all instances.

Table 5 Summary of annealing experiments

5.2 QAOA results

The challenge in this experiment is different from the annealing experiment. This is because the QAOA experiment is performed in a deterministic simulator that emulates the quantum behavior in a classical computer. This deterministic nature implies that, having set the parameters in the simulator, an instance is resolved once. Therefore, the challenge here is to find the parameter values that allow the optimal solution to be reached.

Table 6 presents the results of the QAOA simulations. The first aspect that stands out is that with this technology, it was only possible to solve three of the nine instances of the experiment. As in Table 5, we report the optimal solution and computation times required by Gurobi to solve the instances to optimality. For the gate-based technology, we report whether the optimal value was found (Optimal Yes/No), the value of the objective function (OF QAOA), the computation time (Time QAOA), and the number of qubits required to solve the instances (Number of qubits). Apart from the fact that most of the instances were not resolved, we noticed that the execution times are long and volatile. This is due to the parameter calibration process. These results indicate that gate technology does not seem to be the best option for a problem such as the MCLP.

Table 6 Summary of QAOA simulations

6 Conclusions

This paper presents the first empirical evidence on the solution of the MCLP with quantum computers, which constitutes an important milestone in the literature of this classic problem. The computational experiments show that quantum annealing has great potential for solving this problem, which is expected, as this technology is specific for solving combinatorial optimization problems. In contrast, although it is of more general use, gate-based quantum technology did not show good performance when simulating the annealing process with the QAOA. In both cases, it is clear that further advances in quantum technology are required to surpass classical computation in solving combinatorial optimization problems.

This paper does not intend to convince the reader that quantum computing has already beaten classical computing. The goal of the paper is to show that quantum computing should be explored as another tool for solving problems in urban and regional science. Quantum computing is in its early stage, but quantum machines are a reality, and they are used to solve problems. With the small instances that we solved in this paper, we show that adiabatic quantum computation (i.e., the quantum annealing paradigm) works for the MCLP. This means that larger problems can be approached if larger machines are built. IBM has scheduled for 2022 a quantum computer with 443 qubits and a 1,121-qubit quantum computer for 2023 (Gambetta, 2020). Keeping in mind that every qubit doubles the capability for processing information, this represents an exponential growth that will overcome the problem of dealing with toy problems.

Quantum computing, particularly annealing, is designed for the solution of combinatorial optimization problems, such as location problems, routing problems, region design problems, urban planning, and ecological and environmental resource planning, to name a few. Many of these problems are NP-hard, and this is where quantum computing has much to contribute in the near future. This paper opens new research opportunities for urban and regional scientists, for example, the formulation of QUBO expressions for other classic combinatorial problems in urban and regional science and the design of new penalty expressions to make it possible to formulate new QUBO expressions, without having to become experts in quantum computing. These potential avenues for further research allow urban and regional science, as a field, to be better prepared for the day when quantum computers are more advanced.