Solving the Travelling Salesman Problem Using Quantum...

Post on 22-Aug-2018

246 views 0 download

transcript

Solving the Travelling Salesman Problem Using Quantum Computing

Sebastian Feld, Christoph Roch, Thomas GaborLudwig-Maximilians-Universität München

OpenMunich01.12.2017, Munich

Agenda

I. Quantum Computing and Quantum Annealing

II. TSP and Ising Model

III. qbsolv

IV. Conclusion

2

I. QUANTUM COMPUTING AND QUANTUM ANNEALING

Source: D-Wave

WHAT CAN I USE QUANTUMCOMPUTING FOR?

4

Traffic Flow Optimization

5Find (near) optimal solution from 3418 possibilities in several 20𝜇𝑠

Source: Neukart et al., 2017

HOW DOES QUANTUM COMPUTINGWORK?

6

Quantum Physics

7

Non-determinism Influence byobservation

Wave-particleduality

A

B

C

0.4

0.6

Source: Wikipedia; Elena Natasha Liston

Quantum Computing

8

Quantum Gate Model Quantum Annealing

Quantum Bits

9

0 1

Superposition

10

01

Entanglement

11

10 10

Quantum Annealing

12All possible solutions

Best solution

Qu

alit

y o

f so

luti

on

? ? ? ? ? … ?

Portfolio Optimization

13

Spend budget, minimize risk, maximize outcome

Buy Buy Buy …

Portfolio Optimization

14

Spend budget, minimize risk, maximize outcome

Qubits represent stocks

15

… ………

Initialize qubits in superposition

16

? ???

?

?

?

?

? ???

?

?

?

?

Formulate constraints

17

? ???

?

?

?

?

? ???

?

?

?

?

Anneal to optimal solution

18

N YNY

Y

Y

N

Y

N YYY

Y

Y

Y

N

Quantum Annealing

19All possible solutions

Best solution

Qu

alit

y o

f so

luti

on

ARE THERE REAL-WORLD APPLICATIONSFOR QUANTUM COMPUTING?

20

Traffic Flow Optimization

Intelligent Mobility

Self-driving cars

21

Source: Neukart et al., 2017

Vehicle Routing Problem

Logistic Problems

E-Mobility

22

Source: Christine Mumford

Multi-Criteria Optimization

Financial Risk Opt

Portfolio Mgmt

23

Source: Robert R. McCormick School of Engineering and Applied Science

Probabilistic Sampling

Artificial Intelligence

Machine Learning

24

Source: Chao-Yang Lu, Xin-Dong Cai

Search unsorted database in 𝒪 𝑛

Search Engines

Social Media

25

Lov Grover

Source: Eric.Ray; University of Warwick, Department of Computer Science

Prime Factorization in polynomial time

RSA Cryptography

26

Peter Shor

Source: Universität Innsbruck, Instiut für Experimentalphysik; MIT, Department of Mathematics

II. TSP AND ISING MODEL

Source: D-Wave

Travelling Salesman Problem

28

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?

Source: Wikipedia

The Good, the Bad and the Ugly

29

D E

F

G

HA

B

C

The Good, the Bad and the Ugly

30

D E

F

G

HA

B

C

The Good, the Bad and the Ugly

31

D E

F

G

HA

B

C

Combinatorial Optimization

32

𝑛 cities 𝒏 − 𝟏 ! combinations

2 1

3 2

4 6

5 24

10 362,880

20 1.2 × 1017

100 9.3 × 10155

Quantum Annealing (QA)

33All possible solutions

Qu

alit

y o

f so

luti

on

QA using Ising Model

Mathematical model for studying properties of physical systems that evolve in time

34

𝐻 𝑠 =

𝑖

ℎ𝑖𝑠𝑖 +

𝑖<𝑗

𝐽𝑖𝑗𝑠𝑖𝑠𝑗

QA using Ising Model

35

Source: McGeoch

𝐻 𝑠 =

𝑖

ℎ𝑖𝑠𝑖 +

𝑖<𝑗

𝐽𝑖𝑗𝑠𝑖𝑠𝑗

Particles can be in state +1 or −1

QA using Ising Model

36

Source: McGeoch

𝐻 𝑠 =

𝑖

ℎ𝑖𝑠𝑖 +

𝑖<𝑗

𝐽𝑖𝑗𝑠𝑖𝑠𝑗

External forces on individual particles

QA using Ising Model

37

Source: McGeoch

𝐻 𝑠 =

𝑖

ℎ𝑖𝑠𝑖 +

𝑖<𝑗

𝐽𝑖𝑗𝑠𝑖𝑠𝑗

Interaction forces between neighbors

QA using Ising Model

38

Source: McGeoch

