# A QUBO Model for the Traveling Salesman Problem with Time Windows

^{*}

## Abstract

**:**

## 1. Introduction

**Contribution**. In this paper, we give the first, to the best of our knowledge, QUBO formulation for the TSP with Time Windows. The existence of an Ising or QUBO formulation for a problem is the essential precondition for its solution on the current generation of D-Wave computers. For the vanilla TSP, there exists such a formulation, as presented in an elegant and comprehensive manner in [33], which has enabled the actual solution of TSP instances on the D-Wave platform (see [36,37,38]). In contrast, prior to this work, the TSPTW had not been cast in the QUBO framework. This can be attributed to the extra difficulty of expressing the time window constraints of TSPTW. We hope and expect that the formulation presented here will lead to the experimental execution of small-scale TSPTW instances.

## 2. Related Work

#### Previous Work on TSPTW

## 3. The Classical Formulation of the TSPTW

**Definition**

**1.**

**Definition**

**2.**

**Definition**

**3.**

**Definition**

**4.**

- minimize the sum of the arc traversal costs along the tour; and
- minimize the time to return to the depot.

**arrival time**at the ith customer and the time at which

**service**starts at the ith customer, which are denoted by ${A}_{{p}_{i}}$ and ${D}_{{p}_{i}}$, respectively. At this point, we make the important observation that ${D}_{{p}_{i}}$ is the

**departure time**from the ith customer in the case of

**zero service time**. The assumption of zero service time is widely used in the literature in order to simplify the problem, and, thus, we too follow this assumption in our presentation.

#### 3.1. Small Scale Examples for the TSPTW

#### 3.1.1. A Four-Node Example

#### 3.1.2. A Five-Node Example

## 4. A QUBO Formulation for the TSPTW

- For each i, $1\le i\le n+1$, exactly one of the binary variables ${x}_{u,v}^{i}$ is 1, where u and v range freely from 0 to n, with the proviso that $u\ne v$. As a matter of fact, when $i=1$ and $i=n+1$, we can be more precise. In the former case, exactly one of the binary variables ${x}_{0,v}^{1}$ is 1, where v ranges from 1 to n, and, in the latter case, exactly one of the binary variables ${x}_{v,0}^{n+1}$ is 1, where v ranges from 1 to n.
- In addition to the above constraints, for each u, $1\le u\le n$, exactly one of the binary variables ${x}_{u,v}^{i}$ is 1, where i ranges from 2 to $n+1$ and v ranges from 1 to n. Obviously, when $i=n+1$, the only relevant decision variable is ${x}_{u,0}^{n+1}$.
- Symmetrically, we also have the constraint that for every v, $1\le v\le n$, exactly one of the binary variables ${x}_{u,v}^{i}$ is 1, where i ranges from 1 to n and u ranges from 1 to n. Again, we point out that, in case $i=1$, the only relevant decision variable is ${x}_{0,v}^{1}$.

**Example**

**1.**

**Definition**

**5.**

**time margin**of the customer at position i is ${l}_{v}-{A}_{{p}_{i}}$.

**Example**

**2.**

**Example**

**3.**

## 5. Conclusions and Future Work

## Author Contributions

## Funding

## Conflicts of Interest

## Abbreviations

QPU | Quantum Processing Unit |

QUBO | Quadratic Unconstrained Binary Optimization |

TSP | Traveling Salesman Problem |

TSPTW | Traveling Salesman Problem with Time Windows |

## References

