math models of or: traveling salesman problemeaton.math.rpi.edu/faculty/mitchell/courses/matp... ·...

27
Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical Sciences RPI, Troy, NY 12180 USA November 2018 Mitchell Traveling Salesman Problem 1 / 19

Upload: others

Post on 13-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Math Models of OR:Traveling Salesman Problem

John E. Mitchell

Department of Mathematical SciencesRPI, Troy, NY 12180 USA

November 2018

Mitchell Traveling Salesman Problem 1 / 19

Page 2: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Outline

1 Examples

2 Proving Optimality

3 Subtours

4 Reoptimizing after adding subtour elimination constraints

Mitchell Traveling Salesman Problem 2 / 19

Page 3: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Examples

Outline

1 Examples

2 Proving Optimality

3 Subtours

4 Reoptimizing after adding subtour elimination constraints

Mitchell Traveling Salesman Problem 3 / 19

Page 4: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Examples

The Traveling Salesman Problem

TSP WebpageBill Cook, Waterloo

Robert BoschOberlin College

Find shortest route that visits each city exactly once.

Largest problem solved to date has more than 85,000 cities.

Applications: VLSI, vehicle routing (UPS, school buses,...)Mitchell Traveling Salesman Problem 4 / 19

Page 5: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Proving Optimality

Outline

1 Examples

2 Proving Optimality

3 Subtours

4 Reoptimizing after adding subtour elimination constraints

Mitchell Traveling Salesman Problem 5 / 19

Page 6: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Proving Optimality

How do we know we are optimal?

We’ve found a good tour somehow.How do we know that we can’t do better?Look at relaxations.Venn diagram:

set of tours

relaxationof set oftours

Mitchell Traveling Salesman Problem 6 / 19

Page 7: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Proving Optimality

How do we know we are optimal?We’ve found a good tour somehow.How do we know that we can’t do better?Look at relaxations.Venn diagram:

optimaltour

optimalrelaxation

Optimal relaxation gives lower bound on length of optimal tour

Mitchell Traveling Salesman Problem 6 / 19

Page 8: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Proving Optimality

Constructing a Relaxation

Mitchell Traveling Salesman Problem 7 / 19

Page 9: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Proving Optimality

Constructing a Relaxation

Use exactly two edges incident to each vertex.

Mitchell Traveling Salesman Problem 7 / 19

Page 10: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Proving Optimality

Optimization Formulation

Use binary variables:

xe =

⇢1 if edge e is in tour0 otherwise

Let E denote the set of edges and V the set of vertices.Let ce be the cost of edge e.

Let �(v) denote the edges incident to vertex v .

minxP

e2E cexe

subject toP

e2�(v) xe = 2 for all v 2 V

and xe = 0 or 1 for all e 2 E .

Mitchell Traveling Salesman Problem 8 / 19

Page 11: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Subtours

Outline

1 Examples

2 Proving Optimality

3 Subtours

4 Reoptimizing after adding subtour elimination constraints

Mitchell Traveling Salesman Problem 9 / 19

Page 12: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Subtours

May have subtours

r

s

t

u

v

w

Mitchell Traveling Salesman Problem 10 / 19

Ledge, foreach vertex

0 A

Page 13: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Subtours

May have subtours

r

s

t

u

v

w

Optimal tour

Mitchell Traveling Salesman Problem 10 / 19

Page 14: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Subtours

May have subtours

r

s

t

u

v

wSolution to relaxation:use 2 edges at each vertex

Mitchell Traveling Salesman Problem 10 / 19

§""""""

Page 15: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Subtours

May have subtours

r

s

t

u

v

wUse subtour elimination constraintto tighten relaxation:

xrs + xst + xrt 2

Mitchell Traveling Salesman Problem 10 / 19

{ r, t ,u} :Xr t t x ru t xc .us 2 .

a

Page 16: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Subtours

Refinements

Can add subtour elimination constraints for any subset U ✓ V ,with 3 |U| |V |/2.Too many subtour elimination constraints to use them all, so addthem selectively as needed.(How many possible constraints do we have?)Can also relax the restriction that x be binary: use 0 xe 1.Then have linear program, which can be solved efficiently.Extensions of this approach can solve instances of the TSP withtens of thousands of cities (and hundreds of millions of edges).

Mitchell Traveling Salesman Problem 11 / 19

Page 17: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Subtours

Refinements

