* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download 24.1 Rectangular Partitions Question
Survey
Document related concepts
Perturbation theory wikipedia , lookup
Factorization of polynomials over finite fields wikipedia , lookup
Selection algorithm wikipedia , lookup
Multi-objective optimization wikipedia , lookup
Computational complexity theory wikipedia , lookup
Dijkstra's algorithm wikipedia , lookup
Genetic algorithm wikipedia , lookup
Knapsack problem wikipedia , lookup
Computational electromagnetics wikipedia , lookup
Mathematical optimization wikipedia , lookup
Simplex algorithm wikipedia , lookup
Transcript
CS6320:Intro to Intractability, Approximation and Heuristic Algorithms Spring 2016 Lecture 24, April 20 Instructor: Prof. Ajay Gupta Scribe: Jialiang Chang In this lecture, we covered Rectangular Partitions problem with Dynamic Programming and Divide-and-Conquer. 24.1 Rectangular Partitions Question Connect all the points with same lab together by wires located inside the large rectangle and on the outside of the interior rectangles. The problem is computationally intractable. Figure 1: Rectangular Partitions The question is to find the minimum of sum of the length of all wires. A good way is reduce Rectangular Partitions to Channel Routing Problems each of which can be solved independently. Figure 2: Channel Routing Problems 1 Steps: • Replace each interior rectangle by its four corner points. • Partition a rectangle with interior points so that all the points end up on a partitioning line. • Then delete the segments inside the interior rectangles to obtain the individual channels. Figure 3: Replacing Rectangles by Corner Points Figure 4: Partitioning into Rectangles Figure 5: Deleting Segments Inside Rectangles One thing should be paid attention to is: Line segments cannot be acrossed. 2 The following table is the comparison of approximation methos to the problem: Table 1: Methods Comparison Approximation Algorithm method time complexity approximation bound Dynamic Programming O(n5 ) 2 (simple proof) 1.75 (complex proof) Problem transformation O(n3 ) 3 Divide-and-Conquer O(n log n) 4 24.2 Guillotine Partition Definitions: assuming there is E(I): Rectangular partition for I = (R, P ) • Guillotine cut: A line segment in Rectangular partition that partitions it into two rectangles. • Guillotine partition:E(I) is a guillotine partition if either E(I) isempty or E(I) has a guillotine cut that partitions R into R1 and R2 , and both E(I1 ) (edges from E(I) in R1 ) and E(I2 ) (edges from E(I) in R2 ) are guillotine partitions for I1 = (R1 ,P1 ) and I2 = (R2 ,P2 ), respectively. One thing should be paid attention to is: A guillotine partition is a rectangular partition, but a rectangular partition is not necessarily a guillotine partition. 24.3 Chain Metrix Multiplication 24.3.1 If we want to do multiplication on A × B, A and B must be in the form of R1 × R2 and R3 × R4 where Ri is the number of columns anf |R2 | = |R3 |. 24.3.2 Assuming m = m1 , m2 , m3 , ..., mi , ..., mn , we define the form in mi looks like Ri−1 × Ri , for example: m1 = R0 × R1 , mn = Rn−1 × Rn , then we can calculate Cij by following equation: A × B = Cij where A = P × Q and B = Q × R, then Cij = P × R andP the time complexity is O(P QR) Cij = qk=1,1≤i≤P,1≤j≤R aik bjk 24.3.3 As we know in matrix, no matter how we parenthesize the product, the result will be the same: 3 (((m1 m2 )m3 )m4 )m5 ) = ((m1 m2 )(m3 m4 )m5 )) However,the order in which we parenthesize the product will affect the efficiency because mi will contributes to different partitions: in the case of: mi × ...mk = Ri−1 × Rk and mk+1 × ...mj = Rk × Rj−1 , we could find that: Cij = min{Ri−1 Rk Rj + Cik + Ck+1,j } With this equation, we could calculate all the Cij like: Table 2: Each of these could be reused in C11 C22 C33 C44 C55 C12 C23 C34 C45 ... C13 C24 C35 ... ... ... C15 ... ... ... ... 24.4 next calculation ... ... ... ... Dynamic Programming method 24.4.1 Assuming we have following rectangle: Figure 6: We would like to find the optimal solution with dynamic programming, then we could think that the minimum edge length guillotine partitioning problem consists of finding a guillotine partition of least total edge length. OP T (il , iv , jd , ju ): Value of optimal solution from problem in the shaded region. How to solve it? Assuming we have a instance of the question in following rectangle: • If we partition the rectangle by a horizontal line through point (5,2), then we could have a guillotine partition(1, 6, 2, 6), the one of the solution will be x + OPT(1,6,2,6) 4 Figure 7: Instance of question • If we partition the rectangle by a horizontal line through point (3,3), then we could have two guillotine partitions(1, 6, 1, 3) and (1, 6, 3, 4), the one of the solution will be x + OPT(1,6,1,3) + OPT(1,6,3,4) • Do the steps like above and find all the possible solutions: • Then we can get the minimun of the solutions as our optimal solution: OP T (1, 6, 1, 6) = min{X+OP T (1, 6, 2, 6), X+OP T (1, 6, 1, 3)+OP T (1, 6, 3, 6), X+OP T (1, 6, 1, 4)+ OP T (1, 6, 4, 6), X+OP T (1, 6, 1, 5), Y +OP T (2, 6, 1, 6), Y +OP T (1, 3, 1, 6)+OP T (3, 6, 1, 6), Y + OP T (1, 4, 1, 6) + OP T (4, 6, 1, 6), Y + OP T (1, 5, 1, 6)} 24.4.2 Approximation Algorithm Let G(I) be an optimal guillotine partition and L(G(I)) be the edge length of G(I). Let Eopt (I) be an optimal rectangular partition and L(Eopt (I)) be the edge length of Eopt (I) L(G(I)) ≤ 2L(Eopt (I))) 24.5 Divide-and-Conquer O(n log n)-time divide-and-conquer approximation algorithm. L(I) represents the total length the line segments in the solution for problem instanceI generated by our algorithm, and opt(I) represents the corresponding one in an optimal solution. Generates solutions within 4 times theoptimal solution value, i.e. for every I, L(I) ≤ 4opt(I) 24.5.1 Problem Instance Assume I = ((x, y), (X, Y ), P ),where (x, y) and (X, Y ) define a rectangle R(x, y) is the lowerleft corner, and (X, Y ) arethe dimensions), and P = p1 , p2 , ..., pn is a nonempty set of points inside R. 5 • mid-cut: a line segment orthogonal to the x-axis that intersects the center of the rectangle (i.e., it includes point (x + X2 , y + Y2 )). • end-cut: a line segment orthogonal to the x-axis that contains either one of the leftmost or the rightmost points in P. Algorithm of PROCEDURE PARTITION: Algorithm 1 PROCEDURE PARTITION((x, y), (X, Y ), P ) 1: Relabel the dimensions so that X ≥ Y , where pk = (xk , yk )} 2: P1 ← {pk |pk ∈ P and xk < x + X 2 , where pk = (xk , yk )} 3: P2 ← {pk |pk ∈ P and xk > x + X 2 4: if P1 6= ∅ and P2 6= ∅ then 5: Introduce the line segment orthogonal to the x-axis that partitions R through its center; 6: P ART IT ION ((x, y), ( X2 , Y ), P1 ); 7: P ART IT ION ((x + X2 , y), ( X2 , Y ), P2 ); 8: else 9: Let c be the coordinate value along the x-axis of a point in P with smallest |c − (x + X2 )|; 10: Introduce the line segment orthogonal to the x-axis that partitions R through the points with x-coordinate value equal to c; 11: Delete from P1 and P2 all the points located along the end-cut; 12: if P1 6= ∅ then P ART IT ION ((x, y), (c − x, Y ), P1 ); 13: if P2 6= ∅ then P ART IT ION ((c, y), (X − (c − x), Y ), P2 ); 14: end if 6