- Feynman, R.P. Simulating physics with computers. Int. J. Theor. Phys.
**1982**, 21, 467–488. [Google Scholar] [CrossRef] - Shor, P.W. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM Rev.
**1999**, 41, 303–332. [Google Scholar] [CrossRef] - Grover, L. A fast quantum mechanical algorithm for database search. In Proceedings of the Twenty-Eighth Annual ACM Symposium on the Theory of Computing, Philadelphia, PA, USA, 22–24 May 1996. [Google Scholar]
- Nielsen, M.A.; Chuang, I.L. Quantum Computation and Quantum Information; Cambridge University Press: Cambridge, UK, 2010. [Google Scholar]
- Farhi, E.; Goldstone, J.; Gutmann, S.; Sipser, M. Quantum computation by adiabatic evolution. arXiv
**2000**, arXiv:quant-ph/0001106. [Google Scholar] - Farhi, E.; Goldstone, J.; Gutmann, S.; Lapan, J.; Lundgren, A.; Preda, D. A quantum adiabatic evolution algorithm applied to random instances of an NP-complete problem. Science
**2001**, 292, 472–475. [Google Scholar] [CrossRef] - Choi, V. Minor-embedding in adiabatic quantum computation: I. The parameter setting problem. Quantum Inf. Process.
**2008**, 7, 193–209. [Google Scholar] [CrossRef][Green Version] - Messiah, A. Quantum Mechanics; Dover Publications: New York, NY, USA, 1961. [Google Scholar]
- Amin, M. Consistency of the adiabatic theorem. Phys. Rev. Lett.
**2009**, 102, 220401. [Google Scholar] [CrossRef] - Aharonov, D.; van Dam, W.; Kempe, J.; Landau, Z.; Lloyd, S.; Regev, O. Adiabatic Quantum Computation Is Equivalent to Standard Quantum Computation. SIAM Rev.
**2008**, 50, 755–787. [Google Scholar] [CrossRef][Green Version] - Kadowaki, T. Study of optimization problems by quantum annealing. arXiv
**2002**, arXiv:quant-ph/0205020. [Google Scholar] - Kadowaki, T.; Nishimori, H. Quantum annealing in the transverse Ising model. Phys. Rev. E
**1998**, 58, 5355. [Google Scholar] [CrossRef] - Kirkpatrick, S.; Gelatt, C.D.; Vecchi, M.P. Optimization by simulated annealing. Science
**1983**, 220, 671–680. [Google Scholar] [CrossRef] - Pakin, S. Performing fully parallel constraint logic programming on a quantum annealer. Theory Pract. Logic Programm.
**2018**, 18, 928–949. [Google Scholar] [CrossRef][Green Version] - Perdomo-Ortiz, A.; Dickson, N.; Drew-Brook, M.; Rose, G.; Aspuru-Guzik, A. Finding low-energy conformations of lattice protein models by quantum annealing. Sci. Rep.
**2012**, 2, 571. [Google Scholar] [CrossRef] [PubMed][Green Version] - Sarkar, A. Quantum Algorithms: For Pattern-Matching in Genomic Sequences. Master’s Thesis, Delft University of Technology, Delft, The Netherlands, 2018. [Google Scholar]
- Biamonte, J.; Wittek, P.; Pancotti, N.; Rebentrost, P.; Wiebe, N.; Lloyd, S. Quantum machine learning. Nature
**2017**, 549, 195. [Google Scholar] [CrossRef] [PubMed] - Papalitsas, C.; Karakostas, P.; Andronikos, T.; Sioutas, S.; Giannakis, K. Combinatorial GVNS (General Variable Neighborhood Search) Optimization for Dynamic Garbage Collection. Algorithms
**2018**, 11, 38. [Google Scholar] [CrossRef] - Rebentrost, P.; Schuld, M.; Wossnig, L.; Petruccione, F.; Lloyd, S. Quantum gradient descent and Newton’s method for constrained polynomial optimization. New J. Phys.
**2019**, 21, 073023. [Google Scholar] [CrossRef] - D-Wave System. Getting Started with the D-Wave System; Technical Report for D-Wave Systems. 2019. Available online: https://docs.dwavesys.com/docs/latest/_downloads/09-1076A-T_GettingStarted.pdf (accessed on 24 October 2019).
- Boothby, K.; Bunyk, P.; Raymond, J.; Roy, A. Next-Generation Topology of D-Wave Quantum Processors; Technical Report for D-Wave Systems. 2019. Available online: https://www.dwavesys.com/sites/default/files/14-\1026A-C_Next-Generation-Topology-of-DW-Quantum-Processors.pdf (accessed on 24 October 2019).
- Dattani, N.; Szalay, S.; Chancellor, N. Pegasus: The second connectivity graph for large-scale quantum annealing hardware. arXiv
**2019**, arXiv:1901.07636. [Google Scholar] - Dattani, N.; Chancellor, N. Embedding quadratization gadgets on Chimera and Pegasus graphs. arXiv
**2019**, arXiv:1901.07676. [Google Scholar] - Boros, E.; Crama, Y.; Hammer, P.L. Upper-bounds for quadratic 0–1 maximization. Oper. Res. Lett.
**1990**, 9, 73–79. [Google Scholar] [CrossRef] - Lewis, M.; Glover, F. Quadratic unconstrained binary optimization problem preprocessing: Theory and empirical analysis. Networks
**2017**, 70, 79–97. [Google Scholar] [CrossRef] - Kochenberger, G.; Hao, J.K.; Glover, F.; Lewis, M.; Lü, Z.; Wang, H.; Wang, Y. The unconstrained binary quadratic programming problem: A survey. J. Comb. Optim.
**2014**, 28, 58–81. [Google Scholar] [CrossRef] - Lloyd, S.; Mohseni, M.; Rebentrost, P. Quantum algorithms for supervised and unsupervised machine learning. arXiv
**2013**, arXiv:1307.0411. [Google Scholar] - Hauke, P.; Katzgraber, H.G.; Lechner, W.; Nishimori, H.; Oliver, W.D. Perspectives of quantum annealing: Methods and implementations. arXiv
**2019**, arXiv:1903.06559. [Google Scholar] - Glover, F.; Kochenberger, G. A Tutorial on Formulating QUBO Models. arXiv
**2018**, arXiv:1811.11538. [Google Scholar] - Boros, E.; Hammer, P.L.; Tavares, G. Local search heuristics for quadratic unconstrained binary optimization (QUBO). J. Heuristics
**2007**, 13, 99–132. [Google Scholar] [CrossRef] - Ushijima-Mwesigwa, H.; Negre, C.F.; Mniszewski, S.M. Graph partitioning using quantum annealing on the D-Wave system. In Proceedings of the Second International Workshop on Post Moores Era Supercomputing, Denver, CO, USA, 12–17 November 2017; ACM: New York, NY, USA, 2017; pp. 22–29. [Google Scholar]
- Newell, G.F.; Montroll, E.W. On the theory of the Ising model of ferromagnetism. Rev. Mod. Phys.
**1953**, 25, 353. [Google Scholar] [CrossRef] - Lucas, A. Ising formulations of many NP problems. Front. Phys.
**2014**, 2, 5. [Google Scholar] [CrossRef] - Neukart, F.; Compostella, G.; Seidel, C.; Von Dollen, D.; Yarkoni, S.; Parney, B. Traffic flow optimization using a quantum annealer. Front. ICT
**2017**, 4, 29. [Google Scholar] [CrossRef] - Martoňák, R.; Santoro, G.E.; Tosatti, E. Quantum annealing of the traveling-salesman problem. Phys. Rev. E
**2004**, 70, 057701. [Google Scholar] [CrossRef] - Warren, R.H. Adapting the traveling salesman problem to an adiabatic quantum computer. Quantum Inf. Process.
**2013**, 12, 1781–1785. [Google Scholar] [CrossRef] - Warren, R.H. Small traveling salesman problems. J. Adv. Appl. Math.
**2017**, 2. [Google Scholar] [CrossRef] - Feld, S.; Roch, C.; Gabor, T.; Seidel, C.; Neukart, F.; Galter, I.; Mauerer, W.; Linnhoff-Popien, C. A hybrid solution method for the capacitated vehicle routing problem using a quantum annealer. arXiv
**2018**, arXiv:1811.07403. [Google Scholar] [CrossRef] - Irie, H.; Wongpaisarnsin, G.; Terabe, M.; Miki, A.; Taguchi, S. Quantum annealing of vehicle routing problem with time, state and capacity. In International Workshop on Quantum Technology and Optimization Problems; Springer: Cham, Switzerland, 2019; pp. 145–156. [Google Scholar]
- Neven, H.; Denchev, V.S.; Rose, G.; Macready, W.G. Training a large scale classifier with the quantum adiabatic algorithm. arXiv
**2009**, arXiv:0912.0779. [Google Scholar] - Garnerone, S.; Zanardi, P.; Lidar, D.A. Adiabatic quantum algorithm for search engine ranking. Phys. Rev. Lett.
**2012**, 108, 230506. [Google Scholar] [CrossRef] [PubMed] - Cruz-Santos, W.; Venegas-Andraca, S.; Lanzagorta, M. A QUBO Formulation of the Stereo Matching Problem for D-Wave Quantum Annealers. Entropy
**2018**, 20, 786. [Google Scholar] [CrossRef] - Venegas-Andraca, S.E.; Cruz-Santos, W.; McGeoch, C.; Lanzagorta, M. A cross-disciplinary introduction to quantum annealing-based algorithms. Contemp. Phys.
**2018**, 59, 174–197. [Google Scholar] [CrossRef][Green Version] - Hadfield, S.; Wang, Z.; O’Gorman, B.; Rieffel, E.G.; Venturelli, D.; Biswas, R. From the quantum approximate optimization algorithm to a quantum alternating operator ansatz. Algorithms
**2019**, 12, 34. [Google Scholar] [CrossRef] - Babbush, R.; Love, P.J.; Aspuru-Guzik, A. Adiabatic quantum simulation of quantum chemistry. Sci. Rep.
**2014**, 4, 6603. [Google Scholar] [CrossRef] - Oliveira, N.M.D.; Silva, R.M.D.A.; Oliveira, W.R.D. QUBO formulation for the contact map overlap problem. Int. J. Quantum Inf.
**2018**, 16, 1840007. [Google Scholar] [CrossRef] - Crispin, A.; Syrichas, A. Quantum annealing algorithm for vehicle scheduling. In Proceedings of the 2013 IEEE International Conference on Systems, Man, and Cybernetics, Manchester, UK, 13–16 October 2013; pp. 3523–3528. [Google Scholar]
- Cai, B.B.; Zhang, X.H. Hybrid Quantum Genetic Algorithm and Its Application in VRP. Comput. Simul.
**2010**, 7, 267–270. [Google Scholar] - Binder, K.; Young, A. Spin glasses: Experimental facts, theoretical concepts, and open questions. Rev. Mod. Phys.
**1986**, 58, 801. [Google Scholar] [CrossRef] - Young, A.P. Spin Glasses and Random Fields; World Scientific: Singapore, 1998; Volume 12. [Google Scholar]
- Nishimori, H. Statistical Physics of Spin Glasses and Information Processing: An Introduction; Number 111; Clarendon Press: Boston, MA, USA, 2001. [Google Scholar]
- Venturelli, D.; Mandra, S.; Knysh, S.; O’Gorman, B.; Biswas, R.; Smelyanskiy, V. Quantum optimization of fully connected spin glasses. Phys. Rev. X
**2015**, 5, 031040. [Google Scholar] [CrossRef] - Titiloye, O.; Crispin, A. Quantum annealing of the graph coloring problem. Discret. Optim.
**2011**, 8, 376–384. [Google Scholar] [CrossRef][Green Version] - Venturelli, D.; Marchand, D.J.; Rojo, G. Quantum annealing implementation of job-shop scheduling. arXiv
**2015**, arXiv:1506.08479. [Google Scholar] - Benedetti, M.; Realpe-Gómez, J.; Biswas, R.; Perdomo-Ortiz, A. Quantum-assisted learning of hardware-embedded probabilistic graphical models. Phys. Rev. X
**2017**, 7, 041052. [Google Scholar] [CrossRef] - Battaglia, D.A.; Santoro, G.E.; Tosatti, E. Optimization by quantum annealing: Lessons from hard satisfiability problems. Phys. Rev. E
**2005**, 71, 066707. [Google Scholar] [CrossRef][Green Version] - Alom, M.Z.; Van Essen, B.; Moody, A.T.; Widemann, D.P.; Taha, T.M. Quadratic Unconstrained Binary Optimization (QUBO) on neuromorphic computing system. In Proceedings of the 2017 International Joint Conference on Neural Networks (IJCNN), Anchorage, AK, USA, 14–19 May 2017; pp. 3922–3929. [Google Scholar]
- Barán, B.; Villagra, M. A Quantum Adiabatic Algorithm for Multiobjective Combinatorial Optimization. Axioms
**2019**, 8, 32. [Google Scholar] [CrossRef] - Sotiropoulos, D.; Stavropoulos, E.; Vrahatis, M. A new hybrid genetic algorithm for global optimization. Nonlinear Anal. Theory Methods Appl.
**1997**, 30, 4529–4538. [Google Scholar] [CrossRef][Green Version] - Pardalos, P.M.; Rodgers, G.P. Computational aspects of a branch and bound algorithm for quadratic zero-one programming. Computing
**1990**, 45, 131–144. [Google Scholar] [CrossRef] - Farhi, E.; Goldstone, J.; Gutmann, S. A quantum approximate optimization algorithm. arXiv
**2014**, arXiv:1411.4028. [Google Scholar] - Pagano, G.; Bapat, A.; Becker, P.; Collins, K.; De, A.; Hess, P.; Kaplan, H.; Kyprianidis, A.; Tan, W.; Baldwin, C.; et al. Quantum Approximate Optimization with a Trapped-Ion Quantum Simulator. arXiv
**2019**, arXiv:1906.02700. [Google Scholar] - Farhi, E.; Harrow, A.W. Quantum supremacy through the quantum approximate optimization algorithm. arXiv
**2016**, arXiv:1602.07674. [Google Scholar] - Vyskocil, T.; Djidjev, H. Embedding Equality Constraints of Optimization Problems into a Quantum Annealer. Algorithms
**2019**, 12, 77. [Google Scholar] [CrossRef] - Mahasinghe, A.; Hua, R.; Dinneen, M.J.; Goyal, R. Solving the Hamiltonian Cycle Problem Using a Quantum Computer. In Proceedings of the Australasian Computer Science Week Multiconference, Sydney, NSW, Australia, 29–31 January 2019; ACM: New York, NY, USA, 2019; pp. 8:1–8:9. [Google Scholar] [CrossRef]
- Lahoz-Beltra, R. Quantum genetic algorithms for computer scientists. Computers
**2016**, 5, 24. [Google Scholar] [CrossRef] - Rosenberg, G.; Vazifeh, M.; Woods, B.; Haber, E. Building an iterative heuristic solver for a quantum annealer. Comput. Optim. Appl.
**2016**, 65, 845–869. [Google Scholar] [CrossRef][Green Version] - Langevin, A.; Desrochers, M.; Desrosiers, J.; Gélinas, S.; Soumis, F. A two-commodity flow formulation for the traveling salesman and the makespan problems with time windows. Networks
**1993**, 23, 631–640. [Google Scholar] [CrossRef] - Dumas, Y.; Desrosiers, J.; Gelinas, E.; Solomon, M.M. An optimal algorithm for the traveling salesman problem with time windows. Oper. Res.
**1995**, 43, 367–371. [Google Scholar] [CrossRef] - Gendreau, M.; Hertz, A.; Laporte, G.; Stan, M. A generalized insertion heuristic for the traveling salesman problem with time windows. Oper. Res.
**1998**, 46, 330–335. [Google Scholar] [CrossRef] - Da Silva, R.F.; Urrutia, S. A General VNS heuristic for the traveling salesman problem with time windows. Discret. Optim.
**2010**, 7, 203–211. [Google Scholar] [CrossRef][Green Version] - Papalitsas, C.; Giannakis, K.; Andronikos, T.; Theotokis, D.; Sifaleras, A. Initialization methods for the TSP with Time Windows using Variable Neighborhood Search. In Proceedings of the 2015 6th International Conference on Information, Intelligence, Systems and Applications (IISA 2015), Corfu, Greece, 6–8 July 2015. [Google Scholar]
- Papalitsas, C.; Karakostas, P.; Kastampolidou, K. A Quantum Inspired GVNS: Some Preliminary Results. In GeNeDis 2016; Vlamos, P., Ed.; Springer International Publishing: Cham, Switzerland, 2017; pp. 281–289. [Google Scholar]
- Papalitsas, C.; Andronikos, T. Unconventional GVNS for Solving the Garbage Collection Problem with Time Windows. Technologies
**2019**, 7, 61. [Google Scholar] [CrossRef] - Ohlmann, J.W.; Thomas, B.W. A compressed-annealing heuristic for the traveling salesman problem with time windows. INFORMS J. Comput.
**2007**, 19, 80–90. [Google Scholar] [CrossRef] - Vyskočil, T.; Pakin, S.; Djidjev, H.N. Embedding Inequality Constraints for Quantum Annealing Optimization. In Quantum Technology and Optimization Problems; Feld, S., Linnhoff-Popien, C., Eds.; Springer International Publishing: Cham, Switzerland, 2019; pp. 11–22. [Google Scholar]