Can add subtour elimination constraints for any subset U ✓ V ,with 3 |U| |V |/2.Too many subtour elimination constraints to use them all, so addthem selectively as needed.(How many possible constraints do we have?)Can also relax the restriction that x be binary: use 0 xe 1.Then have linear program, which can be solved efficiently.Extensions of this approach can solve instances of the TSP withtens of thousands of cities (and hundreds of millions of edges).

Mitchell Traveling Salesman Problem 11 / 19

Seca, K s l U l - l .

Page 18: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Subtours

Refinements

Can add subtour elimination constraints for any subset U ✓ V ,with 3 |U| |V |/2.Too many subtour elimination constraints to use them all, so addthem selectively as needed.(How many possible constraints do we have?)Can also relax the restriction that x be binary: use 0 xe 1.Then have linear program, which can be solved efficiently.Extensions of this approach can solve instances of the TSP withtens of thousands of cities (and hundreds of millions of edges).

Mitchell Traveling Salesman Problem 11 / 19

Page 19: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Subtours

Refinements

Can add subtour elimination constraints for any subset U ✓ V ,with 3 |U| |V |/2.Too many subtour elimination constraints to use them all, so addthem selectively as needed.(How many possible constraints do we have?)Can also relax the restriction that x be binary: use 0 xe 1.Then have linear program, which can be solved efficiently.Extensions of this approach can solve instances of the TSP withtens of thousands of cities (and hundreds of millions of edges).

Mitchell Traveling Salesman Problem 11 / 19

Page 20: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Reoptimizing after adding subtour elimination constraints

Outline

1 Examples

2 Proving Optimality

3 Subtours

4 Reoptimizing after adding subtour elimination constraints

Mitchell Traveling Salesman Problem 12 / 19

Page 21: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Reoptimizing after adding subtour elimination constraints

Using dual simplex to reoptimize

r

s

t

u

v

w1

1

1

1

1

1

5

5

5

edge lengths ce shown

Use two edges incident to each vertex. Eg: xrs + xrt + xru = 2.

Have 0 xij 1 for each edge (i , j). Only impose upper boundexplicitly in simplex tableau for the long edges.

Mitchell Traveling Salesman Problem 13 / 19

Page 22: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Reoptimizing after adding subtour elimination constraints

Initial tableau

xrs xrt xst xuv xuw xvw xru xsv xtw sru ssv stw0 1 1 1 1 1 1 5 5 5 0 0 02 1 1 0 0 0 0 1 0 0 0 0 02 1 0 1 0 0 0 0 1 0 0 0 02 0 1 1 0 0 0 0 0 1 0 0 02 0 0 0 1 1 0 1 0 0 0 0 02 0 0 0 1 0 1 0 1 0 0 0 02 0 0 0 0 1 1 0 0 1 0 0 01 0 0 0 0 0 0 1 0 0 1 0 01 0 0 0 0 0 0 0 1 0 0 1 01 0 0 0 0 0 0 0 0 1 0 0 1

Mitchell Traveling Salesman Problem 14 / 19

L - x r s t x r e +quos t e a l

-

