Solving the Travelling Salesman Problem Using Quantum Computing Sebastian Feld, Christoph Roch, Thomas Gabor Ludwig-Maximilians-Universität München OpenMunich 01.12.2017, Munich
Agenda I. Quantum Computing and Quantum Annealing II. TSP and Ising Model III. qbsolv IV. Conclusion 2
Source: D-Wave I. QUANTUM COMPUTING AND QUANTUM ANNEALING
WHAT CAN I USE QUANTUM COMPUTING FOR? 4
Source: Neukart et al., 2017 Traffic Flow Optimization Find (near) optimal solution from 3 418 possibilities in several 20μs 5
HOW DOES QUANTUM COMPUTING WORK? 6
Source: Wikipedia; Elena Natasha Liston Wave-particle duality Quantum Physics Non-determinism Influence by observation A 0.4 0.6 B C 7
Quantum Computing Quantum Gate Model Quantum Annealing 8
Quantum Bits 0 1 9
Superposition 01 10
Entanglement 10 10 11
Quality of solution Quantum Annealing Best solution All possible solutions 12
Portfolio Optimization?????? Spend budget, minimize risk, maximize outcome 13
Portfolio Optimization Buy Buy Buy Spend budget, minimize risk, maximize outcome 14
Qubits represent stocks 15
Initialize qubits in superposition???????????????? 16
Formulate constraints???????????????? 17
Anneal to optimal solution Y Y Y Y Y N N Y Y Y N Y N Y Y N 18
Quality of solution Quantum Annealing Best solution All possible solutions 19
ARE THERE REAL-WORLD APPLICATIONS FOR QUANTUM COMPUTING? 20
Source: Neukart et al., 2017 Traffic Flow Optimization Intelligent Mobility Self-driving cars 21
Source: Christine Mumford Vehicle Routing Problem Logistic Problems E-Mobility 22
Source: Robert R. McCormick School of Engineering and Applied Science Multi-Criteria Optimization Financial Risk Opt Portfolio Mgmt 23
Source: Chao-Yang Lu, Xin-Dong Cai Probabilistic Sampling Artificial Intelligence Machine Learning 24
Source: Eric.Ray; University of Warwick, Department of Computer Science Search unsorted database in O n Search Engines Social Media Lov Grover 25
Source: Universität Innsbruck, Instiut für Experimentalphysik; MIT, Department of Mathematics Prime Factorization in polynomial time RSA Cryptography Peter Shor 26
Source: D-Wave II. TSP AND ISING MODEL
Source: Wikipedia Travelling Salesman Problem Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city? 28
The Good, the Bad and the Ugly D E C F B G A H 29
The Good, the Bad and the Ugly D E C F B G A H 30
The Good, the Bad and the Ugly D E C F B G A H 31
Combinatorial Optimization n cities n 1! combinations 2 1 3 2 4 6 5 24 10 362,880 20 1.2 10 17 100 9.3 10 155 32
Quality of solution Quantum Annealing (QA) All possible solutions 33
QA using Ising Model H s = i h i s i + J ij s i s j i<j Mathematical model for studying properties of physical systems that evolve in time 34
Source: McGeoch QA using Ising Model H s = i h i s i + i<j J ij s i s j Particles can be in state +1 or 1 35
Source: McGeoch QA using Ising Model H s = i h i s i + i<j J ij s i s j External forces on individual particles 36
Source: McGeoch QA using Ising Model H s = i h i s i + i<j J ij s i s j Interaction forces between neighbors 37
Source: McGeoch QA using Ising Model H s = i h i s i + i<j J ij s i s j Energy of spin configuration 38
Source: http://arxiv.org/pdf/1302.5843.pdf TSP as Ising Formulation n N 2 n N 2 N H = α 1 x v,j + α 1 x v,j + β W uv x u,j x v,j+1 v=1 j=1 j=1 v=1 uv E j=1 D E C F B G A H Given graph G = V, E with edge weights W uv, find hamiltonian cycle with minimum sum of edge weights 39
TSP as Ising Formulation n N 2 n N 2 N H = α 1 x v,j + α 1 x v,j + β W uv x u,j x v,j+1 v=1 j=1 j=1 v=1 uv E j=1 D E A1 A1 A2 A3 A4 B1 B2 B3 B4 C1 C2 C3 C4 C B F G A2 A3 A4 B1 B2 A H B3 B4 40
TSP as Ising Formulation n N 2 n N 2 N H = α 1 x v,j + α 1 x v,j + β W uv x u,j x v,j+1 v=1 j=1 j=1 v=1 uv E j=1 A1 A2 A3 A4 B1 B2 B3 B4 C1 C2 C3 C4 A1 α α α A2 α α A3 α A4 B1 α α α B2 α α B3 α B4 Every vertex can only appear once in a circle 41
TSP as Ising Formulation n N 2 n N 2 N H = α 1 x v,j + α 1 x v,j + β W uv x u,j x v,j+1 v=1 j=1 j=1 v=1 uv E j=1 A1 A2 A3 A4 B1 B2 B3 B4 C1 C2 C3 C4 A1 α α α α α A2 α α α α A3 α α α A4 α α B1 α α α α B2 α α α B3 α α B4 α There must be a j th node in the cycle for each j 42
TSP as Ising Formulation n N 2 n N 2 N H = α 1 x v,j + α 1 x v,j + β W uv x u,j x v,j+1 v=1 j=1 j=1 v=1 uv E j=1 A1 A2 A3 A4 B1 B2 B3 B4 C1 C2 C3 C4 A1 α α α α (ab) (ab) α (ac) (ac) A2 α α (ab) α (ab) (ac) α (ac) A3 α (ab) α (ab) (ac) α (ac) A4 (ab) (ab) α (ac) (ac) α B1 α α α α (bc) (bc) B2 α α (bc) α (bc) B3 α (bc) α (bc) B4 (bc) (bc) α If the edge is part of the cycle, apply the edge weight 43
TSP as Ising Formulation n N 2 n N 2 N H = α 1 x v,j + α 1 x v,j + β W uv x u,j x v,j+1 v=1 j=1 j=1 v=1 uv E j=1 Every vertex can only appear once in a circle There must be a j th node in the cycle for each j If the edge is part of the cycle, apply the edge weight 44
Source: D-Wave III. QBSOLV
Source: https://github.com/dwavesystems/qbsolv qbsolv on github 46
Preprocessing # Import nodes with x/y-coordinates file_parser = FileParser("./datasets/TSP_Testdata.xml") # Get list of nodes (index, x, y) nodelist = file_parser.parse_file_tsp() # Get list of undirected edges (index1, index2, length) edges = file_parser.generate_edge_list(nodelist) 47
Preprocessing # Import nodes with x/y-coordinates file_parser = FileParser("./datasets/TSP_Testdata.xml") # Get list of nodes (index, x, y) nodelist = file_parser.parse_file_tsp() # Get list of undirected edges (index1, index2, length) edges = file_parser.generate_edge_list(nodelist) 48
Preprocessing # Import nodes with x/y-coordinates file_parser = FileParser("./datasets/TSP_Testdata.xml") # Get list of nodes (index, x, y) nodelist = file_parser.parse_file_tsp() # Get list of undirected edges (index1, index2, length) edges = file_parser.generate_edge_list(nodelist) 49
Preprocessing # Import nodes with x/y-coordinates file_parser = FileParser("./datasets/TSP_Testdata.xml") # Get list of nodes (index, x, y) nodelist = file_parser.parse_file_tsp() # Get list of undirected edges (index1, index2, length) edges = file_parser.generate_edge_list(nodelist) 50
Main Logic # Create QUBO Q = tsp_solver.generate_tsp_qubo(len(nodelist), edges) # Solve QUBO with qbsolv answer = QBSolv().sample_qubo(Q, 50) # Returns the result distance, used_edges = tsp_solver.get_distance_and_edges_of_tour_qbsolv(adj_ matrix, response, edges, len(nodelist)) # Plot dataset and result plot_drawer = PlotDrawer() plot_drawer.plot_tsp(used_edges, nodelist, node_annotation) 51
Main Logic # Create QUBO Q = tsp_solver.generate_tsp_qubo(len(nodelist), edges) # Solve QUBO with qbsolv answer = QBSolv().sample_qubo(Q, 50) # Returns the result distance, used_edges = tsp_solver.get_distance_and_edges_of_tour_qbsolv(adj_ matrix, response, edges, len(nodelist)) # Plot dataset and result plot_drawer = PlotDrawer() plot_drawer.plot_tsp(used_edges, nodelist, node_annotation) 52
Main Logic # Create QUBO Q = tsp_solver.generate_tsp_qubo(len(nodelist), edges) # Solve QUBO with qbsolv answer = QBSolv().sample_qubo(Q, 50) # Returns the result distance, used_edges = tsp_solver.get_distance_and_edges_of_tour_qbsolv(adj_ matrix, response, edges, len(nodelist)) # Plot dataset and result plot_drawer = PlotDrawer() plot_drawer.plot_tsp(used_edges, nodelist, node_annotation) 53
Main Logic # Create QUBO Q = tsp_solver.generate_tsp_qubo(len(nodelist), edges) # Solve QUBO with qbsolv answer = QBSolv().sample_qubo(Q, 50) # Returns the result distance, used_edges = tsp_solver.get_distance_and_edges_of_tour_qbsolv(adj_ matrix, response, edges, len(nodelist)) # Plot dataset and result plot_drawer = PlotDrawer() plot_drawer.plot_tsp(used_edges, nodelist, node_annotation) C B D E F G A H 54
Main Logic # Create QUBO Q = tsp_solver.generate_tsp_qubo(len(nodelist), edges) # Solve QUBO with qbsolv answer = QBSolv().sample_qubo(Q, 50) # Returns the result distance, used_edges = tsp_solver.get_distance_and_edges_of_tour_qbsolv(adj_ matrix, response, edges, len(nodelist)) # Plot dataset and result plot_drawer = PlotDrawer() plot_drawer.plot_tsp(used_edges, nodelist, node_annotation) C B D E F G A H 55
Main Logic # Create QUBO Q = tsp_solver.generate_tsp_qubo(len(nodelist), edges) # Solve QUBO with qbsolv answer = QBSolv().sample_qubo(Q, 50) # Returns the result distance, used_edges = tsp_solver.get_distance_and_edges_of_tour_qbsolv(adj_ matrix, response, edges, len(nodelist)) # Plot dataset and result plot_drawer = PlotDrawer() plot_drawer.plot_tsp(used_edges, nodelist, node_annotation) 56
Source: D-Wave IV. CONCLUSION
Source: MCMBUZZ Complex production and usage, but completely new possibilities 58
Source: Gartner Bring talents together and try it now! 59
Solving the Travelling Salesman Problem Using Quantum Computing Sebastian Feld, Christoph Roch, Thomas Gabor Ludwig-Maximilians-Universität München OpenMunich 01.12.2017, Munich