**Figure 1.**The above graph depicts the network ${G}_{1}$ consisting of three nodes plus the depot (node 0).

**Figure 2.**The above graph depicts an example of a tour consisting of four nodes plus the depot (node 0).

**Table 1.**Quantitative characteristics (qubits and connectivity) of the Chimera topology of previous D-Wave generations (from [22]).

D-Wave One | D-Wave Two | D-Wave 2X | D-Wave 2000Q | |
---|---|---|---|---|

Size | $4\times 4$ | $8\times 8$ | $12\times 12$ | $16\times 16$ |

Qubits | 128 | 512 | 1152 | 2048 |

Node # | X | Y | Ready Time | Due Date |
---|---|---|---|---|

0 | 2 | 2 | 1 | 30 |

1 | 2 | 3 | 14 | 15 |

2 | 3 | 3 | 12 | 25 |

3 | 3 | 4 | 4 | 5 |

Node 0 | Node 1 | Node 2 | Node 3 | |
---|---|---|---|---|

Node 0 | 0 | 1 | 1.41 | 2.23 |

Node 1 | 1 | 0 | 1 | 1.41 |

Node 2 | 1.41 | 1 | 0 | 1 |

Node 3 | 2.23 | 1.41 | 1 | 0 |

Ordering | Node 0 | Node 3 | Node 2 | Node 1 |
---|---|---|---|---|

