<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v2.3 20070202//EN" "journalpublishing.dtd">
<article article-type="brief-report" dtd-version="2.3" xml:lang="EN" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">
<front>
<journal-meta>
<journal-id journal-id-type="publisher-id">Front. Phys.</journal-id>
<journal-title>Frontiers in Physics</journal-title>
<abbrev-journal-title abbrev-type="pubmed">Front. Phys.</abbrev-journal-title>
<issn pub-type="epub">2296-424X</issn>
<publisher>
<publisher-name>Frontiers Media S.A.</publisher-name>
</publisher>
</journal-meta>
<article-meta>
<article-id pub-id-type="publisher-id">760783</article-id>
<article-id pub-id-type="doi">10.3389/fphy.2021.760783</article-id>
<article-categories>
<subj-group subj-group-type="heading">
<subject>Physics</subject>
<subj-group>
<subject>Brief Research Report</subject>
</subj-group>
</subj-group>
</article-categories>
<title-group>
<article-title>Solving the Traveling Salesman Problem on the D-Wave Quantum Computer</article-title>
<alt-title alt-title-type="left-running-head">Jain</alt-title>
<alt-title alt-title-type="right-running-head">Quantum Solution of TSP</alt-title>
</title-group>
<contrib-group>
<contrib contrib-type="author" corresp="yes">
<name>
<surname>Jain</surname>
<given-names>Siddharth</given-names>
</name>
<xref ref-type="corresp" rid="c001">&#x2a;</xref>
<uri xlink:href="https://loop.frontiersin.org/people/1444554/overview"/>
</contrib>
</contrib-group>
<aff>Supply Chain Digital &#x26; Data Science, Johnson &#x26; Johnson, <addr-line>Bridgewater</addr-line>, <addr-line>NJ</addr-line>, <country>United&#x20;States</country>
</aff>
<author-notes>
<fn fn-type="edited-by">
<p>
<bold>Edited by:</bold> <ext-link ext-link-type="uri" xlink:href="https://loop.frontiersin.org/people/1112414/overview">Jingfu Zhang</ext-link>, Technical University Dortmund, Germany</p>
</fn>
<fn fn-type="edited-by">
<p>
<bold>Reviewed by:</bold> <ext-link ext-link-type="uri" xlink:href="https://loop.frontiersin.org/people/177579/overview">Adrian Paul Flitney</ext-link>, RMIT University, Australia</p>
<p>
<ext-link ext-link-type="uri" xlink:href="https://loop.frontiersin.org/people/1460452/overview">Tao Xin</ext-link>, South University of Science and Technology, China</p>
</fn>
<corresp id="c001">&#x2a;Correspondence: Siddharth Jain, <email>sjain68@its.jnj.com</email>
</corresp>
<fn fn-type="other">
<p>This article was submitted to Quantum Engineering and Technology, a section of the journal Frontiers in Physics</p>
</fn>
</author-notes>
<pub-date pub-type="epub">
<day>12</day>
<month>11</month>
<year>2021</year>
</pub-date>
<pub-date pub-type="collection">
<year>2021</year>
</pub-date>
<volume>9</volume>
<elocation-id>760783</elocation-id>
<history>
<date date-type="received">
<day>18</day>
<month>08</month>
<year>2021</year>
</date>
<date date-type="accepted">
<day>12</day>
<month>10</month>
<year>2021</year>
</date>
</history>
<permissions>
<copyright-statement>Copyright &#xa9; 2021 Jain.</copyright-statement>
<copyright-year>2021</copyright-year>
<copyright-holder>Jain</copyright-holder>
<license xlink:href="http://creativecommons.org/licenses/by/4.0/">
<p>This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these&#x20;terms.</p>
</license>
</permissions>
<abstract>
<p>The traveling salesman problem is a well-known NP-hard problem in combinatorial optimization. This paper shows how to solve it on an Ising Hamiltonian based quantum annealer by casting it as a quadratic unconstrained binary optimization (QUBO) problem. Results of practical experiments are also presented using D-Wave&#x2019;s 5,000 qubit Advantage 1.1 quantum annealer and the performance is compared to a classical solver. It is found the quantum annealer can only handle a problem size of 8 or less nodes and its performance is subpar compared to the classical solver both in terms of time and accuracy.</p>
</abstract>
<kwd-group>
<kwd>traveling salesman problem</kwd>
<kwd>QUBO</kwd>
<kwd>D-wave</kwd>
<kwd>quantum annealing</kwd>
<kwd>combinatorial optimization</kwd>
</kwd-group>
</article-meta>
</front>
<body>
<sec id="s1">
<title>1 Introduction</title>
<p>The traveling salesman problem is a well-known NP-hard problem in combinatorial optimization supported by an extensive body of research [<xref ref-type="bibr" rid="B1">1</xref>]. Given a fully connected graph of <italic>n</italic> nodes and a <italic>n</italic>&#x20;&#xd7; <italic>n</italic> adjacency matrix <italic>M</italic> whose entries give the cost to travel from node <italic>i</italic> to node <italic>j</italic> and <italic>M</italic>
<sub>
<italic>ii</italic>
</sub> &#x3d; 0, the goal is to output a roundtrip (cycle) that minimizes the cost of traversing all the nodes in the graph (each node is traversed exactly once&#x20;and so has exactly one ingress and one egress). We restrict ourselves to the case when the cost to travel from node <italic>i</italic> to node <italic>j</italic> is same as the cost to travel from node <italic>j</italic> to node <italic>i</italic> (negative&#x20;values of cost are permissible) and is further given by <italic>M</italic>
<sub>
<italic>ij</italic>
</sub> &#x2b; <italic>M</italic>
<sub>
<italic>ji</italic>
</sub>. If we let <italic>X</italic> be a <italic>n</italic>&#x20;&#xd7; <italic>n</italic> symmetrical indicator matrix consisting of 0&#x2009;s and 1&#x2009;s (<italic>x</italic>
<sub>
<italic>ij</italic>
</sub> &#x3d; 1 if node <italic>i</italic> is adjacent to node <italic>j</italic> in the output cycle; we will also call this as the nodes being connected in the output cycle or graph; this is not to be confused with whether the nodes are connected in the input graph which they always are), we seek to find the <italic>X</italic> that minimizes <italic>&#x2211;M</italic>.&#x2009;&#x2217;&#x2009;<italic>X</italic> where .&#x2217; denotes element-wise multiplication of matrices and <italic>&#x2211;</italic> denotes sum over elements of the matrix.</p>
<p>This paper describes a quantum solution to this problem that leverages adiabatic quantum&#x20;computation. Adiabatic quantum computation is one of the two paradigms of quantum computation&#x2014;gate-based model being the other one. In adiabatic quantum computation, a system of qubits is prepared in an initial ground state associated with the Hamiltonian <italic>H</italic>
<sub>0</sub> and the system is gradually evolved to a target state whose Hamiltonian is given by <italic>H</italic>
<sub>1</sub>. If the time evolution is done slowly enough, the theorem of adiabatic quantum computation guarantees that the qubits will track the ground state of the evolving Hamiltonian and at the end they will be found in the ground state corresponding to <italic>H</italic>
<sub>1</sub>. Mathematically, if<disp-formula id="e1">
<mml:math id="m1">
<mml:mi>H</mml:mi>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mi>t</mml:mi>
</mml:mrow>
</mml:mfenced>
<mml:mo>&#x3d;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mn>1</mml:mn>
<mml:mo>&#x2212;</mml:mo>
<mml:mi>t</mml:mi>
</mml:mrow>
</mml:mfenced>
<mml:msub>
<mml:mrow>
<mml:mi>H</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>0</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>&#x2b;</mml:mo>
<mml:mi>t</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>H</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
</mml:math>
<label>(1)</label>
</disp-formula>where <italic>t</italic> is some normalized unit of time, then <italic>H</italic>(0) &#x3d; <italic>H</italic>
<sub>0</sub>, <italic>H</italic>(1) &#x3d; <italic>H</italic>
<sub>1</sub>. <italic>H</italic>
<sub>0</sub> is the starting Hamiltonian (initial conditions) and at time <italic>t</italic>&#x20;&#x3d; 1 the qubits will assume values that minimize the energy associated with&#x20;<italic>H</italic>
<sub>1</sub>.</p>
<p>Up until now the discussion is general. D-Wave&#x2019;s<xref ref-type="fn" rid="FN1">
<sup>1</sup>
</xref> quantum computers are special purpose devices that aim to realize adiabatic quantum computation through quantum annealing where the Hamiltonian is constrained to be an Ising Hamiltonian. The energy (eigenvalues) associated with the target state <italic>H</italic>
<sub>1</sub> is given by:<disp-formula id="e2">
<mml:math id="m2">
<mml:msub>
<mml:mrow>
<mml:mi>E</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>I</mml:mi>
<mml:mi>s</mml:mi>
<mml:mi>i</mml:mi>
<mml:mi>n</mml:mi>
<mml:mi>g</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>&#x3d;</mml:mo>
<mml:mo>&#x2212;</mml:mo>
<mml:munder>
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:munder>
<mml:msub>
<mml:mrow>
<mml:mi>h</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
<mml:msub>
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>&#x2212;</mml:mo>
<mml:munder>
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:munder>
<mml:munder>
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>j</mml:mi>
<mml:mo>&#x2260;</mml:mo>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:munder>
<mml:msub>
<mml:mrow>
<mml:mi>J</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:msub>
<mml:msub>
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
<mml:msub>
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:msub>
</mml:math>
<label>(2)</label>
</disp-formula>
</p>
<p>The Ising constraint is a natural consequence of how the device is built and wired. It is a system of superconducting qubits obeying the Ising model. In <xref ref-type="disp-formula" rid="e2">Eq. 2</xref>, <italic>h</italic>
<sub>
<italic>i</italic>
</sub> are biases and <italic>J</italic>
<sub>
<italic>ij</italic>
</sub> are coupling constants. <italic>s</italic>
<sub>
<italic>i</italic>
</sub> are the spins of the qubits <italic>s</italic>
<sub>
<italic>i</italic>
</sub> &#x2208; {&#x2212;1, &#x2b; 1}. The <italic>H</italic>
<sub>0</sub> state is realized by subjecting the system to a high transverse magnetic field in the <italic>x</italic> direction (<italic>H</italic>
<sub>0</sub> &#x3d; <italic>X</italic>&#x2009;&#x2297; &#x2026; &#x2297;&#x2009;<italic>X</italic> where <italic>X</italic> is Pauli spin matrix along <italic>x</italic>) which aligns all the spins in the <italic>x</italic> direction and thus sets the ground state to an equal superposition of all states in the <italic>Z</italic> basis and the external magnetic field is gradually turned off to attain the state corresponding to <italic>H</italic>
<sub>1</sub>. The spins will automatically align themselves so as to minimize the energy given by <xref ref-type="disp-formula" rid="e2">Eq. 2</xref>. This process is known as quantum annealing.</p>
<p>A simple change of variables (<italic>x</italic>&#x20;&#x3d; (1 &#x2b; <italic>s</italic>)/2) together with the observation that <italic>x</italic>
<sup>2</sup> &#x3d; <italic>x</italic> when <italic>x</italic>&#x20;&#x2208; {0, 1} transforms <xref ref-type="disp-formula" rid="e2">Eq. 2</xref> into (ignoring constant term as it is of no consequence)<disp-formula id="e3">
<mml:math id="m3">
<mml:mi>E</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:msup>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>T</mml:mi>
</mml:mrow>
</mml:msup>
<mml:mi>Q</mml:mi>
<mml:mi>x</mml:mi>
</mml:math>
<label>(3)</label>
</disp-formula>where <italic>Q</italic> is a Hermitian matrix (symmetric if dealing with&#x20;real numbers only). The minimization of <xref ref-type="disp-formula" rid="e3">Eq. 3</xref> is a Quadratic Unconstrained Binary Optimization (QUBO) problem. D-Wave&#x2019;s devices are tailored to solve this class of problems.</p>
</sec>
<sec id="s2">
<title>2 Quadratic Unconstrained Binary Optimization Formulation of the Traveling Salesman Problem</title>
<p>The objective function of the traveling salesman problem can then be written as:<disp-formula id="e4">
<mml:math id="m4">
<mml:mi>f</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:mo>&#x2211;</mml:mo>
<mml:mi>M</mml:mi>
<mml:mo>.</mml:mo>
<mml:mo>&#x2217;</mml:mo>
<mml:mi>X</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:munderover accentunder="false" accent="false">
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:mn>0</mml:mn>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x3c;</mml:mo>
<mml:mi>n</mml:mi>
</mml:mrow>
</mml:munderover>
<mml:munderover accentunder="false" accent="false">
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:mi>i</mml:mi>
<mml:mo>&#x2b;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mo>&#x3c;</mml:mo>
<mml:mi>n</mml:mi>
</mml:mrow>
</mml:munderover>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>M</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>&#x2b;</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>M</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:mfenced>
<mml:msub>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>&#x3d;</mml:mo>
<mml:munderover accentunder="false" accent="false">
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:mn>0</mml:mn>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
<mml:mo>&#x3c;</mml:mo>
<mml:mi>m</mml:mi>
</mml:mrow>
</mml:munderover>
<mml:msub>
<mml:mrow>
<mml:mi>B</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
<mml:msub>
<mml:mrow>
<mml:mi>b</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:math>
<label>(4)</label>
</disp-formula>where <italic>M</italic>
<sub>
<italic>ij</italic>
</sub> &#x2b; <italic>M</italic>
<sub>
<italic>ji</italic>
</sub> is the cost of traveling from <italic>i</italic> to <italic>j</italic> (or vice-versa) and we have used indices starting from 0 which are convenient for turning equations into computer code. The <italic>x</italic>
<sub>
<italic>ij</italic>
</sub> variables are mapped to <italic>b</italic>
<sub>
<italic>k</italic>
</sub> and <italic>m</italic> is given by <sup>
<italic>n</italic>
</sup>
<italic>C</italic>
<sub>2</sub> &#x3d; <italic>n</italic> (<italic>n</italic>&#x20;&#x2212; 1)/2. Thus for a problem of size <italic>n</italic>, we have to solve for <italic>m</italic>&#x20;&#x3d; <sup>
<italic>n</italic>
</sup>
<italic>C</italic>
<sub>2</sub> unknowns. <italic>f</italic> is a linear function in <italic>b</italic>
<sub>
<italic>k</italic>
</sub> and the solution is trivial if there are no constraints on <italic>b</italic>
<sub>
<italic>k</italic>
</sub> (set <italic>b</italic>
<sub>
<italic>k</italic>
</sub> &#x3d; 1 if <italic>B</italic>
<sub>
<italic>k</italic>
</sub> &#x3c; 0 and 0 otherwise). However, there are constraints on what <italic>b</italic>
<sub>
<italic>k</italic>
</sub> can be. Each node is traversed only once and connects to only two other nodes in the output cycle. These constraints can be written as <italic>n</italic> equations (one equation for each <italic>i</italic>):<disp-formula id="e5">
<mml:math id="m5">
<mml:mo>&#x2200;</mml:mo>
<mml:mi>i</mml:mi>
<mml:mo>&#x2208;</mml:mo>
<mml:mfenced open="{" close="}">
<mml:mrow>
<mml:mn>0</mml:mn>
<mml:mo>,</mml:mo>
<mml:mo>&#x2026;</mml:mo>
<mml:mo>,</mml:mo>
<mml:mi>n</mml:mi>
<mml:mo>&#x2212;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:mfenced>
<mml:mspace width="0.28em"/>
<mml:munder>
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:munder>
<mml:msub>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>&#x3d;</mml:mo>
<mml:mn>2</mml:mn>
</mml:math>
<label>(5)</label>
</disp-formula>
</p>
<p>These constraints have to be mapped to <italic>b</italic>
<sub>
<italic>k</italic>
</sub> (as we solve for <italic>b</italic>
<sub>
<italic>k</italic>
</sub> ultimately) and the function mapping <italic>i</italic>, <italic>j</italic> indices to <italic>k</italic> (and thus <italic>x</italic>
<sub>
<italic>ij</italic>
</sub> to <italic>b</italic>
<sub>
<italic>k</italic>
</sub>) is given by:<disp-formula id="e6">
<mml:math id="m6">
<mml:mi>k</mml:mi>
<mml:mrow>
<mml:mo stretchy="false">(</mml:mo>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>j</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>n</mml:mi>
</mml:mrow>
<mml:mo stretchy="false">)</mml:mo>
</mml:mrow>
<mml:mo>&#x3d;</mml:mo>
<mml:mfenced open="{" close="">
<mml:mrow>
<mml:mtable class="matrix">
<mml:mtr>
<mml:mtd columnalign="center">
<mml:mtext>undefined</mml:mtext>
</mml:mtd>
<mml:mtd columnalign="center">
<mml:mi mathvariant="normal">f</mml:mi>
<mml:mi mathvariant="normal">o</mml:mi>
<mml:mi mathvariant="normal">r</mml:mi>
<mml:mspace width="0.3333em"/>
<mml:mi>i</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:mi>j</mml:mi>
</mml:mtd>
</mml:mtr>
<mml:mtr>
<mml:mtd columnalign="center">
<mml:mi>k</mml:mi>
<mml:mrow>
<mml:mo stretchy="false">(</mml:mo>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>i</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>n</mml:mi>
</mml:mrow>
<mml:mo stretchy="false">)</mml:mo>
</mml:mrow>
</mml:mtd>
<mml:mtd columnalign="center">
<mml:mi mathvariant="normal">f</mml:mi>
<mml:mi mathvariant="normal">o</mml:mi>
<mml:mi mathvariant="normal">r</mml:mi>
<mml:mspace width="0.3333em"/>
<mml:mi>i</mml:mi>
<mml:mo>&#x3e;</mml:mo>
<mml:mi>j</mml:mi>
</mml:mtd>
</mml:mtr>
<mml:mtr>
<mml:mtd columnalign="center">
<mml:mi>i</mml:mi>
<mml:mi>n</mml:mi>
<mml:mo>&#x2212;</mml:mo>
<mml:mi>i</mml:mi>
<mml:mrow>
<mml:mo stretchy="false">(</mml:mo>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x2b;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
<mml:mo stretchy="false">)</mml:mo>
</mml:mrow>
<mml:mo>/</mml:mo>
<mml:mn>2</mml:mn>
<mml:mo>&#x2b;</mml:mo>
<mml:mi>j</mml:mi>
<mml:mo>&#x2212;</mml:mo>
<mml:mrow>
<mml:mo stretchy="false">(</mml:mo>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x2b;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
<mml:mo stretchy="false">)</mml:mo>
</mml:mrow>
</mml:mtd>
<mml:mtd columnalign="center">
<mml:mi mathvariant="normal">f</mml:mi>
<mml:mi mathvariant="normal">o</mml:mi>
<mml:mi mathvariant="normal">r</mml:mi>
<mml:mspace width="0.3333em"/>
<mml:mi>i</mml:mi>
<mml:mo>&#x3c;</mml:mo>
<mml:mi>j</mml:mi>
</mml:mtd>
</mml:mtr>
</mml:mtable>
</mml:mrow>
</mml:mfenced>
</mml:math>
<label>(6)</label>
</disp-formula>
</p>
<p>So far what we have is a linear integer programming problem subject to linear constraints. To convert it into a QUBO, we formulate each constraint as:<disp-formula id="e7">
<mml:math id="m7">
<mml:mo>&#x2200;</mml:mo>
<mml:mi>i</mml:mi>
<mml:mo>&#x2208;</mml:mo>
<mml:mfenced open="{" close="}">
<mml:mrow>
<mml:mn>0</mml:mn>
<mml:mo>,</mml:mo>
<mml:mo>&#x2026;</mml:mo>
<mml:mo>,</mml:mo>
<mml:mi>n</mml:mi>
<mml:mo>&#x2212;</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:mfenced>
<mml:mspace width="0.28em"/>
<mml:mi>min</mml:mi>
<mml:msup>
<mml:mrow>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mn>2</mml:mn>
<mml:mo>&#x2212;</mml:mo>
<mml:munder>
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:munder>
<mml:msub>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:mfenced>
</mml:mrow>
<mml:mrow>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:msup>
</mml:math>
<label>(7)</label>
</disp-formula>and use the method of Lagrange multipliers to absorb the constraints into the objective function as follows:<disp-formula id="e8">
<mml:math id="m8">
<mml:mi>q</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:munderover accentunder="false" accent="false">
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:mn>0</mml:mn>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
<mml:mo>&#x3c;</mml:mo>
<mml:mi>m</mml:mi>
</mml:mrow>
</mml:munderover>
<mml:msub>
<mml:mrow>
<mml:mi>B</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
<mml:msub>
<mml:mrow>
<mml:mi>b</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>&#x2b;</mml:mo>
<mml:munderover accentunder="false" accent="false">
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:mn>0</mml:mn>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x3c;</mml:mo>
<mml:mi>n</mml:mi>
</mml:mrow>
</mml:munderover>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3bb;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
<mml:msup>
<mml:mrow>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mn>2</mml:mn>
<mml:mo>&#x2212;</mml:mo>
<mml:munder>
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>j</mml:mi>
<mml:mo>&#x2260;</mml:mo>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:munder>
<mml:msub>
<mml:mrow>
<mml:mi>b</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:mfenced>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:mfenced>
</mml:mrow>
<mml:mrow>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:msup>
</mml:math>
<label>(8)</label>
</disp-formula>where <italic>&#x3bb;</italic>
<sub>
<italic>i</italic>
</sub> are Lagrange multipliers. The minimization of <xref ref-type="disp-formula" rid="e8">Eq. 8</xref> is a QUBO problem. The Ising (and equivalently QUBO) formulation of many NP problems can be found in [<xref ref-type="bibr" rid="B2">2</xref>]. The QUBO class of problems is NP-hard.</p>
</sec>
<sec id="s3">
<title>3 Implementation</title>
<p>We have used D-Wave&#x2019;s 5,436 qubit Advantage 1.1 QPU [<xref ref-type="bibr" rid="B3">3</xref>] to solve instances of <xref ref-type="disp-formula" rid="e8">Eq. 8</xref>. We created 8 sample problems all of size <italic>n</italic>&#x20;&#x3d; 8 (corresponding to <italic>m</italic>&#x20;&#x3d; 28 binary variables) in which the entries of <italic>M</italic> were randomly sampled from [1, <italic>n</italic>] or {1, 2, &#x2026;, 8}. All the Lagrange multipliers (<italic>&#x3bb;</italic>
<sub>
<italic>i</italic>
</sub>) were set equal to each other and further equal to the maximum of the absolute values in the matrix <italic>M</italic> (thus 8 in this case). The Lagrange multiplier acts as a weight given to the constraint. It should be set high enough to ensure the constraint is satisfied, but setting it too high obscures the real function we are trying to minimize. In addition to the Lagrange multipliers, there are some other parameters that can affect the solutions returned by the QPU such as the chain strength and annealing time. We use the default annealing time of 20&#xa0;&#x3bc;s of the QPU. The chain strength parameter is related to minor embedding of the problem graph into the actual physical connectivity graph of the QPU. The qubits represented by the variables <italic>b</italic>
<sub>
<italic>k</italic>
</sub> are logical qubits of the problem and we assume in our problem formulation that any of them can interact with another. However, in the physical processor the qubits are laid out in a certain fixed pattern (graph) and to emulate the problem graph it has to be minor embedded into the physical graph. This is a hard problem in its own right (see [<xref ref-type="bibr" rid="B4">4</xref>] and references cited therein) and in general given <italic>m</italic> QUBO variables, we require <italic>O</italic>(<italic>m</italic>
<sup>2</sup>) physical qubits for minor embedding. That&#x2019;s why even though the processor has 5,436 qubits, its compute power translates to the order of <inline-formula id="inf1">
<mml:math id="m9">
<mml:msqrt>
<mml:mrow>
<mml:mn>5436</mml:mn>
</mml:mrow>
</mml:msqrt>
<mml:mo>&#x2248;</mml:mo>
<mml:mn>73</mml:mn>
</mml:math>
</inline-formula> logical qubits. The task of minor embedding the problem graph into the QPU is akin to compilation of a classical computer program to the instruction set of the CPU. We use the default function provided by D-Wave (<monospace>minorminer.find_embedding</monospace>)<xref ref-type="fn" rid="FN2">
<sup>2</sup>
</xref> to calculate the minor embedding of our problem graph. Once, the problem graph is embedded into the physical graph, a chain of physical qubits maps to a logical qubit. Long chains should be avoided and can create problems when the constituent qubits of a chain assume different values - this is known as a chain break and can result in garbage solutions. The chain strength parameter is a parameter that avoids the chain from breaking. Like the Lagrange multiplier, it should be set high enough but setting it too high will hide the actual problem we want to solve. In our implementation we use the <monospace>scaled</monospace>
<xref ref-type="fn" rid="FN3">
<sup>3</sup>
</xref> function provided by D-Wave to automatically set the chain strength without any manual ad-hoc fine tuning. With this, we found the auto-computed chain strength to be between 30.5 and 32 for all the problem cases and there were no chain breaks in the returned solutions. If the annealing process were perfect, the wavefunction would be in the ground state of target Hamiltonian in the end, but in practice that is not always the case. Therefore we perform multiple runs (samples)&#x2014;100 runs for each problem in our case. We then iterate through the samples (observations) in order of lowest energy and select the first sample that satisfies the constraints of <xref ref-type="disp-formula" rid="e5">Eq. 5</xref>. This marks the solution to the problem by the quantum method.</p>
<p>To compare the results and performance of the quantum solution, we also solved each of the problem cases by trying out all possible combinations (brute-force). For a problem of size <italic>n</italic>, the total number of possible combinations is given by (<italic>n</italic>&#x20;&#x2212; 1)!/2. For <italic>n</italic>&#x20;&#x3d; 8 this translates to 2,520. <xref ref-type="fig" rid="F1">Figure&#x20;1</xref> shows graph of the original objective function &#x2211;<italic>M</italic>.&#x2009;&#x2217;&#x2009;<italic>X</italic> against all the combinations for a sample problem. It has many local extrema and no recognizable structure. All the 8 problems are characterized by closely spaced extrema - the difference in the objective function between the best and second-best input configuration ranges from 1&#x2013;3. This equals the energy&#x20;difference <italic>&#x3b4;E</italic> between the ground and first-excited state of the quantum system. Quantum annealing performs&#x20;best when this energy gap is high. When the energy gap is small, the system can jump to a excited state over course of the time evolution giving suboptimal solution in the&#x20;end.</p>
<fig id="F1" position="float">
<label>FIGURE 1</label>
<caption>
<p>Graph of objective function against all possible combinations for a sample problem.</p>
</caption>
<graphic xlink:href="fphy-09-760783-g001.tif"/>
</fig>
<p>A classical optimizer for the traveling salesman problem was also developed. It uses the following simple heuristic: we start with a random initial configuration (cycle). Then, we pick 2 nodes at random and check if swapping their positions (order) would lead to an improvement of the objective function. If so, we swap and repeat the process. If we have tried all <sup>
<italic>n</italic>
</sup>
<italic>C</italic>
<sub>2</sub> swaps and got no improvement of the objective function, the algorithm terminates. This algorithm is guaranteed to converge (and converges fast) but it does not always converge to the global optimum. The chances of converging to the global optimum decline with increase in size of the problem&#x20;<italic>n</italic>.</p>
</sec>
<sec id="s4">
<title>4 Results</title>
<p>
<xref ref-type="table" rid="T1">Table&#x20;1</xref> shows our results and compares the performance of all the 3 solvers. Overall we find the quantum solver performed worse than the classical solver. In terms of time too, the classical solver ran faster for <italic>n</italic>&#x20;&#x3d; 8. The quantum solver takes 20&#xa0;&#x3bc;s &#xd7; 100 samples &#x3d; 2&#xa0;ms to run and this time excludes the time spent in minor embedding of the problem graph. In comparison the classical solver implemented in Python took less than a ms to run for each of the problems on a 2018 Macbook Pro equipped with a 2.2&#xa0;GHz Intel Core i7 processor and 16&#xa0;GB 2400&#xa0;MHz DDR4 RAM. <italic>n</italic>&#x20;&#x3d; 8 is also the maximum size of the problem the quantum solver was able to handle. When we tried problems with <italic>n</italic>&#x20;&#x3d; 9 (<italic>m</italic>&#x20;&#x3d; 36), the D-Wave QPU did not return any valid solution for 5 out of 8 test cases with the methods described in previous section, and for <italic>n</italic>&#x20;&#x3d; 10 (<italic>m</italic>&#x20;&#x3d; 45), the QPU returned a solution for only 1 out of 8 test cases. The solutions were also suboptimal compared to classical solver. They are not listed in the main paper but can be found in the <xref ref-type="sec" rid="s11">Supplementary material</xref> accompanying the paper. One strength of our implementation is that no tweaks are needed to the code and the same code that works when entries of <italic>M</italic> are sampled from [1, <italic>n</italic>] also works as-is when the entries are sampled from [&#x2212;<italic>a</italic>, &#x2b;<italic>a</italic>].</p>
<table-wrap id="T1" position="float">
<label>TABLE 1</label>
<caption>
<p>Evaluation of quantum algorithm and its comparison to a classical solver as well as brute-force method (<italic>n</italic>&#x20;&#x3d; 8).</p>
</caption>
<table>
<thead valign="top">
<tr>
<th rowspan="2" align="left"/>
<th colspan="3" align="center">Brute force</th>
<th colspan="4" align="center">Quantum solver</th>
<th colspan="4" align="center">Classical solver</th>
</tr>
<tr>
<th align="center">Obj.</th>
<th align="center">Qubo energy</th>
<th align="center">&#x23; Of distinct solutions</th>
<th align="center">Obj.</th>
<th align="center">Qubo energy</th>
<th align="center">Is optimal</th>
<th align="center">Is second best</th>
<th align="center">Obj.</th>
<th align="center">&#x23; Of steps</th>
<th align="center">Is optimal</th>
<th align="center">Is second best</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left">Problem 1</td>
<td align="char" char=".">54</td>
<td align="char" char=".">&#x2212;202</td>
<td align="char" char=".">5</td>
<td align="char" char=".">61</td>
<td align="char" char=".">&#x2212;195</td>
<td align="center">&#xd7;</td>
<td align="center">&#xd7;</td>
<td align="char" char=".">54</td>
<td align="char" char=".">77</td>
<td align="center">
<italic>&#x2713;</italic>
</td>
<td align="left"/>
</tr>
<tr>
<td align="left">Problem 2</td>
<td align="char" char=".">54</td>
<td align="char" char=".">&#x2212;202</td>
<td align="char" char=".">1</td>
<td align="char" char=".">68</td>
<td align="char" char=".">&#x2212;188</td>
<td align="center">&#xd7;</td>
<td align="center">&#xd7;</td>
<td align="char" char=".">54</td>
<td align="char" char=".">62</td>
<td align="center">
<italic>&#x2713;</italic>
</td>
<td align="left"/>
</tr>
<tr>
<td align="left">Problem 3</td>
<td align="char" char=".">41</td>
<td align="char" char=".">&#x2212;215</td>
<td align="char" char=".">1</td>
<td align="char" char=".">53</td>
<td align="char" char=".">&#x2212;203</td>
<td align="center">&#xd7;</td>
<td align="center">&#xd7;</td>
<td align="char" char=".">44</td>
<td align="char" char=".">60</td>
<td align="center">&#xd7;</td>
<td align="center">
<italic>&#x2713;</italic>
</td>
</tr>
<tr>
<td align="left">Problem 4</td>
<td align="char" char=".">49</td>
<td align="char" char=".">&#x2212;207</td>
<td align="char" char=".">2</td>
<td align="char" char=".">55</td>
<td align="char" char=".">&#x2212;201</td>
<td align="center">&#xd7;</td>
<td align="center">&#xd7;</td>
<td align="char" char=".">49</td>
<td align="char" char=".">94</td>
<td align="center">
<italic>&#x2713;</italic>
</td>
<td align="left"/>
</tr>
<tr>
<td align="left">Problem 5</td>
<td align="char" char=".">40</td>
<td align="char" char=".">&#x2212;216</td>
<td align="char" char=".">1</td>
<td align="char" char=".">54</td>
<td align="char" char=".">&#x2212;202</td>
<td align="center">&#xd7;</td>
<td align="center">&#xd7;</td>
<td align="char" char=".">40</td>
<td align="char" char=".">70</td>
<td align="center">
<italic>&#x2713;</italic>
</td>
<td align="left"/>
</tr>
<tr>
<td align="left">Problem 6</td>
<td align="char" char=".">52</td>
<td align="char" char=".">&#x2212;204</td>
<td align="char" char=".">2</td>
<td align="char" char=".">58</td>
<td align="char" char=".">&#x2212;198</td>
<td align="center">&#xd7;</td>
<td align="center">&#xd7;</td>
<td align="char" char=".">52</td>
<td align="char" char=".">85</td>
<td align="center">
<italic>&#x2713;</italic>
</td>
<td align="left"/>
</tr>
<tr>
<td align="left">Problem 7</td>
<td align="char" char=".">51</td>
<td align="char" char=".">&#x2212;205</td>
<td align="char" char=".">1</td>
<td align="char" char=".">63</td>
<td align="char" char=".">&#x2212;193</td>
<td align="center">&#xd7;</td>
<td align="center">&#xd7;</td>
<td align="char" char=".">59</td>
<td align="char" char=".">29</td>
<td align="center">&#xd7;</td>
<td align="center">&#xd7;</td>
</tr>
<tr>
<td align="left">Problem 8</td>
<td align="char" char=".">47</td>
<td align="char" char=".">&#x2212;209</td>
<td align="char" char=".">1</td>
<td align="char" char=".">59</td>
<td align="char" char=".">&#x2212;197</td>
<td align="center">&#xd7;</td>
<td align="center">&#xd7;</td>
<td align="char" char=".">50</td>
<td align="char" char=".">60</td>
<td align="center">&#xd7;</td>
<td align="center">&#xd7;</td>
</tr>
</tbody>
</table>
<table-wrap-foot>
<fn>
<p>Obj. is the original objective function <italic>&#x2211;M</italic>.&#x2217;<italic>X</italic>. The QUBO energy is same as <xref ref-type="disp-formula" rid="e8">Eq. 8</xref> minus the constant term in it. The number of steps is equal to the number of combinations tried by the classical solver. It is not equal to the number of swaps performed.</p>
</fn>
</table-wrap-foot>
</table-wrap>
<p>One advantage of the classical solver is that it always respects the constraints of the problem (<xref ref-type="disp-formula" rid="e5">Eq. 5</xref>) whereas the quantum solution turns the constraints into soft-constraints that can be violated and have to be checked for satisfaction. Another advantage is that the quantum solver can return incorrect solutions in which there is more than 1 loop (cycle) e.g., it might configure 4 nodes to be in one loop and 4 others to be in another loop&#x2014;there is no constraint in <xref ref-type="disp-formula" rid="e5">Eq. 5</xref> preventing that. Each node is still connected to two other nodes. The classical solver does not suffer from this limitation.</p>
<p>For reference, D-Wave also provides a code sample to solve the TSP using a QPU.<xref ref-type="fn" rid="FN4">
<sup>4</sup>
</xref> We tried that code as well but it resulted in errors. The formulation provided here is better than D-Wave&#x2019;s solution because it takes into account that <italic>x</italic>
<sub>
<italic>ij</italic>
</sub> &#x3d; <italic>x</italic>
<sub>
<italic>ji</italic>
</sub> (consequently there are <sup>
<italic>n</italic>
</sup>
<italic>C</italic>
<sub>2</sub> variables to solve for) whereas in D-Wave&#x2019;s solution this constraint is treated as a soft-constraint using Lagrange multipliers and the total number of variables is <italic>n</italic>(<italic>n</italic>&#x20;&#x2212; 1). The classical optimizer we have described is the 2-opt algorithm for solving the TSP [<xref ref-type="bibr" rid="B5">5</xref>]. Several computer codes and packages for classical solutions to TSP can be found online.<xref ref-type="fn" rid="FN5">
<sup>5</sup>
</xref>
<sup>,</sup>&#x2009;<xref ref-type="fn" rid="FN6">
<sup>6</sup>
</xref>
<sup>,</sup>&#x2009;<xref ref-type="fn" rid="FN7">
<sup>7</sup>
</xref> A quantum study using D-Wave to solve the related Capacitated Vehicle Routing Problem (CVRP) can be found in&#x20;[<xref ref-type="bibr" rid="B6">6</xref>].</p>
<p>Lastly, in this paper we restricted ourselves to the case when the cost of traveling from <italic>i</italic> to <italic>j</italic> is same as the cost of traveling from <italic>j</italic> to <italic>i</italic>. The restriction can be removed and the methods developed here can be applied to the general case as well. See the <xref ref-type="other" rid="app1">Appendix</xref> for details.</p>
<p>In conclusion, this paper presented a QUBO formulation of the traveling salesman problem which makes it amenable to quantum annealers and although our experiments with D-Wave QPU did not demonstrate any quantum advantage, we remain hopeful that with advancements in technology the quantum solution might outperform classical method esp. with large <italic>n</italic> although quantum annealers like the D-Wave QPU will find a challenge since the number of qubits required grows as <italic>m</italic>
<sup>2</sup> due to the minor embedding problem. Hence, simply adding more qubits to the QPU while keeping the rest of the architecture and design the same is unlikely to succeed. Better innovations will be required.</p>
</sec>
</body>
<back>
<sec id="s5">
<title>Data Availability Statement</title>
<p>All computer code and data is attached as <xref ref-type="sec" rid="s11">Supplementary Material</xref> and licensed under terms of Apache 2.0 License<xref ref-type="fn" rid="FN8">
<sup>8</sup>
</xref>.</p>
</sec>
<sec id="s6">
<title>Author Contributions</title>
<p>SJ conceived the problem and its solution, wrote computer code, performed all experiments, analyzed data and wrote the&#x20;paper.</p>
</sec>
<sec id="s7">
<title>Funding</title>
<p>This work was funded by Supply Chain Digital &#x26; Data Science, Johnson &#x26; Johnson. Johnshon &#x26; Johnson had no role in study design, collection, analysis, interpretation of data, or the writing of this article.</p>
</sec>
<sec id="s8">
<title>Dedication</title>
<p>I dedicate this paper to Pink Floyd &#x2014; The Endless River.</p>
</sec>
<sec sec-type="COI-statement" id="s9">
<title>Conflict of Interest</title>
<p>Author SJ was employed by the company Johnson &#x26; Johnson.</p>
</sec>
<sec sec-type="disclaimer" id="s10">
<title>Publisher&#x2019;s Note</title>
<p>All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors, and the reviewers. Any product that may be evaluated in this article or claim that may be made by its manufacturer is not guaranteed or endorsed by the publisher.</p>
</sec>
<sec id="s11">
<title>Supplementary Material</title>
<p>The Supplementary Material for this article can be found online at: <ext-link ext-link-type="uri" xlink:href="https://www.frontiersin.org/articles/10.3389/fphy.2021.760783/full#supplementary-material">https://www.frontiersin.org/articles/10.3389/fphy.2021.760783/full&#x23;supplementary-material</ext-link>
</p>
<supplementary-material xlink:href="DataSheet1.zip" id="SM1" mimetype="application/zip" xmlns:xlink="http://www.w3.org/1999/xlink"/>
</sec>
<fn-group>
<fn id="FN1">
<label>1</label>
<p>
<ext-link ext-link-type="uri" xlink:href="https://www.dwavesys.com/">https://www.dwavesys.com/</ext-link>
</p>
</fn>
<fn id="FN2">
<label>2</label>
<p>
<ext-link ext-link-type="uri" xlink:href="https://github.com/dwavesystems/minorminer/blob/main/minorminer/minorminer.py">https://github.com/dwavesystems/minorminer/blob/main/minorminer/minorminer.py</ext-link>
</p>
</fn>
<fn id="FN3">
<label>3</label>
<p>
<ext-link ext-link-type="uri" xlink:href="https://github.com/dwavesystems/dwave-system/blob/master/dwave/embedding/chain_strength.py">https://github.com/dwavesystems/dwave-system/blob/master/dwave/embedding/chain_strength.py</ext-link>
</p>
</fn>
<fn id="FN4">
<label>4</label>
<p>
<ext-link ext-link-type="uri" xlink:href="https://github.com/dwavesystems/dwave-networkx/blob/main/dwave_networkx/algorithms/tsp.py">https://github.com/dwavesystems/dwave-networkx/blob/main/dwave_networkx/algorithms/tsp.py</ext-link>
</p>
</fn>
<fn id="FN5">
<label>5</label>
<p>
<ext-link ext-link-type="uri" xlink:href="https://developers.google.com/optimization/routing/tsp">https://developers.google.com/optimization/routing/tsp</ext-link>
</p>
</fn>
<fn id="FN6">
<label>6</label>
<p>
<ext-link ext-link-type="uri" xlink:href="https://python-mip.readthedocs.io/en/latest/examples.html">https://python-mip.readthedocs.io/en/latest/examples.html</ext-link>
</p>
</fn>
<fn id="FN7">
<label>7</label>
<p>
<ext-link ext-link-type="uri" xlink:href="https://www.math.uwaterloo.ca/tsp/concorde.html">https://www.math.uwaterloo.ca/tsp/concorde.html</ext-link>
</p>
</fn>
<fn id="FN8">
<label>8</label>
<p>
<ext-link ext-link-type="uri" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.apache.org/licenses/LICENSE-2.0.txt">https://www.apache.org/licenses/LICENSE-2.0.txt</ext-link>
</p>
</fn>
</fn-group>
<ref-list>
<title>References</title>
<ref id="B1">
<label>1.</label>
<citation citation-type="book">
<person-group person-group-type="author">
<name>
<surname>Applegate</surname>
<given-names>DL</given-names>
</name>
<name>
<surname>Bixby</surname>
<given-names>RE</given-names>
</name>
<name>
<surname>Chv&#xe1;tal</surname>
<given-names>V</given-names>
</name>
<name>
<surname>Cook</surname>
<given-names>WJ</given-names>
</name>
</person-group>. <source>The Traveling Salesman Problem: A Computational Study</source>. <publisher-name>Princeton University Press</publisher-name> (<year>2007</year>). </citation>
</ref>
<ref id="B2">
<label>2.</label>
<citation citation-type="journal">
<person-group person-group-type="author">
<name>
<surname>Lucas</surname>
<given-names>A</given-names>
</name>
</person-group>. <article-title>Ising Formulations of many NP Problems</article-title>. <source>Front Phys</source> (<year>2014</year>) <volume>2</volume>:<fpage>5</fpage>. <pub-id pub-id-type="doi">10.3389/fphy.2014.00005</pub-id> </citation>
</ref>
<ref id="B3">
<label>3.</label>
<citation citation-type="book">
<person-group person-group-type="author">
<name>
<surname>McGeoch</surname>
<given-names>C</given-names>
</name>
<name>
<surname>Farre</surname>
<given-names>P</given-names>
</name>
</person-group>. <article-title>The D-Wave Advantage System: An Overview</article-title>. <comment>Technical Report</comment>. <publisher-loc>Burnaby, BC</publisher-loc> (<year>2020</year>). <comment>14-1049A-A</comment>. </citation>
</ref>
<ref id="B4">
<label>4.</label>
<citation citation-type="journal">
<person-group person-group-type="author">
<name>
<surname>Date</surname>
<given-names>P</given-names>
</name>
<name>
<surname>Patton</surname>
<given-names>R</given-names>
</name>
<name>
<surname>Schuman</surname>
<given-names>C</given-names>
</name>
<name>
<surname>Potok</surname>
<given-names>T</given-names>
</name>
</person-group>. <article-title>Efficiently Embedding QUBO Problems on Adiabatic Quantum Computers</article-title>. <source>Quan Inf Process</source> (<year>2019</year>) <volume>18</volume>:<fpage>1</fpage>&#x2013;<lpage>31</lpage>. <pub-id pub-id-type="doi">10.1007/s11128-019-2236-3</pub-id> </citation>
</ref>
<ref id="B5">
<label>5.</label>
<citation citation-type="journal">
<person-group person-group-type="author">
<name>
<surname>Croes</surname>
<given-names>GA</given-names>
</name>
</person-group>. <article-title>A Method for Solving Traveling-Salesman Problems</article-title>. <source>Operations Res</source> (<year>1958</year>) <volume>6</volume>:<fpage>791</fpage>&#x2013;<lpage>812</lpage>. <pub-id pub-id-type="doi">10.1287/opre.6.6.791</pub-id> </citation>
</ref>
<ref id="B6">
<label>6.</label>
<citation citation-type="journal">
<person-group person-group-type="author">
<name>
<surname>Feld</surname>
<given-names>S</given-names>
</name>
<name>
<surname>Roch</surname>
<given-names>C</given-names>
</name>
<name>
<surname>Gabor</surname>
<given-names>T</given-names>
</name>
<name>
<surname>Seidel</surname>
<given-names>C</given-names>
</name>
<name>
<surname>Neukart</surname>
<given-names>F</given-names>
</name>
<name>
<surname>Galter</surname>
<given-names>I</given-names>
</name>
<etal/>
</person-group> <article-title>A Hybrid Solution Method for the Capacitated Vehicle Routing Problem Using a Quantum Annealer</article-title>. <source>Front ICT</source> (<year>2019</year>) <volume>6</volume>:<fpage>13</fpage>. <pub-id pub-id-type="doi">10.3389/fict.2019.00013</pub-id> </citation>
</ref>
</ref-list>
<app-group>
<app id="app1">
<title>Appendix</title>
<p>This appendix describes QUBO formulation of the TSP when the cost of traveling from node <italic>i</italic> to node <italic>j</italic> is not equal to the cost of traveling from node <italic>j</italic> to node <italic>i</italic>. In this case the total number of possible combinations is given by (<italic>n</italic> &#x2212; 1)! instead of (<italic>n</italic> &#x2212; 1)!/2 and for a problem of size <italic>n</italic>, the number of binary variables to solve for becomes 2 &#xd7;<sup>
<italic>n</italic>
</sup>
<italic>C</italic>
<sub>2</sub> instead of <sup>
<italic>n</italic>
</sup>
<italic>C</italic>
<sub>2</sub>. This is also equal to the number of entries in the matrix <italic>X</italic> minus the diagonal. Let <italic>x</italic>
<sub>
<italic>ij</italic>
</sub> be the binary variable that denotes if there is a traversal from node <italic>i</italic> to node <italic>j</italic>. The objective function <italic>&#x2211;M</italic>.&#x2009;&#x2217;&#x2009;<italic>X</italic> remains unchanged but <italic>X</italic> is no longer a symmetric matrix. Each node <italic>i</italic> must have exactly one ingress which is represented by <italic>n</italic> constraints:<disp-formula id="e9">
<mml:math id="m10">
<mml:mo>&#x2200;</mml:mo>
<mml:mi>i</mml:mi>
<mml:mspace width="0.28em"/>
<mml:munder>
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:munder>
<mml:msub>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>&#x3d;</mml:mo>
<mml:mn>1</mml:mn>
</mml:math>
<label>(9)</label>
</disp-formula>
</p>
<p>The above constraint can be equivalently stated as each column of matrix <italic>X</italic> should have exactly one entry with a 1 in it. Similarly each node must have exactly one egress which is represented by another set of <italic>n</italic> constraints (equivalently stated as each row of matrix <italic>X</italic> should have exactly one entry with a 1 in it):<disp-formula id="e10">
<mml:math id="m11">
<mml:mo>&#x2200;</mml:mo>
<mml:mi>i</mml:mi>
<mml:mspace width="0.28em"/>
<mml:munder>
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:munder>
<mml:msub>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>&#x3d;</mml:mo>
<mml:mn>1</mml:mn>
</mml:math>
<label>(10)</label>
</disp-formula>
</p>
<p>Finally, if <italic>x</italic>
<sub>
<italic>ij</italic>
</sub> is 1 then <italic>x</italic>
<sub>
<italic>ji</italic>
</sub> &#x3d; 0 (<italic>X</italic> is not a symmetric matrix). This gives following <italic>
<sup>n</sup>C</italic>
<sub>2</sub> constraints:<disp-formula id="e11">
<mml:math id="m12">
<mml:mo>&#x2200;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:mfenced>
<mml:mspace width="0.28em"/>
<mml:msub>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>&#x2b;</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>&#x2264;</mml:mo>
<mml:mn>1</mml:mn>
</mml:math>
<label>(11)</label>
</disp-formula>
</p>
<p>We have seen before how to absorb the linear constraints into the cost function using Lagrange multipliers. Each inequality in <xref ref-type="disp-formula" rid="e11">Eq. 11</xref> can be represented by corresponding penalty function <italic>x</italic>
<sub>
<italic>ij</italic>
</sub>
<italic>x</italic>
<sub>
<italic>ji</italic>
</sub> which is 0 if the inequality is satisfied and 1 otherwise. We can capture all the constraints into following QUBO cost function:<disp-formula id="e12">
<mml:math id="m13">
<mml:mtable class="aligned">
<mml:mtr>
<mml:mtd columnalign="right">
<mml:mi>q</mml:mi>
</mml:mtd>
<mml:mtd columnalign="left">
<mml:mo>&#x3d;</mml:mo>
</mml:mtd>
<mml:mtd columnalign="right">
<mml:mo>&#x2211;</mml:mo>
<mml:mi>M</mml:mi>
<mml:mo>.</mml:mo>
<mml:mo>&#x2217;</mml:mo>
<mml:mi>X</mml:mi>
</mml:mtd>
</mml:mtr>
<mml:mtr>
<mml:mtd columnalign="right"/>
<mml:mtd columnalign="left">
<mml:mo>&#x2b;</mml:mo>
</mml:mtd>
<mml:mtd columnalign="right">
<mml:msub>
<mml:mrow>
<mml:mi>&#x3bb;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
<mml:munderover accentunder="false" accent="false">
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:mn>0</mml:mn>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x3c;</mml:mo>
<mml:mi>n</mml:mi>
</mml:mrow>
</mml:munderover>
<mml:msup>
<mml:mrow>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mn>1</mml:mn>
<mml:mo>&#x2212;</mml:mo>
<mml:munder>
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>j</mml:mi>
<mml:mo>&#x2260;</mml:mo>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:munder>
<mml:msub>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:mfenced>
</mml:mrow>
<mml:mrow>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:msup>
</mml:mtd>
</mml:mtr>
<mml:mtr>
<mml:mtd columnalign="right"/>
<mml:mtd columnalign="left">
<mml:mo>&#x2b;</mml:mo>
</mml:mtd>
<mml:mtd columnalign="right">
<mml:msub>
<mml:mrow>
<mml:mi>&#x3bb;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:msub>
<mml:munderover accentunder="false" accent="false">
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:mn>0</mml:mn>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x3c;</mml:mo>
<mml:mi>n</mml:mi>
</mml:mrow>
</mml:munderover>
<mml:msup>
<mml:mrow>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mn>1</mml:mn>
<mml:mo>&#x2212;</mml:mo>
<mml:munder>
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>j</mml:mi>
<mml:mo>&#x2260;</mml:mo>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:munder>
<mml:msub>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:mfenced>
</mml:mrow>
<mml:mrow>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:msup>
</mml:mtd>
</mml:mtr>
<mml:mtr>
<mml:mtd columnalign="right"/>
<mml:mtd columnalign="left">
<mml:mo>&#x2b;</mml:mo>
</mml:mtd>
<mml:mtd columnalign="right">
<mml:msub>
<mml:mrow>
<mml:mi>&#x3bb;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>3</mml:mn>
</mml:mrow>
</mml:msub>
<mml:munderover accentunder="false" accent="false">
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:mn>0</mml:mn>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mo>&#x3c;</mml:mo>
<mml:mi>n</mml:mi>
</mml:mrow>
</mml:munderover>
<mml:munder>
<mml:mrow>
<mml:mo>&#x2211;</mml:mo>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>j</mml:mi>
<mml:mo>&#x2260;</mml:mo>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:munder>
<mml:msub>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:msub>
<mml:msub>
<mml:mrow>
<mml:mi>x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>j</mml:mi>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mtd>
</mml:mtr>
</mml:mtable>
</mml:math>
<label>(12)</label>
</disp-formula>where <italic>&#x3bb;</italic>
<sub>
<italic>i</italic>
</sub> are Lagrange multipliers. Minimization of above will solve the TSP for the extended case.</p>
</app>
</app-group>
</back>
</article>