210 likes | 553 Views
Tutorial: TSP/1-tree relaxation algorithm. Step 0. Set λ i = 0. Pick a step size t k . Set a small ending tolerance > 0. Set k = 1.
E N D
Tutorial: TSP/1-tree relaxation algorithm • Step 0. Set λi = 0. • Pick a step size tk. • Set a small ending tolerance > 0. • Set k = 1. • Step 1. Solve the min 1-tree problem. 1-tree(λik): min ij>i (cij + λi + λj)xij – 2i λi 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.
What do the prices λi mean? • The variable λiis a “market price” of going to city i. • If no one is willing to travel to i, then we lower the price. • If too many want to travel to i, then we raise the price. • We want a market price whereone arc comes into i, and one arc goes out. • The cost of arc (i, j) is the distance from i to j+ the price at city i • + the price at city j.
k=1, step 0. The data, sorted by distance. • From To Distance • 1 5 17.1 • 4 5 19.7 • 3 4 20.0 • 2 6 20.1 • 1 4 24.8 • 3 5 29.0 • 4 6 40.3 • 1 3 41.6 • 3 6 49.6 • 2 4 50.1 • 2 3 51.9 • 1 6 56.1 • 5 6 59.4 • 2 5 70.1 • 1 2 70.9
k=1, step 1. The first 1-tree. • From To Distance In tree? • 1 5 17.1 5 • 4 5 19.7 1 • 3 4 20.0 2 • 2 6 20.1 4 • 1 4 24.8 6 • 3 5 29.0 • 4 6 40.3 3 • 1 3 41.6 • 3 6 49.6 • 2 4 50.1 • 2 3 51.9 • 1 6 56.1 • 5 6 59.4 • 2 5 70.1 • 1 2 70.9 Leave out node 1 at first, to make the 1-tree at the end.
k=1, steps 2 & 3. Calculating the first penalties. • Start with a penalty stepsize of 10. • Penalty = 10*(# arcs − 2) • Node i Penalty λi • 1 0 • 2 −10 • 3 −10 • 4 20 • 5 0 • 6 0 • The new cost for arc (i, j) = distance (i, j) + λi + λj,so the penalised cost for (2, 6) = 20.1 − 10 + 0 = 10.1. • For Step 3, use = 0.5.|0−0| + |0+10| + |0+10| + |0−20| + |0−0| + |0−0|= 40 > 0.5, so keep going by making another 1-tree.
k=2, step 1. Make 1-tree #2. • Penalty Penalized • From To Distance λi + λj distance In tree? • 2 6 20.1 -10 10.1 1 • 1 5 17.1 0 17.1 5 • 3 5 29 -10 19 3 • 3 4 20 10 30 4 • 1 3 41.6 -10 31.6 6 • 2 3 51.9 -20 31.9 2 • 3 6 49.6 -10 39.6 • 4 5 19.7 20 39.7 • 1 4 24.8 20 44.8 • 1 6 56.1 0 56.1 • 5 6 59.4 0 59.4 • 2 5 70.1 -10 60.1 • 2 4 50.1 10 60.1 • 4 6 40.3 20 60.3 • 1 2 70.9 -10 60.9
k=2, steps 2 & 3. What are the penalties λi2? • Let’s make the step size smaller than 10.Multiply it at each step by 0.66 (instead of 0.9). • New penalty = old penalty + 0.66*10*(# arcs − 2).Algebraically, λik+1 = λik + tk (dik − 2). • Old New • Node # arcs penalty penalty • 1 2 0 0.0 • 2 2 -10 -10.0 • 3 4 -10 3.2 • 4 1 20 13.4 • 5 2 0 0.0 • 6 1 0 -6.6 • For Step 3, = 0.5. • |0−0|+|−10+10|+|−10−3.2|+|20−13.4|+|0−0|+|0+6.6| > 0.5, so keep going by making another 1-tree.
k=3, step 1. Make 1-tree #3 • Penalty Penalized • From To Distance λi + λj distance In tree? • 2 6 20.1 -16.6 3.5 1 • 1 5 17.1 0 17.1 5 • 3 5 29 3.2 32.2 3 • 4 5 19.7 13.4 33.1 4 • 3 4 20 16.6 36.6 • 1 4 24.8 13.4 38.2 6 • 1 3 41.6 3.2 44.8 • 2 3 51.9 -6.8 45.1 2 • 3 6 49.6 -3.4 46.2 • 4 6 40.3 6.8 47.1 • 1 6 56.1 -6.6 49.5 • 5 6 59.4 -6.6 52.8 • 2 4 50.1 3.4 53.5 • 2 5 70.1 -10 60.1 • 1 2 70.9 -10 60.9
k=3, steps 2 & 3. Penalties λi3. • Reduce the step size of 6.6 to 0.66*6.6 = 4.4λik+1 = λik + tk (dik − 2). • Old New • Node # arcs penalty penalty • 1 2 0.0 0.0 • 2 2 -10.0 -10.0 • 3 2 3.2 3.2 • 4 2 13.4 13.4 • 5 3 0.0 4.4 • 6 1 -6.6 -11.0 • For Step 3, = 0.5. • |0−0|+|−10+10|+|−3.2−3.2|+|13.4−13.4|+|0−4.4|+|−6.6+11| > 0.5, so keep going by making another 1-tree.
k=4, step 1. Make 1-tree #4 • Penalty Penalized • From To Distance λi + λj distance In tree? • 2 6 20.1 -21.0 -0.9 1 • 1 5 17.1 4.4 21.5 5 • 3 5 29.0 7.6 36.6 3 • 3 4 20.0 16.6 36.6 4 • 4 5 19.7 17.8 37.5 • 1 4 24.8 13.4 38.2 6 • 3 6 49.6 -7.8 41.8 2 • 4 6 40.3 2.4 42.7 • 1 3 41.6 3.2 44.8 • 2 3 51.9 -6.8 45.1 • 1 6 56.1 -11.0 45.1 • 5 6 59.4 -6.6 52.8 • 2 4 50.1 3.4 53.5 • 1 2 70.9 -10.0 60.9 • 2 5 70.1 -5.6 64.5
k=4, steps 2 & 3. Penalties λi4. • Reduce the step size of 4.4 to 0.66*4.4 = 2.9λik+1 = λik + tk (dik − 2). • Old • Node # arcs penalty Penalty • 1 2 0.0 0.0 • 2 1 -10.0 -12.9 • 3 3 3.2 6.1 • 4 2 13.4 13.4 • 5 2 4.4 4.4 • 6 2 -11.0 -11.0 • For Step 3, = 0.5. • |0−0|+|−10+12.9|+|3.2−6.1|+|13.4−13.4|+|4.4−4.4|+|−11+11| > 0.5, so keep going by making another 1-tree.
k=5, step 1. Make 1-tree #5 • Penalty Penalized • From To Distance λi + λj distance In tree? • 2 6 20.1 -23.8 -3.7 1 • 1 5 17.1 4.4 21.5 5 • 4 5 19.7 17.8 37.5 3 • 1 4 24.8 13.4 38.2 6 • 3 5 29.0 10.4 39.4 4 • 3 4 20.0 19.5 39.5 • 4 6 40.3 2.4 42.7 2 • 3 6 49.6 -4.9 44.7 • 2 3 51.9 -6.8 45.1 • 1 6 56.1 -11.0 45.1 • 1 3 41.6 6.1 47.7 • 2 4 50.1 0.5 50.6 • 5 6 59.4 -6.6 52.8 • 1 2 70.9 -12.9 58.0 • 2 5 70.1 -8.5 61.6
k=5, steps 2 & 3. Penalties λi5. • Reduce the step size of 2.9 to 0.66*2.9 = 1.9λik+1 = λik + tk (dik − 2). • Old • Node # arcs penalty Penalty • 1 2 0.0 0.0 • 2 1 -12.9 -14.8 • 3 1 6.1 4.2 • 4 3 13.4 15.3 • 5 3 4.4 6.3 • 6 2 -11.0 -11.0 • For Step 3, = 0.5. • |0−0|+|12.9+14.8|+|6.1−4.2|+|15.3−13.4|+|6.3−4.4|+|−11+11| > 0.5, so keep going by making another 1-tree.
k=6, step 1. Make 1-tree #6 • Penalty Penalized • From To Distance λi + λj distance In tree? • 2 6 20.1 -25.7 -5.6 1 • 1 5 17.1 6.3 23.4 5 • 3 5 29.0 10.4 39.4 3 • 3 4 20.0 19.5 39.5 4 • 1 4 24.8 15.3 40.1 6 • 4 5 19.7 21.6 41.3 • 2 3 51.9 -10.6 41.3 2 • 3 6 49.6 -6.8 42.8 • 4 6 40.3 4.3 44.6 • 1 6 56.1 -11.0 45.1 • 1 3 41.6 4.2 45.8 • 2 4 50.1 0.5 50.6 • 5 6 59.4 -4.7 54.7 • 1 2 70.9 -14.8 56.1 • 2 5 70.1 -8.5 61.6
k=6, steps 2 & 3. Penalties λi6. • Reduce the step size of 2.9 to 0.66*1.9 = 1.3λik+1 = λik + tk (dik − 2). • Old • Node # arcs penalty Penalty • 1 2 0.0 0.0 • 2 2 -14.8 -14.8 • 3 3 4.2 5.4 • 4 2 15.3 15.3 • 5 2 6.3 6.3 • 6 1 -11.0 -12.2 • For Step 3, = 0.5. • |0−0|+|−14.8+14.8|+|5.4−4.2|+|15.3−15.3|+|6.3−6.3|+|−12.2+11| > 0.5, so keep going by making another 1-tree.
k=7, step 1. Make 1-tree #7 • Penalty Penalized • From To Distance λi + λj distance In tree? • 2 6 20.1 -27.6 -7.5 1 • 1 5 17.1 6.3 23.4 5 • 1 4 24.8 15.3 40.1 6 • 4 5 19.7 21.6 41.3 3 • 3 5 29.0 12.3 41.3 4 • 3 4 20.0 21.4 41.4 • 4 6 40.3 2.4 42.7 2 • 3 6 49.6 -6.8 42.8 • 2 3 51.9 -8.7 43.2 • 1 6 56.1 -12.9 43.2 • 1 3 41.6 6.1 47.7 • 2 4 50.1 0.5 50.6 • 5 6 59.4 -6.6 52.8 • 1 2 70.9 -14.8 56.1 • 2 5 70.1 -8.5 61.6
k=7, steps 2 & 3. Penalties λi7. • New step size = 1.9*0.66 = 1.3.λik+1 = λik + tk (dik − 2). • Old • Node # arcs penalty Penalty • 1 2 0.0 0.0 • 2 1 -14.8 -16.0 • 3 1 6.1 4.8 • 4 3 15.3 16.5 • 5 3 6.3 7.5 • 6 2 -12.9 -12.9 • For Step 3, = 0.5.They all change a bit, so keep going by making another 1-tree. • We’ll skip a few iterations.
At k = 11, we have a tour! • Penalty Penalized • From To Distance λi + λj distance In tree? • 2 6 20.1 -30.5 -10.4 1 • 1 5 17.1 7.5 24.6 5 • 1 4 24.8 16.5 41.3 6 • 2 3 51.9 -10.1 41.8 2 • 3 6 49.6 -7.5 42.1 • 1 6 56.1 -13.9 42.2 • 4 6 40.3 2.6 42.9 3 • 3 5 29.0 13.9 42.9 4 • 3 4 20.0 23.0 43.0 • 4 5 19.7 24.1 43.8 • 1 3 41.6 6.4 48.0 • 2 4 50.1 0.0 50.1 • 5 6 59.4 -6.4 53.0 • 1 2 70.9 -16.5 54.4 • 2 5 70.1 -9.0 61.1
k=11, steps 2 & 3. Penalties λi11. • New step size = 1.9*0.66 = 1.3. λik+1 = λik + tk (dik − 2). • Node # arcs Old penalty Penalty • 1 2 0.0 0.0 • 2 2 -16.5 -16.5 • 3 2 6.4 6.4 • 4 2 16.5 16.5 • 5 2 7.5 7.5 • 6 2 -13.9 -13.9 • For Step 3, = 0.5. Note the penalties sum to zero.All the prices are the same, since all nodes have 2 arcs.In solving a relaxation, we have a primal feasible solution.So this is optimal to the TSP. Lingo agrees. • In general, there is no guarantee that we will end with a tour!
What is the lower bound on the TSP? • The optimal value of this 1-tree relaxation is a lower bound on the TSP: • min ij>i (cij + λi + λj)xij – 2i λi, x T, where T is the set of 1-trees. • From To Distance λi + λj Penalized dist In tree? • 2 6 20.1 -30.5 -10.4 1 • 1 5 17.1 7.5 24.6 5 • 1 4 24.8 16.5 41.3 6 • 2 3 51.9 -10.1 41.8 2 • 4 6 40.3 2.6 42.9 3 • 3 5 29.0 13.9 42.9 4 • Since the penalties sum to zero,ij>i (cij + λi + λj)xij – 2i λi = ij>i cijxij = 183.2. • So a lower bound on this TSP is 183.2. • In general, we use the penalized distance, not the length of the 1-tree. • If all nodes have 2 arcs, the penalized distance equals the 1-tree length. • See http://itp.nat.uni-magdeburg.de/~mertens/TSP/node4.html.