polynomial time approximation scheme (ptas) for euclidian traveling salesman problem (tsp)

53
Polynomial Time Approximation Scheme (PTAS) for Euclidian Traveling Salesman Problem (TSP) Presented By: Dahan Yakir Sepetnitsky Vitali

Upload: allene

Post on 22-Feb-2016

44 views

Category:

Documents


0 download

DESCRIPTION

Polynomial Time Approximation Scheme (PTAS) for Euclidian Traveling Salesman Problem (TSP) Presented By: Dahan Yakir Sepetnitsky Vitali. Introduction The Traveling Salesman (TSP) problem. Given n points For each pair { i , j} of distinct points , a cost c i,j - PowerPoint PPT Presentation

TRANSCRIPT

1

Polynomial Time Approximation Scheme(PTAS)for Euclidian Traveling SalesmanProblem(TSP)

Presented By:Dahan YakirSepetnitsky VitaliIntroduction The Traveling Salesman (TSP) problemGiven n pointsFor each pair {i, j} of distinct points, a cost ci,jA shortest path is desiredShortest path = a closed path thatVisits each point exactly once, denote a path like that, as salesman tourThe sum of all distances along the path is minimal (the path have a minimal cost)This problem is NP-hardIn Euclidian TSP the points are in (i.e. in 2D the input is a set of n points in the plane) and the costs

are Euclidian distances: The distances satisfy triangle inequalityEven 2D Euclidian TSP is NP-hardPTAS or Polynomial Time-approximation Scheme is a polynomial-time algorithm which finds an (1 + )-approximation to the optimal solution for > 0The run-time is polynomial by n

Introduction Euclidian TSP + PTAS

We will show that Euclidian TSP has a PTASThe algorithm was given by Sanjeev Arora at 1996 and improved several times through 1996-1998A randomized algorithm will be presentedThe PTAS, we will describe, is for points on the plane (d = 2) but there is an extension to an arbitrary dThe algorithm computes an (1 + )-approximation to the optimal solution in no(1) timeThe algorithm is based on dynamic programmingThe algorithm can be de-randomized, but then the run-time should be increased by a factor of n4Introduction The algorithm we will presentThe main idea of the PTAS is that the plane (and thus the instance) can be recursively partitioned such that some (1 + )-approximation tour crosses each line of the partition a bounded number of timesFor each line in the partition the algorithm guesses where the tour crosses this line and the crossings number , then it recurses on the two sides of the lineThere is no way to define a deterministic solution to the approximation tour, so it is specified probabilistically

The main idea A general descriptionBasic definitions A deterministic version of the algorithmCounterexamplesA randomized version of the algorithm which guarantees an (1 + )-approximation to the optimal solution with probability 12This lesson StructureStep 1 Bounding Box of a TSP instanceThe smallest axis parallel square containing the instanceLet L be the side length of the square and assume w.l.o.g. that L is power of 2, i.e. L = 2kWe will call L the size of the boxWe can scale all distances such that L = 4n2 and thus: k = 2+2log2n = O(log n)Step 2 Perturbation of a TSP instanceFirst, we perform a simple perturbation of the given TSP instance, I, and create a new instance IDefine a unit grid on the bounding box and relocate each point to the nearest grid pointThe maximum distance from a point to a nearest grid point is at most 2/2LStep 2 Error analysis of the PerturbationApproximate the error we get by the described perturbationAt least two points are on opposite edges of the square, therefore each solution cost is 2LFor a given solution cost SOL, the perturbation of the instance increases the solution length by 2 for each point

L2 go to the closest grid point, and then come back (2 / 2) * 2 = 29Step 2 Error analysis of the Perturbation (Cont.)The perturbation of the instance increases the solution length by n2 for all the pointsTherefore if we denote the cost of the solution after a perturbation was made on it, as SOL , we have:

(SOL SOL)SOL n22L = n28n2 = = 142nL10Step 2 Error analysis of the Perturbation (Cont.)Assume we are given an (1 + )-approximation of OPT to the perturbed instance I of the TSP problemThe corresponding solution to the instance I (the points are shifted to the original place) is an (1 + + 142n)-approximation of OPTFor sufficiently large n, we can adjust to reach the desired errorLLets define the optimal cost of the TSP problem solution as OPT.

Assume we have (1 + )-approximation to I (denote its cost as SOL) SOL (1 + )OPT

Now, lets take the solution SOL and move all the points, back to their original position, lets denote the new tour cost as SOL

According to the stated in the previous slide we have: (SOL SOL)SOL n22L = n28n2 = 142n SOL (1 + 142n)SOL

Thus we have: SOL (1 + 142n)SOL (1 + 142n) (1 + )OPT = (1 + 142n + + 142n) OPT

Therefore, the corresponding solution for the I instance of the TSP problem is (1 + + 142n)-approximation (the 142n part is negligible)11A recursive partitioning into four smaller squaresAn L L square is divided into four L2 L2 squares and so onWe view the partitioning as a 4-ary tree T , whose root is the bounding box, the four L2 L2 squares are its children and so on

Step 3 Dissection of the Bounding BoxLL2Step 3 Dissection of the Bounding Box (Cont.)A useful square is a square represented by a node in TThe dissection is continued until we obtain squares with size 1 (therefore each one has at most one point in its interior)The tree depth is O(log L)

13Step 3 Dissection of the Bounding Box (Cont.)Assign levels to the nodes of T The root is at level 0, its children at level 1 and so onThe squares represented by nodes of T get levels accordinglySquares at level i have dimensions L2i L2i

Level 0 squareLevel 1 square14The basic dissection of the bounding box can be seen as a 4-ary tree with depth O(k) = O(log L)At each level i there are 4i squares (i = 0 to k) The number of the nodes in the tree is therefore: 1 + 4 + 42 + + 4k = (4k + 1 - 1) / (4 - 1) = = O(4k) = O(42 + 2 log n) = O(n4)

Step 3 Dissection of the Bounding Box (Cont.)The bounding boxLevel 1 squaresLevel 2 squaresAt last level there are L2 unit squares, which can be represented as a power of 4 (since the tree is 4-ary).

Therefore we get L2 = 4x, but, according to the previous assumption L = 2k. Thus, we get 22x = 2k 2k = 22k 2x = 2k x = k

We got that at the last level of the tree there are 4k squares the depth of the tree is k15Step 3 Dissection of the Bounding Box (Cont.)Now we assign levels for the lines from which the dissection is constructedLevel i lines create the level i squaresLine at level i forms an edge for useful squares at levels i, i + 1,

Level 1 squareLevel 2 squareLevel 3 square16Step 4 PortalsA special set of points defined for each lineThe solution is allowed to cross a grid line only at a portalThe portals are equidistant points - L(2im) apart at level i lineEach useful square has at most 4m portals on its sides and corners

L(2im)portal...17Step 4 Portals (Cont.)m is a power of 2 and belongs to [k , 2 k]Therefore m = O(log n)A portal in a level i square is a portal of a contained level i + 1 square as well

L(2im)portal...18A tour is well behaved with respect to the basic dissection (WB) if it is a tour through all the n points and any subset of the portalsThe tour is allowed to visit portals multiple timesThe tour must be non-self-intersectingA tour is well behaved with respect to the basic dissection with limited crossings (WBLC) if it is a well behaved tour (as defined above) and, in addition, it visits each portal at most twice

Definitions Well behaved toursAny well behaved tour can be transformed to a WBLC tour, whose length is at most the length of Points of the proof:Given a well behaved tour , we will transform it to a WBLC tour For each portal in , located on line l, which is used more than twice, we will perform a short-cutting on the two sides of Then, self intersections (if created) will also be removed from by short-cutting

Lemma Well behaved tours (Cont.)Let be a well defined tour which crosses a portal p, located on line l, times ( > 2)There are two cases: is odd is evenA short-cutting will be performed for each case and make cross p at most twice, without increasing its lengthThe correctness will be guaranteed by triangle inequalityLemma Proof Stage 1: Making each portals crossings # to be 2Lemma Proof (Cont.) Stage 1, Case 1: Crossings # is oddIn this case we transform the tour to cross l only once:

abcc'a'b'lpabcc'a'b'lp22Lemma Proof (Cont.) Stage 1, Case 2: Crossings # is evenIn this case we transform the tour to cross l only twice:

abcc'a'b'lpd'dabcc'a'b'lpd'd23If the previous stage introduced self-intersections, they can be removed by the following way:Lemma Proof (Cont.) Stage 2: Eliminating intersectionsacc'aacc'a24After lemma 1 was proved we know that each WB tour can be transformed to a WBLC tour , such that || ||We can show that there is a WB tour that is short enough, i.e. || (1 + ) OPTFrom lemma 1 we know that there exists a WBLC tour that is short enough too || (1 + ) OPTWe will obtain all the WBLC tours and take the shortest one (the one with minimal sum of distances), therefore || || || (1 + ) OPT

Conclusion The remaining parts of the algorithmIn fact there is no guarantee that it is close enough to optimum just the opposite, we will show a counterexample

Instead we will construct a larger family of dissections and prove that at least half of them have optimal WBLC tour which is close enough to the optimum25Definition valid visitFor each useful square S, we define a valid visit as an assignment of crosses for each portal on S, such that the sum of all portal crosses is even. In addition Ss portals are divided to pairs, that are connected by some valid WBLC tour

120120001120a, ecd, ea'bb'c, dThe optimal WBLC tour can be computed in time 2O(m) = nO(1)

26Stage 5 Computing the optimal WBLCThe following steps:

We will build a table, that for each square in the dissection, contains the cost of each valid visit. The table will be built up the 4-ary dissection treeThe calculation uses dynamic programming

We look only on WBLC tours which means that each portal can be used (= crossed) 0, 1 or 2 timesDenote some WBLC tour by The total number of times, can enter or exit a useful square S is at most 8m The part of inside S, can be viewed as at most 4m paths, covering all the points inside SFirst, we calculate the total number of possibilities to define the number of crossings for each portal on S sidesStage 5 Computing the optimal WBLC (Cont.)The third bullet can be derived from the fact that there are at most 4m portals on each useful square28The total number of possible assignments is 34m = 24mlog23m in the range [O(log n) , 2 O(log n) ]Therefore 24 O(log n) (log 3) 34m 28 O(log n) (log 3) Thus we have n(4 log 3) 34m n(8 log 3) 34m = nO(1)Among all the possibilities of portals crossings, we retain only those that involve an even sum of crossings (allowing to enter and exit S)Once we defined the number of crossings for each portal on S sides, not every possible pairing is allowed because of the restriction of the self-intersectionStage 5 Computing the optimal WBLC (Cont.)29Count the number of valid pairings, for a given assignment of portal crossingsLets assume that the sum of portal usages is 2r (should be even)We will prove that the number of valid pairings is the rth Catalan numberLets look on a valid pairing:A useful square SStage 5 Computing the optimal WBLC (Cont.)rth Catalan number is the number of expressions constructed from r balanced pairs of parentheses.30Now, if we view the sides of S as a straight line, we can see that a valid pairing can be transformed to a sequence of balanced parentheses (a bijection can be created):

A valid pairingAn invalid pairingStage 5 Computing the optimal WBLC (Cont.)The number of balanced arrangements of 2r parentheses is the rth Catalan number, Cr=(1/r+1) ( )It is known for Catalan numbers that Cr < 4r = 22r Since each visit on the portals of S crosses the portals at most 8m times, we get that the number of valid pairings for a given assignment of portal usages is bounded by: 28m = 28 O(k/) = 28 (O(log n)/) = nO(1)Thus we get:nO(1) possibilities for portal usagesnO(1) valid pairings for each portal usage Total number of valid visits in S is nO(1) nO(1) = nO(1)

2r rStage 5 Computing the optimal WBLC (Cont.)32Lets build the following table in order to compute optimal WBLC cost (for each useful square):