cost | 0 < 1 | 3.23 < 4 | 5 < 12 | 13 < 14 |

feasibility | yes | yes | yes | yes |

Node # | X | Y | Ready Time | Due Date |
---|---|---|---|---|

0 | 2 | 2 | 1 | 30 |

1 | 2 | 3 | 14 | 15 |

2 | 3 | 3 | 12 | 25 |

3 | 3 | 4 | 4 | 5 |

4 | 2 | 1 | 8 | 10 |

Node 0 | Node 1 | Node 2 | Node 3 | Node 4 | |
---|---|---|---|---|---|

Node 0 | 0 | 1 | 1.41 | 2.23 | 1 |

Node 1 | 1 | 0 | 1 | 1.41 | 2 |

Node 2 | 1.41 | 1 | 0 | 1 | 2.23 |

Node 3 | 2.23 | 1.41 | 1 | 0 | 3.16 |

Node 4 | 1 | 2 | 2.23 | 3.16 | 0 |

Ordering | Node 0 | Node 3 | Node 4 | Node 2 | Node 1 |
---|---|---|---|---|---|

cost | 0 < 1 | 2.23 < 4 | 7.16 < 8 | 10 < 12 | 12 < 14 |

feasibility | yes | yes | yes | yes | yes |

© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Papalitsas, C.; Andronikos, T.; Giannakis, K.; Theocharopoulou, G.; Fanarioti, S. A QUBO Model for the Traveling Salesman Problem with Time Windows. *Algorithms* **2019**, *12*, 224.
https://doi.org/10.3390/a12110224

**AMA Style**

Papalitsas C, Andronikos T, Giannakis K, Theocharopoulou G, Fanarioti S. A QUBO Model for the Traveling Salesman Problem with Time Windows. *Algorithms*. 2019; 12(11):224.
https://doi.org/10.3390/a12110224

**Chicago/Turabian Style**

Papalitsas, Christos, Theodore Andronikos, Konstantinos Giannakis, Georgia Theocharopoulou, and Sofia Fanarioti. 2019. "A QUBO Model for the Traveling Salesman Problem with Time Windows" *Algorithms* 12, no. 11: 224.
https://doi.org/10.3390/a12110224