The social workers’ problem is the problem defined by social workers who visit patients at home to provide personalized assistant care according to a schedule, time and duration of the visit based on the patient’s pathology. This problem combines, on the one hand, a routing problem such as Vehicle Routing Problem (VRP)    and, on the other, a planning problem . Hence the exact solution can drive an exponential computation time for growing scale input data where the need for another approach to solving these problems is veritably crucial. The complexity and above all, the importance of these problems involved the scientific community in investigating efficient methods to solve them .
The social workers’ problem, as the combination of VRP and planning problem, is NP-Hard. This definitely, leads us to explore new approaches for the large-scale social workers and one of these approaches to take into account is Quantum computing .
Quantum computing could help us in a change of the degree of complexity of the problem, empowered by its high computation capacity. Within the large fields where quantum computing is called to stand out, is the field of combinatorial optimization. And one of the most special algorithms in this field is the Quadratic Unconstrained Binary Optimization Problems (QUBO).
The QUBO    is one of the most relevant categories of optimization problems. It was designed to solve quantum annealing problems and maps to perfection with D-wave technology . QUBO refers to a pattern matching technique used in machine learning and optimization, which involves minimizing a quadratic polynomial over binary variables . It must be ruled out that QUBO is NP-hard . And also, because this formulation does not admit restrictions, it could significantly limit its use when modelling systems that need constraints (especially inequality). However, many famous combinatorial optimization problems take advantage of the QUBO formulation to be solved    and also to be used in quantum computers based on gate model .
This article provides a detailed resolution of the social workers’ problem using the Quadratic Unconstrained Binary Optimization Problems (QUBO) formulation. We also propose an approach to mapping the inequality constraints in the QUBO form and finally, we map it in the Hamiltonian of the Ising model to solve it with the Quantum Exact Solver and Variational Quantum Eigensolvers (VQE) . The quantum feasibility of the algorithm will be tested on IBMQ computers.
The paper is organized as follows. In Section 2, the quantum computers, the Adiabatic Quantum Computing (AQC), and the VQE will be explored by focusing on the two dominant configurations and their techniques. In Section 3, we introduce the question we want to solve and the approaches. In Section 4, 5 and 6 we outline our proposed formulation to solve the problem, we describe details of its algebraic QUBO formulation and we translate it into Ising form ready to be solved with any quantum solver, in this paper, mainly with the VQE. Finally, in Section 7, we present the results of our experimental analysis. In the discussion, we give a summary, scale our new formulation over some open problems.
2. Quantum Techniques
It is essential to understand the leading quantum techniques that exist to know what steps to follow for the implementation of an algorithm in quantum. And especially for this work that uses the QUBO formulation to solve the social workers’ problem.
There are several techniques for building a quantum computer, and the way it is currently done is by combining multiple various multicore processors . All of this brings to life numerous models of quantum computing: theoretical models, quantum circuit models, adiabatic quantum computing, measurement-based quantum computing, and topological quantum computing, being equivalent to each other within the reduction of polynomial-time. The most widespread and considerably developed model is the circuit model for gate-based quantum computation. The conceptual generalization of Boolean logic gates used for classical computing works for quantum computing as well . And, with the combination of these basic gates and the appropriate memory structures based on architecture, it gives life to the quantum computer. Quantum annealing has a somewhat different software stack structure than gate-based model quantum computers. The annealing-based computer must be viewed as a specific case of a quantum accelerator based on quantum gate algorithms. So instead of a quantum circuit, the level of abstraction is Ising’s classic model.
Currently, there are two dominant configurations for quantum computing: Quantum Annealing (D-Wave), in which problems are coded in quantum Hamiltonians and the natural dynamics of physical systems, and the Gate Model Quantum Calculus (IBM)   , in which the calculation is made through a series of discrete gate operations.
In quantum annealing, optimization is achieved by mapping the Hamiltonian optimization problem of a controllable quantum system so that the lowest-energy states correspond to optimal solutions. The quantum superconducting circuit analyzers produced by D-Wave Systems Inc are the most mature  . So, we can visualize a D-Wave quantum computer like is a physical representation of the Ising model like the one in Equation (1).
For gate-based machines, one of the most promising algorithms   for optimization is known by Ansatz Alternative Quantum Operator, also known as the Approximate Quantum Optimization Algorithm (QAOA) . QAOA is exclusively designed to run in polynomial time on Noisy Intermediate-Scale Quantum (NISQ)  devices and find optimal solutions to optimization problems. This algorithm is called to solve critical optimization problems that classically take exponential computational complexity to solve exactly. Although, in principle, QAOA could be considered a gate model or a continuous-time configuration  , also like the Variational Quantum Eigensolvers (VQE) .
As the experiment designed in this paper goes through the QUBO formulation, the Adiabatic Quantum Computing will be analyzed, which is an essential step for the implementation of our algorithm.
The Adiabatic Quantum Computing uses a concept of quantum physics known as the adiabatic theorem . The adiabatic theorem states that as long as this transformation occurs slow enough, the system has time to adapt and will remain in the lowest energy configuration .
The process followed by the AQC can be summarized in two very recognizable steps:
1) The first step is to prepare a system and initialize it to its lowest energy state known as the ground state.
2) The second step allows us to transform/map our problem in the system.
The researchers H. Nishimori and T. Kadowaki demonstrated that it is necessary to use Ising’s transversal model to code the problem to be optimized and activate it slowly. Equation (1) illustrates how we can use the adiabatic theorem for computation .
with and the Pauli matrices in X and Z respectively.
Taking into account that:
As mentioned above, if we want the system to be in the ground state, the initial state must be
with is the proper state of .
Now suppose that quantum annealing ends at , where and . The adiabatic theorem ensures that will be the ground state of such that the energy of the system will be the energy destined for the ground state. This is the basis of AQC. There are several derivatives of this technique, but it is not in line with this paper    .
As the given the social workers’ problem is purely combinatorial, and the recommended steps to follow when designing a combinatorial quantum algorithm are:
1) define the model in the QUBO formulation,
2) apply the change of variables to bring it to the Ising model,
3) and then use a variational algorithm to find the optimal solutions the VQE will be analyzed.
Unfortunately, we are still in the NISQ  era. Even, this era allowed the scientific community to develop hybrid algorithms that use the potential of quantum computing and especially the experience of classical algorithms in the areas of optimization—leaving quantum computers operations that require a very high computational cost.
One of the most famous algorithms is the Variational Quantum Eigensolver (VQE)    which is based on the variational principle . The native VQE will be used to find optimal solutions to our social workers’ problem.
VQE is a hybrid quantum-classical algorithm that combines quantum mechanical aspects to the classical algorithm. And its goal is to find approximate solutions to combinatorial problems. One of the fundamental approaches is to map the combinatorial problems onto a physics problem (Hamiltonian). Namely onto a problem that can be phrased in terms of a Hamiltonian of the Ising model. So, identify the solution to the combinatorial problem is related by finding the ground state of this physics problem. Thus, the goal is to find the ground state of this Hamiltonian. The approach we follow is related to the annealing algorithm.
The unknown eigenvectors are prepared by varying the experimental parameters and calculating the Rayleigh-Ritz ratio  in a classical minimization (Figure 1). At the end of the algorithm, the reconstruction of the eigenvector that is stored in the final set of experimental parameters that define the state will be done.
From the variational principle the following equation can be reached out, with as eigenvector and as the expected value. By this way, the VQE finds (4) such an optimal choice of parameters , that the expected value is minimized and that a lower eigenvalue is located.
3. Definition of the Social Workers Problem
Let n be the number of patients (users) and considering a weekly calendar of visits for each of them. Our objective is to find an optimal meeting’s timing which minimizes the cost of time travel; hence, money and maximize the number of visits to the patients in a work schedule.
In our case study, the daily schedule (Table 1), is set at 8 hours, and the distance between patients is at least 15 minutes.
· A set of social workers ( )
Figure 1. The variational quantum eigensolver diagram.
Table 1. Schedule of patient visits without any association with social workers.
Where U1 to U2 are the patients (users) and equal to the variable i or j of the mathematical formulation.
· A set of patients ( )
· A set of visits ( )
· each visit is linked to a patient: a patient can have multiple appointments on a day
· for each visit, we know the start time and duration
· Social workers can work at most 8 hours per day (that means, social workers cannot do a visit the first visit at 9:00 and end the last tour at 18:00) (removed to reduce the number of variables, so this can be solved using Qiskit1)
· We know the cost of travelling between each pair of patients. The cost can be seen as a function of travel time and distance.
The objective is the following:
· Find a schedule where each visit is assigned to a social worker
· We are minimizing the travel cost while also respecting that a social worker does not work more than 8 hours per day.
We design this formulation keeping in mind that our device does not admit inequality restrictions. For this, we will encode in some way the time information that will represent the limits of the constraints in the said formula.
4. Formulation of the Social Workers’ Problem
What we pursue is to avoid using the inequality constraints and use the least number of qubits. Within the real environments (not simulation) we have very few real qubits to test our algorithm. Therefore, we will base our algorithm on techniques already consolidated to achieve efficiency in several qubits.
Let be a complete graph directed with , as the set of nodes and as the set of edges, where node 0 represents the central, for a team of k social workers with the same capacity and n remaining nodes that represent geographically dispersed patients.
Each patient has a specific demand for visits . The non-negative travel cost is associated with each arc . To simplify, we consider that the distances are symmetrical. Where are the decision variables of the paths between two patients. The minimum number of social
workers needed to care for all patients is .
In this formulation, the objective function (5) minimizes total travel savings taking into account the new cost function with the time window. The restrictions of Equation (6) impose that exactly the arcs k leave the plant; (9) and (10) are the restrictions on the degree of entry and exit of the social worker from the central office. The constraints (11) are the route of continuity and the elimination of sub-courses, which ensure that the solution does not contain a sub-route disconnected from the exchange. Restrictions (12) are mandatory.
To solve the posed scheduling problem, we need a time variable. The Introduction of the time restriction (schedule) in the original QUBO formulation is a significant obstacle, as discussed above .
So, the strategy we follow is to incorporate the schedule information (calendar) of Table 1 in the weight variable. Equations (13) and (14) describe the temporal evolution of each social worker equivalent to achieve the scheduling parameters.
where is our weight and time window function, is the distance between the patient i and j and is our time window’s function. The function is a growing function, and we model it by a quadratic function to weigh short distances concerning large ones. We are taking into account that the first weight function is a distance function, we want to make behave like , and thus, be able to take full advantage of the behaviour of the primary objective function.
It is a weighted degree parameter of our time window function; is the start time of a time slot for patient i and for the patient j. where represents the maximum distance between all patients and, is the minimum distance between the gaps of all patients. The term is the time window.
The simplified Hamiltonian resulting from the schedule optimization problem is as follows:
5. Resolution of Social Workers’ Problem Based on QUBO Formulation
Let us solve our formulation in QUBO form by considering patients. Where Q is a matrix with as the number of qubits. So, in this case, qubits. Let’s remember that we are using binary variables so, .
Now, let’s develop step by step each term of (15) into the QUBO form considering the definition of our cost function from (13) and (14).
Grouping the terms (16) to (20) we reach out to the following expression:
Now let’s apply the binary variable property so,
Grouping similar terms:
Now let’s group the linear terms as following:
Now let’s group quadratic terms.
Recalling the quadratic form with the following terms.
We put Equations (13) and (14) together, and we arrive at the following expression:
There are several strategies to implement the objective function with inequality constraints. But each of these strategies requires additional variables that end up working as a stack. The approach most frequently used in the scientific community is to use auxiliary binary variables to convert inequality to equality and then proceed, as usual, by squaring the equality constraint following penalty theory .
These additional variables are translated into qubits; extra qubits that today are scarce for some experiments.
To do this, we define a strategy that allows us to solve combinatorial optimization problems with inequality constraints without the need to increase the number of qubits required.
Our strategy is based on coding the variables of time inequality, the time window following the formulation .
However, IBM’s significant contribution2 opens up promising horizons in quadratic programming with inequality constraints (with more additional qubits).
Now we only have to code the information in Table 1, the data (distance, costs and correction) of each patient and generate our weight matrix, which in turn will serve to calculate our variables linear g.
With all this, we already have all the components for one, write our objective function in the form QUBO and second solve it efficiently on quantum annealing computers.
6. QUBO to Ising Hamiltonian Formulation
As we already have our objective function as a QUBO in the form , now we can map our QUBO to Ising Hamiltonian formulation leads to calculating the values of and .
The transformation between Ising Hamiltonian and QUBO is , with Z as Pauli-Z matrix. This means that by writing an algorithm for QUBO with this single variable change, we will have the algorithm in Ising form. That is very useful to have the algorithm for various platforms that are based on quantum gates (meanly IBM Q) or quantum annealing (meanly D-Wave) in case of going from the Hamiltonian form.
Table 2. QUBO Q matrix for the social workers problem.
Next, we calculate these variables. We start with as is summarized in Table 3.
Let’s calculate the external forces :
Now let calculate .
Table 3. interaction forces between grid neighbours. We assume that for i and j are not adjacent.
Now let calculate .
Now let calculate .
Now let calculate .
Now let calculate .
Now let calculate .
Now let calculate .
Now let calculate .
Now let calculate .
Now let calculate .
Now let calculate .
Now let calculate .
With the calculated and (Table 2 and Table 4), we can now solve our Social Worker Problem with VQE or with the Quantum Exact Solver or with any variational method. We are considering that the superposition state (N qubits) of is described by .
Where the energy function is as follows and where the notation means that the Pauli-Z operator is applied to the single-qubit .
Table 4. Calculated values of the external force .
7. Results and Discussion
The first observation is that both the proposed cost function and the social workers’ problem formulation behave much better than we expected. Form the posed cost function, the quadratic function (27) acts very well for small numbers and also for large quantities. For intermediate numbers of , we use the value of to correct the resulting function. Figure 2 describes the analysis done in terms of .
The second comment is that we have considered a specific problem with a very generic vision that combines both a routing and scheduling problem. We have presented and detailed it to step by step in the QUBO formulation and to adapt the limitation of the latter. But we were making our formulation generic and above all making the time restrictions (time window) in the form of social workers’ schedules not grow proportionally in the number of qubits. This allows us to use the few useful qubits that we have for the most suitable operations.
The formulation that we have provided is feasible for any quantum architecture, however, due to the feasibility offered by IBMQ and its very active community, the viability of the code and experimentation have been done on Qiskit under its library aqua3.
All experiments performed, 100 in total, we have seen that the exact quantum solver behaves in the same way, in terms of the output result, as the classical solver that we have used (MIP Solver). On the one hand, the results obtained are
Figure 2. Comparison of performance with standard deviation error bar on the three mappings of our proposed formulation ((11), (12)). The Standard Deviation expected total anneal time for 99% percent success for each mapping value, with the best ε for each shoot are shown. Our optimal case is for . Our most representative cases are for , and .
Figure 3. Backtracking’s behaviour depending on the execution time and the number of patients.
Figure 4. VQE’s behaviour depending on the execution time and the number of patients and number of trials.
identical in more significant computational time for the quantum Exact Solver and QASM_simulator. Conceptually it is expected, since the priority of the era of quantum computing in which we are (NISQ), the most important thing is to compare the complexity and the good functioning of the quantum algorithm, not its execution time. Figure 3 and Figure 4 plot what we just mentioned.
On the other hand, the QASM_simulator, to obtain the same result we need to increase the number of seeds considerably up to 10,598 and max_trials close to 2000 within the VQE configuration. Therefore, we can see that in the case of Monday and Wednesday (Figure 5), the algorithm finds three paths instead of the two that it should have found.
It should be added that Figures 5-7 are the results for the case of 5 patients and two social workers with the values of seed = 10,598 and max_trials = 300 for the QASM_simulator.
The three banks of figures show us the results when using the classical solver as a cplex, or backtracking, when using the exact quantum solver and when using the ibmq_qasm_simulator from IBMQ4.
We can see that the three results are identical, which ensures that our algorithm works well. We can observe that our quantum algorithm responds to the classical solver. And in the experiments we did (Figure 3 and Figure 4), we were able to attend that, while the classical solver exhibits exponential behaviour as the number of patients (which would be the nodes of the graph) increases, the VQE algorithm, without taking into account the cost of evaluation and algorithm calibration, has logarithm growth. This, as the number of patients grows, will offer more significant advantages than a classic algorithm, such as Backtracking, since its temporary cost will be much lower for more complex problems. In other words, the quantum algorithm has a linear complexity compared to a classical solver.
7.1. Results from QUBO Form with Classical Solver
Figure 5. Result of the social workers’ algorithm by using classical solver.
7.2. Results from Ising Model with Quantum Exact Eigen Solver
Figure 6. Result of the social workers’ algorithm by using the quantum exact eigensolver.
7.3. Results from the Ising Model with Quantum ASM Simulator
Figure 7. Result of the social workers’ algorithm by using the ibmq_simulator.
8. Conclusions and Further Work
In this work, we have defined, written and solved a time-constrained combinatorial optimization problem in the form QUBO. The question of social workers has inequality constraints that are very difficult to tackle within the QUBO framework. To do this, we have defined a strategy to solve it in this NISQ era. We found the quantum efficient solution using Exact solver and VQE.
The future direction of this work will be modelling the social workers’ problem into the IBM docplex. And compare the complexity of quantum algorithms in the face of the classic ones. Also, it is worth saying that our proposal is not limited exclusively to the case of social workers, but to all combinatorial optimization problems that require routing and scheduling features.
The authors greatly thank the IBMQ team and, mainly Steve Wood and Jennifer Ramírez Molino for their valuable discussions that have made this work possible.
 Bozejko, W., Pempera, J. and Smutnicki, C. (2009) Parallel Simulated Annealing for the Job Shop Scheduling Problem. International Conference on Computational Science, Baton Rouge, 25-27 May 2009, 631-640.
 McGeoch, C.C. (2014) Adiabatic Quantum Computation and Quantum Annealing: Theory and Practice (Synthesis Lectures on Quantum Computing). Morgan & Claypool, San Rafael.
 Bertels, K., Sarkar, A., Mouedenne, A., Hubregtsen, T., Yadav, A., Krol, A. and Ashraf, I. (2019) Quantum Computer Architecture: Towards Full-Stack Quantum Accelerators. Design, Automation & Test in Europe Conference & Exhibition (DATE), Grenoble, 9-13 March 2020, 1-6.
 Rieffel, E.G., Venturelli, D., O’Gorman, B., Do, M.B., Prystay, E. and Smelyanskiy, V.N. (2014) A Case Study in Programming a Quantum Annealer for Hard Operational Planning Problems. Quantum Information Processing, 14, 1-36.
 Peruzzo, A., McClean, J., Shadbolt, P., Yung, M.-H., Zhou, X.-Q., Love, P.J., Aspuru-Guzik, A. and O’Brien, J.L. (2013) A Variational Eigenvalue Solver on a Quantum Processor. Nature Communications, 5, Article No. 4213.
 Lechner, W., Hauke, P. and Zoller, P. (2015) A Quantum Annealing Architecture with All-to-All Connectivity from Local Interactions. Science Advances, 1, e1500838.
 Tran, T.T., Do, M., Rieffel, E.G., Frank, J., Wang, Z., O’Gorman, B., Venturelli, D. and Beck, J. (2016) A Hybrid Quantum-Classical Approach to Solving Scheduling Problems. Proceedings of the Ninth International Symposium on Combinatorial Search, Vancover, 20 June 2016, 98-106.
 Grimsley, H.R., Economou, S.E., Barnes, E. and Mayhall, N.J. (2019) An Adaptive Variational Algorithm for Exact Molecular Simulations on a Quantum Computer. Nature Communications, 10, 3007.