Optimal tour along pubs in the UK

Similar documents
Travelling Salesman Problem. Algorithms and Networks 2015/2016 Hans L. Bodlaender Johan M. M. van Rooij

Traveling Salesman Problem. Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

Traveling Salesman Problem (TSP) Input: undirected graph G=(V,E), c: E R + Goal: find a tour (Hamiltonian cycle) of minimum cost

Theorem 2.9: nearest addition algorithm

Approximation Algorithms

(Refer Slide Time: 01:00)

1 The Traveling Salesperson Problem (TSP)

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

CMSC 451: Lecture 22 Approximation Algorithms: Vertex Cover and TSP Tuesday, Dec 5, 2017

Greedy algorithms Or Do the right thing

TSP! Find a tour (hamiltonian circuit) that visits! every city exactly once and is of minimal cost.!

Institute of Operating Systems and Computer Networks Algorithms Group. Network Algorithms. Tutorial 4: Matching and other stuff

Algorithms and Experimental Study for the Traveling Salesman Problem of Second Order. Gerold Jäger

Module 6 NP-Complete Problems and Heuristics

Partha Sarathi Mandal

NP-Hard (A) (B) (C) (D) 3 n 2 n TSP-Min any Instance V, E Question: Hamiltonian Cycle TSP V, n 22 n E u, v V H

Lecture 8: The Traveling Salesman Problem

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem

IE 102 Spring Routing Through Networks - 1

Assignment 3b: The traveling salesman problem

val(y, I) α (9.0.2) α (9.0.3)

COMP 355 Advanced Algorithms Approximation Algorithms: VC and TSP Chapter 11 (KT) Section (CLRS)

Module 6 NP-Complete Problems and Heuristics

NP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch]

Module 6 P, NP, NP-Complete Problems and Approximation Algorithms

6 ROUTING PROBLEMS VEHICLE ROUTING PROBLEMS. Vehicle Routing Problem, VRP:

Approximation Algorithms

Unit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W.

Module 6 NP-Complete Problems and Heuristics

Combinatorial Optimization - Lecture 14 - TSP EPFL

Outline. CS38 Introduction to Algorithms. Approximation Algorithms. Optimization Problems. Set Cover. Set cover 5/29/2014. coping with intractibility

Last topic: Summary; Heuristics and Approximation Algorithms Topics we studied so far:

V1.0: Seth Gilbert, V1.1: Steven Halim August 30, Abstract. d(e), and we assume that the distance function is non-negative (i.e., d(x, y) 0).

A constant-factor approximation algorithm for the asymmetric travelling salesman problem

ALGORITHM CHEAPEST INSERTION

Questions? You are given the complete graph of Facebook. What questions would you ask? (What questions could we hope to answer?)

Introduction to Approximation Algorithms

CAD Algorithms. Categorizing Algorithms

CSE 417 Branch & Bound (pt 4) Branch & Bound

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Coping with the Limitations of Algorithm Power Exact Solution Strategies Backtracking Backtracking : A Scenario

Chapter 9 Graph Algorithms

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

Chapter 9 Graph Algorithms

Introduction to Algorithms

Notes for Recitation 9

3 Euler Tours, Hamilton Cycles, and Their Applications

Polynomial time approximation algorithms

SLS Methods: An Overview

Precept 4: Traveling Salesman Problem, Hierarchical Clustering. Qian Zhu 2/23/2011

2 Approximation Algorithms for Metric TSP

Best known solution time is Ω(V!) Check every permutation of vertices to see if there is a graph edge between adjacent vertices

An O(log n/ log log n)-approximation Algorithm for the Asymmetric Traveling Salesman Problem

Chapter 9 Graph Algorithms

1 The Traveling Salesman Problem

Notes for Lecture 24

Basic Approximation algorithms

Restricted Delivery Problems on a Network. December 17, Abstract

APPROXIMATION ALGORITHMS FOR GEOMETRIC PROBLEMS

Discrete (and Continuous) Optimization WI4 131

CS 4407 Algorithms. Lecture 8: Circumventing Intractability, using Approximation and other Techniques

Assignment 5: Solutions

Examples of P vs NP: More Problems

Design and Analysis of Algorithms

CS270 Combinatorial Algorithms & Data Structures Spring Lecture 19:

Autumn Minimum Spanning Tree Disjoint Union / Find Traveling Salesman Problem

Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik. Combinatorial Optimization (MA 4502)

1 Variations of the Traveling Salesman Problem

1 The Traveling Salesman Problem

