2 TSP algorithms: (1) AP+B&B, (2) min spanning tree.

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

Unit-iv.
Analysis of Algorithms
and 6.855J Cycle Canceling Algorithm. 2 A minimum cost flow problem , $4 20, $1 20, $2 25, $2 25, $5 20, $6 30, $
Thursday, April 11 Some more applications of integer
Introduction to Algorithms 6.046J/18.401J/SMA5503
and 6.855J Spanning Tree Algorithms. 2 The Greedy Algorithm in Action
0 - 0.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLICATION EQUATIONS 1. SOLVE FOR X 3. WHAT EVER YOU DO TO ONE SIDE YOU HAVE TO DO TO THE OTHER 2. DIVIDE BY THE NUMBER IN FRONT OF THE VARIABLE.
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
1 LP, extended maxflow, TRW OR: How to understand Vladimirs most recent work Ramin Zabih Cornell University.
1 Constraints and Updating Hugh Darwen CS252.HACD: Fundamentals of Relational Databases Section 7: Constraints.
Introduction to Algorithms Spanning Trees
1 Outline relationship among topics secrets LP with upper bounds by Simplex method basic feasible solution (BFS) by Simplex method for bounded variables.
Decision Maths Networks Kruskals Algorithm Wiltshire Networks A Network is a weighted graph, which just means there is a number associated with each.
Weighted Matching-Algorithms, Hamiltonian Cycles and TSP
Chapter 4: Informed Heuristic Search
Greedy Technique Constructs a solution to an optimization problem piece by piece through a sequence of choices that are: feasible, i.e. satisfying the.
1 Column Generation. 2 Outline trim loss problem different formulations column generation the trim loss problem master problem and subproblem in column.
Chapter 23 Minimum Spanning Tree
1 Branch-and-Price (Column Generation) Solving Integer Programs With a Huge Number of Variables CP-AI-OR02 School on Optimization Le Croisic, France March.
A New Recombination Lower Bound and The Minimum Perfect Phylogenetic Forest Problem Yufeng Wu and Dan Gusfield UC Davis COCOON07 July 16, 2007.
Traffic assignment.
Outline Minimum Spanning Tree Maximal Flow Algorithm LP formulation 1.
Great Theoretical Ideas in Computer Science
IEOR 4004 Final Review part II.
Addition 1’s to 20.
Week 1.
We will resume in: 25 Minutes.
Dantzig-Wolfe Decomposition
Section 3.4 The Traveling Salesperson Problem Tucker Applied Combinatorics By Aaron Desrochers and Ben Epstein.
H.P. WILLIAMS LONDON SCHOOL OF ECONOMICS
DMOR Networks. Graphs: Koenigsberg bridges Leonard Euler problem (1736)
Vehicle Routing & Scheduling: Part 1
Integer Programming 3 Brief Review of Branch and Bound
1 Greedy Algorithms. 2 2 A short list of categories Algorithm types we will consider include: Simple recursive algorithms Backtracking algorithms Divide.
Approximation Algorithms Motivation and Definitions TSP Vertex Cover Scheduling.
1 Lecture 4 Maximal Flow Problems Set Covering Problems.
1.3 Modeling with exponentially many constr.  Some strong formulations (or even formulation itself) may involve exponentially many constraints (cutting.
Network Models (2) Tran Van Hoai Faculty of Computer Science & Engineering HCMC University of Technology Tran Van Hoai.
MODELING AND ANALYSIS OF MANUFACTURING SYSTEMS Session 12 MACHINE SETUP AND OPERATION SEQUENCING E. Gutierrez-Miravete Spring 2001.
Notes 5IE 3121 Knapsack Model Intuitive idea: what is the most valuable collection of items that can be fit into a backpack?
Chap 10. Integer Prog. Formulations
and 6.855J Lagrangian Relaxation I never missed the opportunity to remove obstacles in the way of unity. —Mohandas Gandhi.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
1 Network Models Transportation Problem (TP) Distributing any commodity from any group of supply centers, called sources, to any group of receiving.
Integer Linear Programming Terms Pure integer programming mixed integer programming 0-1 integer programming LP relaxation of the IP Upper bound O.F. Lower.
EMIS 8373: Integer Programming Combinatorial Relaxations and Duals Updated 8 February 2005.
Lagrangean Relaxation
1.3 Modeling with exponentially many constr. Integer Programming
Tuesday, March 19 The Network Simplex Method for Solving the Minimum Cost Flow Problem Handouts: Lecture Notes Warning: there is a lot to the network.
::Network Optimization:: Minimum Spanning Trees and Clustering Taufik Djatna, Dr.Eng. 1.
EMIS 8373: Integer Programming Combinatorial Optimization Problems updated 27 January 2005.
The travelling salesman problem Finding an upper bound using minimum spanning trees Find a minimum spanning tree using Prim’s algorithm or Kruskal’s algorithm.
Greedy Algorithms.
D1 Discrete Mathematics
Integer Programming An integer linear program (ILP) is defined exactly as a linear program except that values of variables in a feasible solution have.
Greedy Technique.
1.3 Modeling with exponentially many constr.
2 TSP algorithms: (1) AP+B&B, (2) min spanning tree.
The Travelling Salesperson problem
D1 Discrete Mathematics
Advanced Analysis of Algorithms
Shortest Paths and Minimum Spanning Trees
1.3 Modeling with exponentially many constr.
Artificial Intelligence
Networks Kruskal’s Algorithm
EMIS 8373: Integer Programming
Presentation transcript:

2 TSP algorithms: (1) AP+B&B, (2) min spanning tree. The assignment problem is a relaxation of the TSP Indices: i, j = city. Parameter: cij = cost to go from city i to city j. Variables: xij = 1 if we drive from city i to city j, else 0. Model TSP: 1. Minimise total cost: min ij cij xij , 2. Enter each city once: i xij = 1 for all j. 3. Leave each city once: j xij = 1 for all i. 4. Binary integrality: xij  {0, 1} for all i, j. 5. No subtours: i,jS xij  |S| – 1, for every subset S. (1) to (4) is the assignment problem AP, which is easy. Every solution to TSP is a solution to AP, but not vice versa. AP is a relaxation of TSP, and AP gives a lower bound. AP

One way to break subtours: B&B We can break subtours by adding constraints: x3,2 + x2,4 + x4,3  2. After solving again, other subtours appear. Instead, we can branch on a variable in the subtour: Create an assignment subproblem with x4,3 = 0. This is a B&B algorithm specialised for the TSP. 3 3 1 1 4 4

Example, Winston (2003), pp. 530-534 When we solve subproblem S1, we get subtours 1-2-5-1, 3-4-3. In the optimal solution, either x3,4 = 0 or x4,3 = 0. So let’s make 2 subproblems, S2 for x3,4=0, and S3 for x4,3=0.

With x3,4 = 0, we get 1-4-3-1 instead of 1-3-4-1. We also have the subtour 2-5-2. Let’s branch on x2,5=0 for S4. (To do list: S3 with x4,3 = 0.)

So we have an upper bound of 668. S4 gives a tour! 1-5-2-4-3-1 So we have an upper bound of 668. The optimum is 668 or less.

The complete B&B tree S1: ov=495, 1-2-5-1, 1-3-4-1. x3,4 = 0 x4,3 = 0 1-4-3-1, 2-5-2 S3: ov=652 1-3-4-1, 2-5-2 x2,5 = 0 x5,2 = 0 x2,5 = 0 x5,2 = 0 S4: ov=668, 1-5-2-4-3-1. S5: ov=704, 1-4-3-2-5-1. S6: ov= 704, 1-5-2-3-4-1 S7: ov=910, 1-3-1, 2-5-4-2 At S4, we found a tour of length 668. The tours at S5 and S6 are worse, so they are not optimal. S7 has subtours, but more constraints cannot help 910, so we quit. So S4 gives the optimal tour, 1-5-2-4-3-1. So we can solve the TSP with B&B, with AP as the subproblem. Each AP subproblem was a relaxation. Are there other relaxations?

Another TSP relaxation: the one-tree First some definitions. Tree: connected graph with no loops. One-tree: a tree plus one loop. Hey! This one tree is a tour! Every tour is a one-tree, but not every one-tree is a tour. 

The minimum spanning tree problem (MST) MST: Find the shortest tree that connects all the dots. Not a good one! This is much better: Many applications: telecommunications, road networks. How do we find the minimum spanning tree? 2 ways, Prim’s algorithm or Kruskal’s algorithm.

Prim’s algorithm Find the closest node that doesn’t make a loop Step 0. Sort all the arcs in increasing order. The tree is empty except for node 1. Step 1. Find the smallest arc i, j or j, i that connects to any node i in the tree. If arc i, j makes a loop, skip it. Else add it to the tree. Step 2. If all the nodes are connected, you’re done. Else, go back to Step 1. See http://www-b2.is.tokushima-u.ac.jp/~ikeda/suuri/dijkstra/PrimApp.shtml?demo7

Kruskal’s algorithm: Find the smallest arc that doesn’t make a loop Step 0. Sort all the arcs in increasing order. The tree is empty. Step 1. Find the shortest arc on the list. If it makes a loop, delete it. Else add it to the tree. Step 2. If all the nodes are connected, you’re done. Else, go back to Step 1. See http://www-b2.is.tokushima-u.ac.jp/~ikeda/suuri/kruskal/KruskalApp.shtml?demo5

Demo of each algorithm 5 3 Prim – closest node 7 4 6 2 8 9 5 1 From To Length Prim Kruskal 7 8 5.1 6 1 6 8 14.3 7 2 6 7 14.5 - - 2 4 17.1 2 3 2 3 25.8 3 4 4 9 28.8 4 5 4 8 29.9 5 6 8 9 30.2 - - 4 7 31.2 - - 3 4 31.9 - - 5 7 32.5 8 7 7 9 35.0 - - 2 9 36.4 - - 5 6 37.0 - - 5 8 37.6 - - 6 9 39.5 - - 1 2 41.0 1 8 4 6 44.2 - - 2 8 46.6 - - 1 9 47.7 - - 2 7 48.2 - - 5 3 Prim – closest node 7 4 2 6 8 9 5 1 Kruskal – smallest arc 3 7 4 2 6 8 9 Exercise: Label the arcs in the order added.  1

We can make an MST, how about a 1-tree? To make a minimum 1-tree: Step 1. Find the MST of all nodes except node 1. Step 2. Add the 2 smallest arcs that connect to node 1. This is easy work. You can do it for 100 cities in a few minutes by hand. 1 2 3 4 7 8 9 6 5

The 1-tree length is a lower bound on the TSP But not a very good one, typically only 63% of the optimum. Our example is only 67% of the optimum. What is wrong with the minimum 1-tree? In the TSP, every node has 2 arcs, one in and one out. In the min 1-tree, some nodes have 1 arc, some have more than 2. We can improve the lower bound as follows: Solve the 1-tree problem, but add a penalty to each arc that comes into a node with the wrong number of arcs.  length=194.5 length=287.1 5 5 3 3 7 7 4 4 2 6 2 8 6 8 9 9 1 1

Recall the symmetric TSP formulation 1. Minimise total cost: min ij>i cij xij , 2. Enter each city once: j<i xji + j>i xij = 2 for all i. 3. Subtour breaking: i,jS xij  |S| – 1, for each subset S. 4. Binary integrality: xij  {0, 1} for all i, j. Subtours (set 3) are not the problem with the min 1-tree. Entering each city (set 2) once is the problem with the min 1-tree. Another way to put the TSP: 2. Enter each city once: j<i xji + j>i xij = 2 for all i. (λi) 3. Must be a 1-tree: x T, where T is the set of all 1-trees. Let’s relax set 2, as for a Dantzig-Wolfe subproblem: 1. Minimise total cost: min ij>i cij xij + iλi(j<i xji + j>i xij – 2) = min ij>i (cij + λi + λj)xij – 2i λi 3. Must be a 1-tree: x T, where T is the set of all 1-trees. 

TSP lower bound with subgradient optimisation Step 0. Set λi = 0. (Cleverer to start with AP’s dual prices.) Pick a jump size tk between 0.5 and 2. Set a small ending tolerance  > 0. Set k = 1. Step 1. Solve the min 1-tree problem. 1-tree(λik): min ij>i cij xij + iλi(j<i xji + j>i xij – 2) x T, where T is the set of all 1-trees. Step 2. Let dik be number of arcs coming into node i at iteration k. If node i is good, dik = 2, keep the penalty: set λik+1 = λik. If node i is bad, dik ≠ 2, change the penalty: set λik+1 = λik + tk (dik − 2). Step 3. If |k+1 – k| < , stop. Else set tk+1 = tk ·0.9, set k = k+1 and go to Step 1.  Excellent animated examples: http://itp.nat.uni-magdeburg.de /~mertens/TSP/

Still no promises, but not bad. Subgradient opt gets a better lower bound than plain 1-tree, often 99%. But it can take a long time. No guarantee we get an optimum. Example: Starting with step size=5, then 1, then 0.5, we get λk = {-41.0, -12.5, -27.5, -19.0, -45.5, -27.5, -20.0, -19.0, -22.0}, and the optimal tour: Why are the prices negative? Not hard to do in AMPL, even possible with Excel & Visual Basic. Another B&B scheme: use 1-trees for subproblems. Branch on arcs that go into nodes with degree ≠ 2. 1 2 3 4 7 8 9 6 5

The 1-tree gives 2 lower bounds – bad & good At the beginning, with all λi=0, we get a bad lower bound. This is just the smallest 1-tree. During subgradient optimisation, we can say nothing about bounds. At the end of subgradient optimisation, with the optimal λ’s, we get a good lower bound. The lower bound is the penalised length, not the ordinary length of the 1-tree. The ordinary (unpenalised) length of the optimised 1-tree could be longer than the optimal tour! If all nodes have degree 2, penalised length = ordinary length, and we have the optimal tour. Ref: Held, M., & Karp, R., “The Traveling-Salesman Problem and Minimum Spanning Trees” Ops Research, v.18, n.6, Nov-Dec 1970. Next: more on subtours & trees. We’ll also cover this in tutorial.