C m(= Xew + Sew

Page 23: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Reoptimizing after adding subtour elimination constraints

Optimal tableau for relaxation

xrs xrt xst xuv xuw xvw xru xsv xtw sru ssv stw�6 0 0 0 0 0 0 4 4 4 0 0 0

1 1 0 0 0 0 0 12

12 �1

2 0 0 01 0 1 0 0 0 0 1

2 �12

12 0 0 0

1 0 0 1 0 0 0 �12

12

12 0 0 0

1 0 0 0 1 0 0 12

12 �1

2 0 0 01 0 0 0 0 1 0 1

2 �12

12 0 0 0

1 0 0 0 0 0 1 �12

12

12 0 0 0

1 0 0 0 0 0 0 1 0 0 1 0 01 0 0 0 0 0 0 0 1 0 0 1 01 0 0 0 0 0 0 0 0 1 0 0 1

r

s

t

u

v

w

Mitchell Traveling Salesman Problem 15 / 19

9 basic variables:column of identitymatr ix

i n\ See x r u = x s v

e x e - =O

Page 24: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Reoptimizing after adding subtour elimination constraints

Add subtour elimination contraint

xrs xrt xst xuv xuw xvw xru xsv xtw sru ssv stw xrst�6 0 0 0 0 0 0 4 4 4 0 0 0 0

1 1 0 0 0 0 0 12

12 �1

2 0 0 0 01 0 1 0 0 0 0 1

2 �12

12 0 0 0 0

1 0 0 1 0 0 0 �12

12

12 0 0 0 0

1 0 0 0 1 0 0 12

12 �1

2 0 0 0 01 0 0 0 0 1 0 1

2 �12

12 0 0 0 0

1 0 0 0 0 0 1 �12

12

12 0 0 0 0

1 0 0 0 0 0 0 1 0 0 1 0 0 01 0 0 0 0 0 0 0 1 0 0 1 0 01 0 0 0 0 0 0 0 0 1 0 0 1 02 1 1 1 0 0 0 0 0 0 0 0 0 1

xrs + xrt + xst 2, slack variable xrst

Mitchell Traveling Salesman Problem 16 / 19

Page 25: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Reoptimizing after adding subtour elimination constraints

Pivot to dual canonical form

xrs xrt xst xuv xuw xvw xru xsv xtw sru ssv stw xrst�6 0 0 0 0 0 0 4 4 4 0 0 0 0

1 1 0 0 0 0 0 12

12 �1

2 0 0 0 01 0 1 0 0 0 0 1

2 �12

12 0 0 0 0

1 0 0 1 0 0 0 �12

12

12 0 0 0 0

1 0 0 0 1 0 0 12

12 �1

2 0 0 0 01 0 0 0 0 1 0 1

2 �12

12 0 0 0 0

1 0 0 0 0 0 1 �12

12

12 0 0 0 0

1 0 0 0 0 0 0 1 0 0 1 0 0 01 0 0 0 0 0 0 0 1 0 0 1 0 01 0 0 0 0 0 0 0 0 1 0 0 1 0

�1 0 0 0 0 0 0 � 12� �1

2 �12 0 0 0 1

� � � � � � 8 8 8 � � � �

Optimize using dual simplex.Mitchell Traveling Salesman Problem 17 / 19

Page 26: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Reoptimizing after adding subtour elimination constraints

Result of first dual simplex pivot

xrs xrt xst xuv xuw xvw xru xsv xtw sru ssv stw xrst�14 0 0 0 0 0 0 0 0 0 0 0 0 8

0 1 0 0 0 0 0 0 0 �1 0 0 0 10 0 1 0 0 0 0 0 �1 0 0 0 0 12 0 0 1 0 0 0 0 1 1 0 0 0 �10 0 0 0 1 0 0 0 0 �1 0 0 0 10 0 0 0 0 1 0 0 �1 0 0 0 0 12 0 0 0 0 0 1 0 1 1 0 0 0 �1

�1 0 0 0 0 0 0 0 � 1� �1 1 0 0 21 0 0 0 0 0 0 0 1 0 0 1 0 01 0 0 0 0 0 0 0 0 1 0 0 1 02 0 0 0 0 0 0 1 1 1 0 0 0 �2

� � � � � � � 0 0 � � � �

Optimize using dual simplex.Mitchell Traveling Salesman Problem 18 / 19

Page 27: Math Models of OR: Traveling Salesman Problemeaton.math.rpi.edu/faculty/Mitchell/courses/matp... · Math Models of OR: Traveling Salesman Problem John E. Mitchell Department of Mathematical

Reoptimizing after adding subtour elimination constraints

Result of second dual simplex pivot

xrs xrt xst xuv xuw xvw xru xsv xtw sru ssv stw xrst�14 0 0 0 0 0 0 0 0 0 0 0 0 8

0 1 0 0 0 0 0 0 0 �1 0 0 0 11 0 1 0 0 0 0 0 0 1 �1 0 0 �11 0 0 1 0 0 0 0 0 0 1 0 0 10 0 0 0 1 0 0 0 0 �1 0 0 0 11 0 0 0 0 1 0 0 0 1 �1 0 0 �11 0 0 0 0 0 1 0 0 0 1 0 0 11 0 0 0 0 0 0 0 1 1 �1 0 0 �20 0 0 0 0 0 0 0 0 �1 0 1 0 21 0 0 0 0 0 0 0 0 1 0 0 1 01 0 0 0 0 0 0 1 0 0 1 0 0 0

r

s

t

u

v

wOptimal in relaxation

Feasible in TSPOptimal in TSP

Mitchell Traveling Salesman Problem 19 / 19