Problem Set 6 (Due: Wednesday, December 6, 2006)

Mathematical Tools for Engineering and Management

Approximation Algorithms

Steiner Tree. Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

Stanford University CS261: Optimization Handout 1 Luca Trevisan January 4, 2011

Hardness of Approximation for the TSP. Michael Lampis LAMSADE Université Paris Dauphine

Vertex Cover Approximations

A NEW HEURISTIC ALGORITHM FOR MULTIPLE TRAVELING SALESMAN PROBLEM

Mathematical Thinking

Simple Graph. General Graph

of optimization problems. In this chapter, it is explained that what network design

Chapter 14 Section 3 - Slide 1

Design and Analysis of Algorithms

Effective Tour Searching for Large TSP Instances. Gerold Jäger

Introduction to Graph Theory

Algorithm Design and Analysis

MVE165/MMG630, Applied Optimization Lecture 8 Integer linear programming algorithms. Ann-Brith Strömberg

Algorithm Design Techniques. Hwansoo Han

Kurt Mehlhorn, MPI für Informatik. Curve and Surface Reconstruction p.1/25

5.5 The Travelling Salesman Problem

Fall CS598CC: Approximation Algorithms. Chandra Chekuri

Two new variants of Christofides heuristic for the Static TSP and a computational study of a nearest neighbor approach for the Dynamic TSP

Exact Algorithms for NP-hard problems

Approximation Algorithms

Reference Sheet for CO142.2 Discrete Mathematics II

Coping with NP-Completeness

Slides on Approximation algorithms, part 2: Basic approximation algorithms

Traveling Salesperson Problem (TSP)

The k-center problem Approximation Algorithms 2009 Petros Potikas

2. Optimization problems 6

An Experimental Evaluation of the Best-of-Many Christofides Algorithm for the Traveling Salesman Problem

Transcription:

1 From Facebook

Optimal tour along 24727 pubs in the UK Road distance (by google maps) see also http://www.math.uwaterloo.ca/tsp/pubs/index.html (part of TSP homepage http://www.math.uwaterloo.ca/tsp/ ) Applies branch-and-cut and heuristic based on Lin- Kernighan 2 A&N: TSP

The Landscape of Algorithms example: Travelling Salesman Problem Algorithms for Decision Support 3

Solution quality Computation time Optimum Bound on quality Good solution, no quality guarantee Polynomial Polynomial solution algorithms Approximation algorithms Construction heuristics Super polynomial and/or no guarantee Exact algorithms: Tree search Dynamic programming Integer linear programming Hybrid algorithms Column generation without complete branch-andprice Meta heuristics: Local search Genetic algorithms 4

Contents TSP and its applications Construction heuristics and Approximation algorithms Local search Exact algorithms TSP is the most frequently used benchmark for new algorithms 5

Travelling Salesman Problem PROBLEM DEFINITION APPLICATIONS 6

Travelling Salesman Problem Instance: n vertices (cities), distance between every pair of vertices. Question: Find shortest (simple) cycle that visits every city exactly once? 4 1 2 2 3 5 2 3 2 4 4 4 1 2 1 2 2 3 2 3 5 5 2 2 3 4 3 2 4 2 13 11 7

Applications Vehicle routing Routing school buses Pickup and delivery problems Robotics Scheduling of a machine to drill holes in a circuit board or other object (chip manufacturing) 8

Assumptions / Problem Variants Complete graph vs underlying graph structure. Complete graph: a given distance between all pairs of cities. Directed edges vs undirected arcs. Undirected: symmetric: w(u,v) = w(v,u). Directed: not symmetric. Asymmetric examples: one-way streets, prices of flight tickets. Lengths: Lengths are non-negative (or positive). Triangle inequality: for all x, y, z: w(x,y) + w(y,z) w(x,z) Different assumptions lead to different problems. 9

NP-complete Instance: cities, distances, k. Question: is there a TSP-tour of length at most k? Is an NP-complete problem. Has been shown by reduction from Hamiltonian Circuit problem. 10

Solution quality Computation time Optimum Bound on quality Good solution, no quality guarantee Polynomial Polynomial solution algorithms Approximation algorithms Construction heuristics Super polynomial and/or no guarantee Exact algorithms: Tree search Dynamic programming Integer linear programming Hybrid algorithms Column generation without complete branch-andprice Meta heuristics: Local search Genetic algorithms 11

