Finding Permutations with Prefix Targets Alantha Newman Universit´ e Grenoble Alpes Heiko R¨ oglin Universit¨ at Bonn Johanna Seif ENS Lyon 1
The Problem Input: – An ordered set of nonnegative integers X = { x 1 , x 2 , . . . , x n } inter- spersed with free slots. – Another set of nonnegative integers Y = { y 1 ≥ y 2 ≥ · · · ≥ y n } . Goal: Assign each element of Y to a free slot to minimize maximum value of a prefix. The value of a prefix P is X ∩ P − Y ∩ P . If every prefix has value in range [ α, β ], then value of solution is β − α . Example: X = { 8 , , 5 , , 2 , , 3 , } , Y = { 7 , 6 , 2 , 3 } . { 8 , 7 , 5 , 6 , 2 , 2 , 3 , 3 } has value 8. Solution: 2
The Problem • We can assume the free slots alternate with the X values. • If two x i ’s are adjacent, add them together. • If two free slots are adjacent, put a 0 between them. • Generalizing 3-Partition: – X -input: 1 , , 0 , , 0 , , 1 , , 0 , , 0 , , 1 , . . . . – Y -input: Instance of 3-Partition, i.e. 3 n numbers strictly between 1 4 and 1 2 that sum to n . – Does every prefix have value in range [0 , 1]? • Hybrid Bin-Packing/Bin-Covering. 3
Problem: Geometric Interpretation Input: X = { x 1 , x 2 , . . . , x n } , Y = { y 1 ≥ y 2 ≥ · · · ≥ y n } . Goal: Find permutation π of Y to minimize distance between highest and lowest point, i.e. min β − α . k k − 1 n k k n � � � � � � ∀ k : x j − y π ( i ) ≤ β, x j − y π ( i ) ≥ α. j − 1 j =1 i =1 j − 1 j =1 i =1 β α 4
Lower Bounds Input: X = { x 1 , x 2 , . . . , x n } , Y = { y 1 ≥ y 2 ≥ · · · ≥ y n } . µ x = max i { x i } , µ y = max i { y i } , µ = max { µ x , µ y } . OPT ≥ µ . But optimal solution may be much greater than µ . OPT = n/ 2 , µ = 2. Example: = { 2 , 2 , . . . , 2 , 0 , 0 , . . . , 0 X } , � �� � � �� � n n 2 entries 2 entries = { 1 , 1 , . . . , 1 , 1 , 1 , . . . , 1 Y } . � �� � n entries Greedy/combinatorial algorithms can be terrible: X = { 2 , 0 , 2 , 0 , . . . , 2 , 0 , 2 , . . . , 2 , 0 , . . . , 0 } , � �� � � �� � � �� � n n n 2 entries 4 entries 4 entries Y = { 2 , . . . , 2 , 1 , 1 , 1 , 1 , . . . , 1 , 1 , 0 , . . . , 0 } . � �� � � �� � � �� � n n n 4 entries 2 entries 4 entries 5
LP Relaxation min β − α n � ∀ i ∈ [1 , n ] : = 1 , z ij i =1 n � ∀ i ∈ [1 , n ] : z ij = 1 , j =1 k k − 1 n k k n � � � � � � ∀ k : x j − y i · z ij ≤ β, x j − y i · z ij ≥ α, j − 1 j =1 i =1 j − 1 j =1 i =1 z ij ≥ 0 . Integer solution is a permutation matrix. LP solution Z is doubly stochastic matrix. z 11 z 12 . . . z 1 n n z 21 z 22 . . . z 2 n � Z = , z j = z ij · y i . . . . . . . . . . . . . i =1 z n 1 z n 2 . . . z nn 6
This Talk: Two Algorithms Algorithm I. – Uses iterative rounding (` a la Karmarker-Karp). – Has approximation factor OPT LP + log n · O ( µ x + µ y ). Algorithm II. – Transforms the support of Z (the doubly stochastic LP solution matrix). – Has approximation factor OPT LP + µ y . 7
Algorithm I: Rounding Up Items Let OPT LP denote optimal LP value for original instance. Round up items (groups of eight consecutive items). Substitute rounded-up values into LP solution to obtain OPT ′ LP ≤ OPT LP + 8 µ y . Let OPT f be any feasible LP solution for rounded up instance such that: OPT f ≤ OPT ′ LP . Replace rounded up values with original values into LP solution to obtain OPT ′ f ≤ OPT f + 8 µ y . Finally: OPT ′ f ≤ OPT LP + 16 µ y . 8
Algorithm I: Rearranging Items Let OPT LP denote optimal LP value for original instance. Rearrange from alternating X - Y to alternating X 8 - Y 8 . Obtain LP solution by rearranging columns: OPT ′ LP ≤ OPT LP + 8 µ x + 8 µ y . Let OPT f be any feasible LP solution for rounded up instance such that: OPT f ≤ OPT ′ LP . Put columns of the LP solution back into alternating order: OPT ′ f ≤ OPT f + 8 µ y . Finally: OPT ′ f ≤ OPT LP + 16 µ y + 8 µ x . 9
Algorithm I: Iterative Rounding Round up items. Rearrange items. Obtain permutation instance on n/ 8 variables with new LP. Let z ′ ij denote new variables and y ′ i denote rounded-up items and rearranged items. Assign y ′ i ’s to positions in the 8 × 8 boxes such that resulting matrix is doubly stochastic and so that integer parts are unit. Un-rearrange and round down. Total cost: OPT LP + log n · O ( µ x + µ y ). 10
New LP Relaxation min β − α n � ∀ i ∈ [1 , n ′ ] : z ij = 8 , i =1 n � ∀ i ∈ [1 , n ′ ] : = 8 , z ij j =1 k k − 1 n ′ k k n ′ � � � � � � y ′ y ′ ∀ k : x j − i · z ij ≤ β, x j − i · z ij ≥ α, j − 1 j =1 i =1 j − 1 j =1 i =1 z ij ≥ 0 . There are 4 n ′ constraints ⇒ at most 4 n ′ nonzero variables in a BFS. If n ′ = n 8 ⇒ there are n 2 nonzero variables in a BFS. But total weight is n . So at least half the weight belongs to the integer parts. 11
LP Relaxation min β − α n � ∀ i ∈ [1 , n ] : = 1 , z ij i =1 n � ∀ i ∈ [1 , n ] : z ij = 1 , j =1 k k − 1 n k k n � � � � � � ∀ k : x j − y i · z ij ≤ β, x j − y i · z ij ≥ α, j − 1 j =1 i =1 j − 1 j =1 i =1 z ij ≥ 0 . Integer solution is a permutation matrix. LP solution Z is doubly stochastic matrix. z 11 z 12 . . . z 1 n n z 21 z 22 . . . z 2 n � Z = , z j = z ij · y i . . . . . . . . . . . . . i =1 z n 1 z n 2 . . . z nn 12
Algorithm II: Approximating z j ’s Recall LP relaxation. n � z j = z ij · y i . i =1 Goal: Find permutation of Y = { y ′ 1 , y ′ 2 , . . . y ′ n } such that: � � � y ′ z j + γ. z j ≤ j ≤ j ∈ [1 ,ℓ ] j ∈ [1 ,ℓ ] j ∈ [1 ,ℓ ] Solution size at most ⇒ β − α + γ = OPT + γ . 13
Relaxation z 11 z 12 . . . z 1 n n z 21 z 22 . . . z 2 n � Z = , z j = z ij · y i . . . . . . . . . . . . . i =1 z n 1 z n 2 . . . z nn Approach: Decompose Z into permutation matrices ` a la Birkoff-von Neumann. } . x i = ( k · B )+( n − k ) Bad example: Y = { 1 , 1 , . . . , 1 , B, . . . , B = z j . n � �� � � �� � n − k k { B, B, . . . , B, 1 , 1 , . . . 1 , 1 , 1 } { 1 , B, B, . . . , B, 1 , 1 , . . . 1 , 1 } { 1 , 1 , B, B, . . . , B, 1 , 1 , . . . 1 } . { 1 , 1 , . . . 1 , B, 1 . . . , 1 , B, 1 , . . . 1 } . 14
Rounding: Transformation We transform doubly stochastic Z into a doubly stochastic matrix T . Preserves the weighted column sums { z j } . (Still feasible for LP.) We say a row i is finished at column j , if columns 1 through j sum to 1 in row i . Matrix T will have consecutiveness property : In each column, there are at most two non-zero entries that are not in finished rows , and in between them, all the rows are finished. 0 . 7 0 . 3 0 . . . . 5 . 3 . 2 0 . . . . . . . 5 0 . 5 0 . . . . . . T = 0 0 . 3 . 7 0 . . . 0 0 0 0 . 2 . . . 0 0 0 0 . 8 . . . 15
Rounding: Transformation If z a , z b , z c > 0 all appear in an unfinished row. Then: increase z b → z b + δ decrease z a → z a − δ · y b − y c y a − y c decrease z c → z c − δ · y a − y b y a − y c For some column (to the right) where row of b has value at least δ : decrease value in row b by δ increase values in rows a and c 16
Rounding: Transformation Example 0 . 6 . 4 0 0 0 16 . 3 0 . 1 . 4 . 2 0 8 . 4 . 4 . 2 0 0 0 6 Z = , Y = , . 3 0 0 . 6 . 1 0 4 0 0 . 3 0 . 3 . 4 2 0 0 0 0 . 4 . 6 1 � 1 . 4 � Z t Y = 6 12 9 5 . 6 3 . 0 . 6 . 4 0 0 0 0 . 6 . 4 0 0 0 0 . 5 . 4 . 1 0 0 . 1 . 2 . 1 . 4 . 2 0 0 . 2 . 2 . 4 . 2 0 0 . 5 . 2 . 1 . 2 0 . 8 0 . 2 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 , , . 1 . 2 0 . 6 . 1 0 0 . 2 . 1 . 6 . 1 0 0 0 . 1 . 8 . 1 0 0 0 . 3 0 . 3 . 4 0 0 . 3 0 . 3 . 4 0 0 . 3 0 . 3 . 4 0 0 0 0 . 4 . 6 0 0 0 0 . 4 . 6 0 0 0 0 . 4 . 6 17
Rounding: Transformation Example 0 . 6 . 4 0 0 0 16 . 3 0 . 1 . 4 . 2 0 8 . 4 . 4 . 2 0 0 0 6 Z = , Y = , . 3 0 0 . 6 . 1 0 4 0 0 . 3 0 . 3 . 4 2 0 0 0 0 . 4 . 6 1 � 1 . 4 � Z t Y = 6 12 9 5 . 6 3 . 0 . 6 . 4 0 0 0 0 . 5 . 25 . 15 . 1 0 . 1 . 2 . 1 . 4 . 2 0 0 . 5 . 5 0 0 0 . 8 0 . 2 0 0 0 1 0 0 0 0 0 ⇒ . 1 . 2 0 . 6 . 1 0 0 0 . 25 . 75 0 0 0 0 . 3 0 . 3 . 4 0 0 0 . 1 . 5 . 4 0 0 0 0 . 4 . 6 0 0 0 0 . 4 . 6 18
Recommend
More recommend