𝐻 𝑠 =

𝑖

ℎ𝑖𝑠𝑖 +

𝑖<𝑗

𝐽𝑖𝑗𝑠𝑖𝑠𝑗

Energy of spin configuration

TSP as Ising Formulation

Given graph 𝐺 = 𝑉, 𝐸 with edge weights 𝑊𝑢𝑣,

find hamiltonian cycle with minimum sum of edge weights39

Source: http://arxiv.org/pdf/1302.5843.pdf

D E

F

G

HA

B

C

𝐻 = 𝛼

𝑣=1

𝑛

1 −

𝑗=1

𝑁

𝑥𝑣,𝑗

2

+𝛼

𝑗=1

𝑛

1 −

𝑣=1

𝑁

𝑥𝑣,𝑗

2

+ 𝛽

𝑢𝑣 ∈𝐸

𝑊𝑢𝑣

𝑗=1

𝑁

𝑥𝑢,𝑗𝑥𝑣,𝑗+1

TSP as Ising Formulation

40

𝐻 = 𝛼

𝑣=1

𝑛

1 −

𝑗=1

𝑁

𝑥𝑣,𝑗

2

+𝛼

𝑗=1

𝑛

1 −

𝑣=1

𝑁

𝑥𝑣,𝑗

2

+ 𝛽

𝑢𝑣 ∈𝐸

𝑊𝑢𝑣

𝑗=1

𝑁

𝑥𝑢,𝑗𝑥𝑣,𝑗+1

A1 A2 A3 A4 B1 B2 B3 B4 C1 C2 C3 C4

A1

A2

A3

A4

B1

B2

B3

B4

D E

F

G

HA

B

C

TSP as Ising Formulation

41

𝐻 = 𝛼

𝑣=1

𝑛

1 −

𝑗=1

𝑁

𝑥𝑣,𝑗

2

+𝛼

𝑗=1

𝑛

1 −

𝑣=1

𝑁

𝑥𝑣,𝑗

2

+ 𝛽

𝑢𝑣 ∈𝐸

𝑊𝑢𝑣

𝑗=1

𝑁

𝑥𝑢,𝑗𝑥𝑣,𝑗+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

TSP as Ising Formulation

42

𝐻 = 𝛼

𝑣=1

𝑛

1 −

𝑗=1

𝑁

𝑥𝑣,𝑗

2

+𝛼

𝑗=1

𝑛

1 −

𝑣=1

𝑁

𝑥𝑣,𝑗

2

+ 𝛽

𝑢𝑣 ∈𝐸

𝑊𝑢𝑣

𝑗=1

𝑁

𝑥𝑢,𝑗𝑥𝑣,𝑗+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 𝑗𝑡ℎ node in the cycle for each 𝑗

TSP as Ising Formulation

43

𝐻 = 𝛼

𝑣=1

𝑛

1 −

𝑗=1

𝑁

𝑥𝑣,𝑗

2

+𝛼

𝑗=1

𝑛

1 −

𝑣=1

𝑁

𝑥𝑣,𝑗

2

+ 𝛽

𝑢𝑣 ∈𝐸

𝑊𝑢𝑣

𝑗=1

𝑁

𝑥𝑢,𝑗𝑥𝑣,𝑗+1

If the edge is part of the cycle, apply the edge weight

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) 𝛼

TSP as Ising Formulation

44

𝐻 = 𝛼

𝑣=1

𝑛

1 −

𝑗=1

𝑁

𝑥𝑣,𝑗

2

+𝛼

𝑗=1

𝑛

1 −

𝑣=1

𝑁

𝑥𝑣,𝑗

2

+ 𝛽

𝑢𝑣 ∈𝐸

𝑊𝑢𝑣

𝑗=1

𝑁

𝑥𝑢,𝑗𝑥𝑣,𝑗+1

Every vertex can only appear once in a circle

There must be a 𝑗𝑡ℎ node in the cycle for each 𝑗

If the edge is part of the cycle, apply the edge weight

III. QBSOLV

Source: D-Wave

qbsolv on github

46

Source: https://github.com/dwavesystems/qbsolv

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

52

# 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)

Main Logic

53

# 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)

Main Logic

54

# 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)

D E

F

G

HA

B

C

Main Logic

55

# 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)

D E

F

G

HA

B

C

Main Logic

56

# 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)

IV. CONCLUSION

Source: D-Wave

58

Complex production and usage, but completely new possibilities

Source: MCMBUZZ

59Bring talents together and try it now!

Source: Gartner

Solving the Travelling Salesman Problem Using Quantum Computing

Sebastian Feld, Christoph Roch, Thomas GaborLudwig-Maximilians-Universität München

OpenMunich01.12.2017, Munich