Approximation algorithms Have performance guarantee, also called approximation ratio. We consider a minimization problem P. Let Z x be the value found by algorithm A for instance x Let Zopt x be the optimal value for instance x Clearly Z x Z x Then A is a approximation algorithm with worst case performance guarantee c (c>1) if for each instance x of P we have Z A x cz opt x i. e. Z A x Z opt x c In case maximization we require Z x cz x (now c<1) 12

1 st Construction Heuristic: Nearest neighbor Start at some vertex s; v=s; While not all vertices visited Select closest unvisited neighbor w of v Go from v to w; v=w Go from v to s. 13

Minimum spanning tree Algorithm of Kruskal: Builds a tree T step by step In each step it adds the edge with minimal cost in the graph which does not cause T to be a cycle Algorithm of Prim/Dijkstra Builds a tree T step by step In each step it adds the edge minimal cost connecting a vertex from T with a vertex outside T 14

2 nd Construction Heuristic: Double tree heuristic with ratio 2 Assume symmetric TSP Find a minimum spanning tree Make a tour as follows: Walk along all vertices of the MST (you visits every edge twice) Apply shortcuts If triangle inequality, we have approximation ratio 2: OPT MST 2 MST Result Result 2MST 2OPT Result/OPT 2 15

3 rd Construction Heuristic: Christofides Assume asymmetric TSP 1. Make a Minimum Spanning Tree T. 2. Set W = {v v has odd degree in tree T}. W must be even, since for any graph degree v 2 E 3. Compute a minimum weight matching M in the graph G[W]. 4. Look at the graph T+M. Note that T+M is Eulerian (all vertices haven even degree)! 5. Compute an Euler tour (tour that visits every edge exactly once) C in T+M. 6. Add shortcuts to C to get a TSP-tour. 16

Triangle inequality: Ratio 1.5 Total length edges in MST T: at most OPT Red matching+ black matching OPT Total length edges in min weight matching M: at most OPT/2. Euler circuit C in (T+M) has length at most 3/2 OPT. By -inequality, result after shortcut at most 3/2 OPT. Vertices in W Optimal tour 17

4 th Construction Heuristic: Closest insertion heuristic Build tour by starting with one vertex, and inserting vertices one by one. Always insert vertex that is closest to a vertex already in tour. 18

Closest insertion heuristic has performance ratio 2 Assume symmetric TSP Build tree T: if v is added to tour, add to T edge from v to closest vertex on tour. T is a Minimum Spanning Tree (Prim s algorithm). Total length of T OPT. Length of tour 2* length of T 2 OPT. 19

Many variants Closest insertion: insert vertex closest to vertex in the tour. Farthest insertion: insert vertex whose minimum distance to a node on the cycle is maximum. Cheapest insertion: insert the node that can be inserted with minimum increase in cost. Computationally expensive. Random insertion: randomly select a vertex. Each time: insert vertex at position that gives minimum increase of tour length. 20

5 th Construction Heuristic: Cycle merging heuristic Start with n cycles of length 0. Repeat: Find two cycles with minimum distance. Merge them into one cycle. Until 1 cycle with n vertices. 21

6 th Construction Heuristic: Savings heuristic Cycle merging heuristic where we merge tours that provide the largest savings : Saving for a merge: merge with the smallest additional cost / largest savings. Quite similar to Clark and Wright savings heuristic for vehicle routing 22

Some test results In an overview paper, Junger et al. report on tests on set of instances (105 2392 vertices; city-generated TSP benchmarks) Nearest neighbor: Closest insertion: Farthest insertion: Cheapest insertion: Random Insertion: Min spanning trees: Christofides Savings method: What is the average distance to the optimum 23

Some test results In an overview paper, Junger et al. report on tests on set of instances (105 2392 vertices; city-generated TSP benchmarks) Nearest neighbor: 24% away from optimal in average Closest insertion: 20%; Farthest insertion: 10%; Cheapest insertion: 17%; Random Insertion: 11%; Min spanning trees: 38%; Christofides: 19% with improvement 11% / 10%; Savings method: 10% (and fast). 24

If triangle inequality does not hold: negative result Theorem: If P NP, then there is no polynomial time algorithm for TSP without triangle inequality that approximates within a ratio c, for any constant c. Proof: Suppose there is such a polynomial time algorithm A. We build a polynomial time algorithm for Hamiltonian Circuit (giving a contradiction with P NP ): Take instance G=(V,E) of Hamiltonian Circuit. Build instance of TSP: A city for each v V. If (v,w) E, then d(v,w) = 1, otherwise d(v,w) = nc+1. Now run A on this instance A finds a TSP-tour with distance at most nc, if and only if, G has a Hamiltonian circuit. 25