# of columns = # of squares in the 4-ary tree = O(n4)# of rows = # of valid visits for a square = nO(1)Total # of entries in the table = n4 nO(1) = nO(4 + 1)

Dynamic programmingComputing the optimal WBLC: definition of the tableMinimum CostsLevel 0Level 1Square 1Square 1Square 2Square 3Square 4valid visit 1valid visit 2valid visit 3We say that a valid visit of square S1 at level i is consistent with a valid visit of its parent square S, if all common portals get the same portal usages and internal pairingsDefinition Computing the optimal WBLC: consistencyHow to check if the external and internal pairings are consistent:

We can represent the pairing as a sequence of parentheses when entering to big and small square is considered as two lparen-s (( and, similarly, existing from a small square and the big square will be considered as two rparen-s )).

In addition, each move between two child squares will be considered as an lparen and rparen )(

The resulted sequence of parentheses of the path above will be: (()()())(()())34The table is filled up the dissection tree T:]1. The level k is computed by calculating the minimal cost for each valid visit in the squares at this level2. For each level i, i = k 1 downto 02.1. For each square S at level i2.1.1. For each valid visit V in S2.1.1.1. For each possibility of portal usages on the two lines which divide S (to 4 squares)2.1.1.1.1. For each valid pairing of all the portals consistent with the visit V portals usageDynamic programming (Cont.) Computing the optimal WBLC: the algorithm If the pairing is consistent, it gives rise to valid visits in the four squares internal to S (whose minimal WBLC costs were calculated) 2.1.1.1.1.1. Sum the optimal lengths of the appropriate visits in the children squares 2.1.1.1.2 Compute the minimum cost among the costs for this internal portal usage2.1.1.2. Compute the minimum cost among the costs for all internal portal usages and store the returned cost in an appropriate entry3. Finally, take the minimum cost of the level 0 column

Dynamic programming (Cont.) Computing the optimal WBLC: the algorithm (Cont.)36Dynamic programming (Cont.) Computing the optimal WBLC: runtimeWe have seen before that the table has nO(1) entriesIn order to calculate each entry, which represents a valid visit V on a square S we need to consider at most all the possibilities for internal portal usages The number of internal portals of S is at most 4m + 1Therefore the number of possibilities for internal portal usages is at most 34m + 1 = nO(1) (since we have seen that 34m = nO(1))The total number of the internal portals along with the external portals is 8m 3 at most and therefore the total number of pairings is also bounded by nO(1)Therefore, in total we should consider nO(1) nO(1) = nO(1) valid pairings for each square. That is because we have nO(1) valid pairings for the internal portals, for a single usage assignment of them, and nO(1) usage assignments.Finally, the total cost for a single entry calculation is nO(1)The total runtime of the algorithm is:#entries nO(1) = nO(1)Correctness: We compute all the available WBLCs costs, since each WBLC tour of a square S at level i can be divided to 4 squares at level i + 1, whose minimal WBLCs costs were calculated for each valid visitDynamic programming (Cont.) Computing the optimal WBLC: runtime (Cont.)First, consider an optimal WB tour and lets calculate how much it can differ from OPTs costConvert OPT to WB and see how much its length increases by this conversionWB tour vs. Optimal tour How an optimal WB tour differs from OPTAn edge of the optimal tourPortalPortalL/2imAn edge of the changed tourWe can easily see that for each crossing of a dissection line, |OPT| increases by at most L/2imWe can notice that the increase depends on the lines level. i.e. the lower the level, the greater the increase

WB tour vs. Optimal tour How an optimal WB tour differs from OPT (Cont.)An edge of the optimal tourPortalPortalL/2imAn edge of the changed tourIs it enough? Is an optimal WB tour always an (1 + )-approximation for the optimal TSP solutionThe answer is NO!!!

We will show an instance of the Euclidian TSP problem, for which the process of transforming an optimal tour to be WB, increases its length by a fixed constantTherefore the algorithm will fail if is chosen to be below this boundIs it sufficient? How an optimal WB tour differs from OPTCounterexample How an optimal WB tour differs from OPT (Cont.)Lets denote L/2im as xAn Euclidian TCP instance is shown on the right, along with the optimal TCP solutionWe can easily obtain:

8x8x4x4x8xyL

x2xCounterexample (Cont.) How an optimal WB tour differs from OPT (Cont.)Now lets modify the tour to be WB and call the new tour SOLAgain, we can easily obtain:8x8x4x4x8xyL

x2xCounterexample (Cont.) How an optimal WB tour differs from OPT (Cont.)Since y L2 we obtain |SOL| |OPT| 1.0015Hence, the described algorithm fails for a selection of an error parameter < 0.0015To bypass this problem we will randomize the algorithm and generalize the concept of the dissectionL8x8x4x4x8xyx2xLets define L2 different dissections of the bounding box which are shifts of the basic dissectionChoose randomly two integers a and b such that 0 a, b < LShift each vertical line from its original location x to (x + a) mod LShift each horizontal line from its original location y to (y + b) mod L We call the result (a,b)-shifted dissectionDefinition (a,b)-Shifted Dissection of the Bounding BoxHere we a shifting of the level-1 lines is illustratedabRandomization (a,b)-Shifted Dissection of the Bounding Box (Cont).46Randomization (Cont.) (a,b)-Shifted Dissection analysisBy performing the shifting, any specific line has a random level. For instance, the level of the middle vertical line in the counter-example is not necessarily 1, but depends on a: it is the level of the [(L2 + a) mod L]-line in the original dissectionThere are 21 lines at the first level, 22 lines at the second, , 2k lines at level k (2i lines at random level i)Thus, we have 2k+1 - 2 total # of lines in a dissectionThe probability to randomly choose line with level i is:

We showed that when a line at level i is crossed by the path , the maximal increase in the process of making a WB tour is x(i) = L / 2imNow, we can define X as a random variable which describes the possibilities of length increases by a single grid-line crossThus, the expected value of the increase for a randomly chosen line is:

Randomization (Cont.) Distance between portals on a random line

Now lets bound the number of crossings of dissection linesLet be an optimal tour and let N() be the total number of dissection lines crossings of (intersection is counted twice). Denote: || = OPT.We claim that: N() 2 OPT (will be proved later)Therefore, if we denote by Y the total increase in the path cost, we have EY = N() EX 2 OPT

Markovs inequality says that:

Randomization (Cont.) Number of crossings for a random dissection

49

Randomization (Cont.) Finalizing the algorithmThus, we have:

This leads us to the following corollary:Pick a and b uniformly at random from [0, L). Then, the probability that there is a WB tour of length (1+22)-approximation is greater or equal to 0.5

Randomization (Cont.) Finalizing the algorithm (Cont.)Three remarks:The 22 prefix can be removed by updating to > 0 which can be calculated by solving the equation 22 = We can reduce the probability that the total increase in length is to high, by repeating the procedure for c different (a,b)-shifted dissections and choosing the shortest tourWe can derandomize the algorithm by trying all the possible L4 = O(n4) dissection and, again, choosing the shortest tour

Consider a segment C (of ) from a point (x1,y1) to a point (x2,y2), remember that each one is located on a grid pointLet D be the Euclidian distance between the points (clearly D 1)Denote: Dx = |x1 - x2|Dy = |y1 y2|Randomization (Cont.) Proving N() 2 OPTDx=3Dy=4

(x1,y1)(x2,y2)DCC crosses vertical grid lines Dx - 1 timesC crosses horizontal gridlines Dy - 1 timesD2 = Dx2+ Dy2Dx2+ Dy2 (Dx+ Dy)2 / 2Thus we have:2D2 (Dx+ Dy)2 2D Dx+ Dy N(C)Adding up we obtain the desired result: N() 2 OPTRandomization (Cont.) Proving N() 2 OPT (Cont.)Dx=3Dy=4

(x1,y1)(x2,y2)DC[(x+y)^2 ] / 2 = (x^2 + y^2 +2xy) / 2