Solution quality Computation time Optimum Bound on quality Good solution, no quality guarantee Polynomial Polynomial solution algorithms Approximation algorithms Construction heuristics Super polynomial and/or no guarantee Exact algorithms: Tree search Dynamic programming Integer linear programming Hybrid algorithms Column generation without complete branch-andprice Meta heuristics: Local search Genetic algorithms 26

Improvement heuristics Start with a tour (e.g., from heuristic) and improve it stepwise Iterative improvement 27

Iterative improvement: General idea Apply rules that modifies solution to different solution While there is a Rule(sol, sol ) with sol a better solution than sol Take sol instead of sol Cost decrease Stuck in `local minimum Can use exponential time in theory 28

Very simple Node insertion: Take a vertex v and put it in a different spot in the tour. Edge insertion: Take two successive vertices v, w and put these as edge somewhere else in the tour. 29

2-opt Take two edges (v,w) and (x,y) and replace them by (v,x) and (w,y) if this improves the tour. Costly: part of tour should be turned around. v w x y In R : get rid of crossings of tour. v x w y 30

3-opt Choose three edges from tour Remove them, and combine the three parts to a tour in the cheapest way to link them 31

3-opt Costly to find 3-opt improvements: O(n 3 ) candidates Special case: Two of the three removed edges are consecutive edges in the tour, i.e. they are connected to the same vertex Boils down to node insertion (or 2-opt if you put back one of the original edges) Also known as 2.5-opt k-opt: generalizes 3-opt 32

2.5-opt Special case of 3-ipt: two of the three removed edges are consecutive edges in the tour, i.e. they are connected to the same vertex 33

Lin-Kernighan Idea: modifications that are bad can lead to something good Tour modification: Collection of simple changes Some increase length Total set of changes decreases length 34

Lin-Kernighan One LK step: Make sets of edges X = {x 1,, x r }, Y = {y 1,,y r } If we replace X by Y in tour then we have another tour Sets are built stepwise Repeated until Variants possible 35

Lin-Kernighan step 1. Break the tour 2. Add a new edge u w v 3. Break the subtour 4. If connecting to a complete tour gives an improvement, stop. Otherwise repeat (go to Step 1). u w v 36

Iterated Lin-Kernighan Construct a start tour. Repeat the following r times: Improve the tour with Lin-Kernighan until not possible. Do a random 4-opt move that does not increase the length with more than 10 percent. Report the best tour seen. Cost much time. Gives excellent results! 37

Local search methods Improvement heuristics can be used in different local search methods. Simulated annealing Tabu search Variable neighborhood search Genetic algorithms 38

Solution quality Computation time Optimum Bound on quality Good solution, no quality guarantee Polynomial Polynomial solution algorithms Approximation algorithms Construction heuristics Super polynomial and/or no guarantee Exact algorithms: Tree search Dynamic programming Integer linear programming Hybrid algorithms Column generation without complete branch-andprice Meta heuristics: Local search Genetic algorithms 39

Dynamic programming: Held-Karp algorithm for TSP O(n 2 2 n ) algorithm for TSP. Uses dynamic programming. Take some starting vertex s. For set of vertices R (s R), vertex w R, let B(R,w) = minimum length of a path, that Starts in s. Visits all vertices in R (and no other vertices). Ends in w. 40

TSP: Recursive formulation B({s},v) = w(s,v) if v s If R > 1, then B(R,x) = min v R,v s B( R\{v}, v ) + w(v,x) If we have all B(V\{v},v) then we can solve TSP. Gives requested algorithm using DP-techniques. 41

Held-Karp Dynamic programming algorithm uses: O(n 2 2 n ) time. O(n2 n ) space. In practice space becomes a problem before time does. 42

ILP formulation Variables for selecting edges One edge entering each city One edge leaving each city Subtour elimination constraints. Recall: Branch-and-cut has world record TSP solving 43

Other methods Simulated annealing and similar methods. Problem specific approaches, special cases. Iterated LK combined with treewidth/branchwidth approach 44

S The slides for this course were written by: Marjan van den Akker Peter de Waal Han Hoogeveen Hans Bodlaender Johan van Rooij 45

Cycle merging heuristic has performance ratio 2 Assume symmetric and triangle inequality Build tree T: if edge e is added to tour, add e to T. T is a Minimum Spanning Tree (we did Kruskal s algorithm). Total length of T OPT. Length of tour 2* length of T. In each step the tour is increased by at most 2 * length of added edge e 46