Rectangle Stabbing
-
Upload
apurba-das -
Category
Documents
-
view
55 -
download
0
Transcript of Rectangle Stabbing
Constant Ratio Approximation Algorithm andParameterized Algorithm and Complexity
Apurba Das
M.Tech (CS), 2009-2011Indian Statistical Institute, Kolkata
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 1 / 25
The Problem
Given a set R of n rectangles, which are aligned to the x and y axes in thetwo-dimensional space, whose corners are all located at integer points andwhose areas are more than 1. Using at least h horizontal lines and vvertical lines, respectively, the problem is to stab all the rectangles by theminimum number of lines located at integer coordinates.
Hardness of the Problem
The Rectangle stabbing problem in 2-Dimension is NP-hardOptimization problem.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 2 / 25
The Problem
Given a set R of n rectangles, which are aligned to the x and y axes in thetwo-dimensional space, whose corners are all located at integer points andwhose areas are more than 1. Using at least h horizontal lines and vvertical lines, respectively, the problem is to stab all the rectangles by theminimum number of lines located at integer coordinates.
Hardness of the Problem
The Rectangle stabbing problem in 2-Dimension is NP-hardOptimization problem.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 2 / 25
Some Definitions
A horizontal (vertical) line is said to stab a rectangle r if it goesthrough its interior.
All corners of r are integer points.
A horizontal line y = ch stabs r if ah + 1 ≤ ch ≤ bh − 1 holds for thecoordinate y = ah (y = bh) of the lower edge (upper edge) of r .
A vertical line x = cv stabs r if av + 1 ≤ cv ≤ bv − 1 holds for thecoordinate x = av (x = bv ) of the left edge (right edge) of r .
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 3 / 25
Some Definitions
A horizontal (vertical) line is said to stab a rectangle r if it goesthrough its interior.
All corners of r are integer points.
A horizontal line y = ch stabs r if ah + 1 ≤ ch ≤ bh − 1 holds for thecoordinate y = ah (y = bh) of the lower edge (upper edge) of r .
A vertical line x = cv stabs r if av + 1 ≤ cv ≤ bv − 1 holds for thecoordinate x = av (x = bv ) of the left edge (right edge) of r .
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 3 / 25
Some Definitions
A horizontal (vertical) line is said to stab a rectangle r if it goesthrough its interior.
All corners of r are integer points.
A horizontal line y = ch stabs r if ah + 1 ≤ ch ≤ bh − 1 holds for thecoordinate y = ah (y = bh) of the lower edge (upper edge) of r .
A vertical line x = cv stabs r if av + 1 ≤ cv ≤ bv − 1 holds for thecoordinate x = av (x = bv ) of the left edge (right edge) of r .
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 3 / 25
Approximation Algorithm for 2-Dimensional Rectangle Stabbing
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 4 / 25
Integer Programming Setting
Some Notations
H : Set of all horizontal lines
H = {y = ah + 1, y = bh − 1 | y = ah is the lower edge and y = bh isthe upper edge of a rectangle r ∈ R such that bh − ah ≥ 2}.
V : Set of all vertical lines
V = {x = av + 1, x = bv − 1 | x = av is the left edge and x = bv isthe right edge of a rectangle r ∈ R such that bv − av ≥ 2}.
All lines for stabbing are to be taken from H ∪ V .
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 5 / 25
Integer Programming Setting
Some Notations
H : Set of all horizontal lines
H = {y = ah + 1, y = bh − 1 | y = ah is the lower edge and y = bh isthe upper edge of a rectangle r ∈ R such that bh − ah ≥ 2}.
V : Set of all vertical lines
V = {x = av + 1, x = bv − 1 | x = av is the left edge and x = bv isthe right edge of a rectangle r ∈ R such that bv − av ≥ 2}.
All lines for stabbing are to be taken from H ∪ V .
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 5 / 25
Integer Programming Setting
Some Notations
H : Set of all horizontal lines
H = {y = ah + 1, y = bh − 1 | y = ah is the lower edge and y = bh isthe upper edge of a rectangle r ∈ R such that bh − ah ≥ 2}.
V : Set of all vertical lines
V = {x = av + 1, x = bv − 1 | x = av is the left edge and x = bv isthe right edge of a rectangle r ∈ R such that bv − av ≥ 2}.
All lines for stabbing are to be taken from H ∪ V .
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 5 / 25
Integer Programming Setting
Some Notations
H : Set of all horizontal lines
H = {y = ah + 1, y = bh − 1 | y = ah is the lower edge and y = bh isthe upper edge of a rectangle r ∈ R such that bh − ah ≥ 2}.
V : Set of all vertical lines
V = {x = av + 1, x = bv − 1 | x = av is the left edge and x = bv isthe right edge of a rectangle r ∈ R such that bv − av ≥ 2}.
All lines for stabbing are to be taken from H ∪ V .
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 5 / 25
Integer Programming Setting (Contd...)
xi : Decision variable corresponding to the ith horizontal line in theset H.
yj : Decision variable corresponding to the jth vertical line in the setV .
Hk : Set of horizontal lines in H that stab rectangle rk ,k ∈ {1, 2, ..., n}.Vk : Set of vertical lines in V that stab rectangle rk , k ∈ {1, 2, ..., n}.
[n] : The set {1, 2, ..., n}.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 6 / 25
Integer Programming Setting (Contd...)
xi : Decision variable corresponding to the ith horizontal line in theset H.
yj : Decision variable corresponding to the jth vertical line in the setV .
Hk : Set of horizontal lines in H that stab rectangle rk ,k ∈ {1, 2, ..., n}.Vk : Set of vertical lines in V that stab rectangle rk , k ∈ {1, 2, ..., n}.
[n] : The set {1, 2, ..., n}.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 6 / 25
Integer Programming Setting (Contd...)
xi : Decision variable corresponding to the ith horizontal line in theset H.
yj : Decision variable corresponding to the jth vertical line in the setV .
Hk : Set of horizontal lines in H that stab rectangle rk ,k ∈ {1, 2, ..., n}.Vk : Set of vertical lines in V that stab rectangle rk , k ∈ {1, 2, ..., n}.
[n] : The set {1, 2, ..., n}.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 6 / 25
Integer Programming Formulation
Integer Programming Problem P
min∑
i∈H xi +∑
j∈V yj∑i∈Hk
xi +∑
j∈Vkyj ≥ 1, k ∈ [n]∑
i∈H xi ≥ h∑j∈V yj ≥ v
xi , yi ∈ {0, 1}, i ∈ H, j ∈ V
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 7 / 25
Integer Programming Formulation
Integer Programming Problem P
min∑
i∈H xi +∑
j∈V yj∑i∈Hk
xi +∑
j∈Vkyj ≥ 1, k ∈ [n]∑
i∈H xi ≥ h∑j∈V yj ≥ v
xi , yi ∈ {0, 1}, i ∈ H, j ∈ V
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 7 / 25
Integer Programming Formulation
Relaxation of Integer Programming Problem P
min∑
i∈H xi +∑
j∈V yj∑i∈Hk
xi +∑
j∈Vkyj ≥ 1, k ∈ [n]∑
i∈H xi ≥ h∑j∈V yj ≥ v
xi , yi ≥ 0, i ∈ H, j ∈ V
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 8 / 25
Analysis
Let (xi , i ∈ H; yj , j ∈ V ) be an optimal fractional solution to P
It satisfies either∑
i∈Hkxi ≥ 1
2 or∑
j∈Vkyj ≥ 1
2 for every rectanglek ∈ [n]
Let RH (RV ) be the set of all k for which∑
i∈Hkxi ≥ 1
2
(∑
j∈Vkyj ≥ 1
2)
Based on the above definitons define two IP PH and PV .
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 9 / 25
Analysis
Let (xi , i ∈ H; yj , j ∈ V ) be an optimal fractional solution to P
It satisfies either∑
i∈Hkxi ≥ 1
2 or∑
j∈Vkyj ≥ 1
2 for every rectanglek ∈ [n]
Let RH (RV ) be the set of all k for which∑
i∈Hkxi ≥ 1
2
(∑
j∈Vkyj ≥ 1
2)
Based on the above definitons define two IP PH and PV .
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 9 / 25
Analysis
Let (xi , i ∈ H; yj , j ∈ V ) be an optimal fractional solution to P
It satisfies either∑
i∈Hkxi ≥ 1
2 or∑
j∈Vkyj ≥ 1
2 for every rectanglek ∈ [n]
Let RH (RV ) be the set of all k for which∑
i∈Hkxi ≥ 1
2
(∑
j∈Vkyj ≥ 1
2)
Based on the above definitons define two IP PH and PV .
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 9 / 25
Analysis
Let (xi , i ∈ H; yj , j ∈ V ) be an optimal fractional solution to P
It satisfies either∑
i∈Hkxi ≥ 1
2 or∑
j∈Vkyj ≥ 1
2 for every rectanglek ∈ [n]
Let RH (RV ) be the set of all k for which∑
i∈Hkxi ≥ 1
2
(∑
j∈Vkyj ≥ 1
2)
Based on the above definitons define two IP PH and PV .
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 9 / 25
Analysis
IP formulation PH
min∑
i∈H xi∑i∈Hk
xi ≥ 1, k ∈ RH∑i∈H xi ≥ h
xi ∈ {0, 1}, i ∈ H
IP formulation PV
min∑
j∈V yj∑j∈Vk
yj ≥ 1, k ∈ RV∑j∈V yj ≥ v
yj ∈ {0, 1}, j ∈ V
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 10 / 25
Analysis
IP formulation PH
min∑
i∈H xi∑i∈Hk
xi ≥ 1, k ∈ RH∑i∈H xi ≥ h
xi ∈ {0, 1}, i ∈ H
IP formulation PV
min∑
j∈V yj∑j∈Vk
yj ≥ 1, k ∈ RV∑j∈V yj ≥ v
yj ∈ {0, 1}, j ∈ V
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 10 / 25
Analysis
Every constraint in integer programs PH and PV contains a subset ofvariables in the corresponding constraint of P.
Let a feasible solution of PH is xH and a feasible solution of PV is yV .
The composite solution (xH , yV ) is feasible in P
Let linear programming relaxation of PH is PH and of PV is PV
P∗,P∗,P∗H ,P∗V ,P
∗H ,P
∗V are the optimal values of the programs
P,P,PH ,PV ,PH ,PV respectively.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 11 / 25
Analysis
Every constraint in integer programs PH and PV contains a subset ofvariables in the corresponding constraint of P.
Let a feasible solution of PH is xH and a feasible solution of PV is yV .
The composite solution (xH , yV ) is feasible in P
Let linear programming relaxation of PH is PH and of PV is PV
P∗,P∗,P∗H ,P∗V ,P
∗H ,P
∗V are the optimal values of the programs
P,P,PH ,PV ,PH ,PV respectively.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 11 / 25
Analysis
Lemma
P∗H = P∗H and P∗V = P
∗V
Proof Idea:
First consider PH
Order all the horizontal lines i ∈ H from the lowest to the highest
All the horizontal lines in Hk of each k are consecutive in thisordering.
The rows of the coefficient matrix have the interval properties(elements 1’s are located consecutively in each row).
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 12 / 25
Analysis
Lemma
P∗H = P∗H and P∗V = P
∗V
Proof Idea:
First consider PH
Order all the horizontal lines i ∈ H from the lowest to the highest
All the horizontal lines in Hk of each k are consecutive in thisordering.
The rows of the coefficient matrix have the interval properties(elements 1’s are located consecutively in each row).
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 12 / 25
Analysis
Proof Idea(Contd...):
Therefore the matrix is totally unimodular
Any fractional optimal solution of an LP of which the coefficientmatrix is totally unimodular gives the integral solutions only.
This proves P∗H = P∗H
Similarly it can be proved that P∗V = P∗V
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 13 / 25
Analysis
Lemma
P∗H + P∗V ≤ 2P∗
Proof Idea:
Let (x , y) be an optimal fractional solution to problem P.
For every constraint of PH for k ∈ RH ,∑
i∈Hkxi ≥ 1
2 implies∑i∈Hk
2xi ≥ 1∑i∈H 2xi >
∑i∈H xi and
∑i∈H x i ≥ h implies
∑i∈H 2x i ≥ h
2x is a feasible solution to PH
In the similar way 2y is a feasible solution to PV
it follows that P∗H + P
∗V ≤ 2P
∗
From the previous lemma and from the fact that P∗ ≤ P∗ the lemma
is proved
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 14 / 25
Analysis
Lemma
P∗H + P∗V ≤ 2P∗
Proof Idea:
Let (x , y) be an optimal fractional solution to problem P.
For every constraint of PH for k ∈ RH ,∑
i∈Hkxi ≥ 1
2 implies∑i∈Hk
2xi ≥ 1∑i∈H 2xi >
∑i∈H xi and
∑i∈H x i ≥ h implies
∑i∈H 2x i ≥ h
2x is a feasible solution to PH
In the similar way 2y is a feasible solution to PV
it follows that P∗H + P
∗V ≤ 2P
∗
From the previous lemma and from the fact that P∗ ≤ P∗ the lemma
is proved
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 14 / 25
2-factor Approximation Algorithm
Input & Output
Input A set R of n rectangles aligned to the x and y axes, andnonnegetive integers h and v .
Output h′(≥ h) horizontal lines and v ′(≥ v) vertical lines thattogether stab all rectangles in R
The Algorithm
Step 1. Solve linear program P, and obtain the fractional optimalsolution (x , y) = (xi , i ∈ H; yj , j ∈ V ).
Step 2. Construct the two integer programs PH and PV from (x , y),and obtain their optimal solutions x∗H and y∗V (by solvinglinear programs PH and PV ), respectively.
Step 3. Output the ith horizontal lines such that (x∗H)i = 1 and thejth vertical lines such that (y∗V )j = 1
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 15 / 25
2-factor Approximation Algorithm
Input & Output
Input A set R of n rectangles aligned to the x and y axes, andnonnegetive integers h and v .
Output h′(≥ h) horizontal lines and v ′(≥ v) vertical lines thattogether stab all rectangles in R
The Algorithm
Step 1. Solve linear program P, and obtain the fractional optimalsolution (x , y) = (xi , i ∈ H; yj , j ∈ V ).
Step 2. Construct the two integer programs PH and PV from (x , y),and obtain their optimal solutions x∗H and y∗V (by solvinglinear programs PH and PV ), respectively.
Step 3. Output the ith horizontal lines such that (x∗H)i = 1 and thejth vertical lines such that (y∗V )j = 1
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 15 / 25
2-factor Approximation Algorithm
Input & Output
Input A set R of n rectangles aligned to the x and y axes, andnonnegetive integers h and v .
Output h′(≥ h) horizontal lines and v ′(≥ v) vertical lines thattogether stab all rectangles in R
The Algorithm
Step 1. Solve linear program P, and obtain the fractional optimalsolution (x , y) = (xi , i ∈ H; yj , j ∈ V ).
Step 2. Construct the two integer programs PH and PV from (x , y),and obtain their optimal solutions x∗H and y∗V (by solvinglinear programs PH and PV ), respectively.
Step 3. Output the ith horizontal lines such that (x∗H)i = 1 and thejth vertical lines such that (y∗V )j = 1
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 15 / 25
Fixed Parameter Algorithm for 2-Dimensional Rectangle Stabbing
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 16 / 25
Problem Definition
Given a set of axis parallel rectangles R, the rectangles have to be stabbedwith at most k lines chosen from a gives set L of veretical and horizontal
lines.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 17 / 25
Preliminaries
Parameterized Problem
A parameterized problem is a subset of∑∗×N where
∑is a finite
alphabet and N is the set of natural numbers.
Instance of Parameterized Problem
A pair (I , k), where k is called the parameter
Running time
The running time of an algorithm is viewed as a function oftwo quantities:
The size of the problem instanceThe parameter
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 18 / 25
Preliminaries
Parameterized Problem
A parameterized problem is a subset of∑∗×N where
∑is a finite
alphabet and N is the set of natural numbers.
Instance of Parameterized Problem
A pair (I , k), where k is called the parameter
Running time
The running time of an algorithm is viewed as a function oftwo quantities:
The size of the problem instanceThe parameter
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 18 / 25
Preliminaries
Parameterized Problem
A parameterized problem is a subset of∑∗×N where
∑is a finite
alphabet and N is the set of natural numbers.
Instance of Parameterized Problem
A pair (I , k), where k is called the parameter
Running time
The running time of an algorithm is viewed as a function oftwo quantities:
The size of the problem instanceThe parameter
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 18 / 25
Preliminaries
Fixed Parameter Tractable(FPT)
A parameterized problem is said to be fixed parameter tractable(FPT) with respect to the parameter k if there exists an algorithm forthe problem running in f (k)· | I |O(1) time, where f is a computablefunction only depending on k .
Data Reduction
A data reduction rule is a polynomial time algorithm which takes asinput a problem instance (I , k) and outputs an instance (I ′, k ′) suchthat | I ′ |≤| I | and k ′ ≤ k , and (I ′, k ′) is a YES-instance iff (I , k) is aYES-instance.
(I ′, k ′) is called problem karnel.
If a parameterized problem has a kernel, then it is FPT
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 19 / 25
Preliminaries
Fixed Parameter Tractable(FPT)
A parameterized problem is said to be fixed parameter tractable(FPT) with respect to the parameter k if there exists an algorithm forthe problem running in f (k)· | I |O(1) time, where f is a computablefunction only depending on k .
Data Reduction
A data reduction rule is a polynomial time algorithm which takes asinput a problem instance (I , k) and outputs an instance (I ′, k ′) suchthat | I ′ |≤| I | and k ′ ≤ k , and (I ′, k ′) is a YES-instance iff (I , k) is aYES-instance.
(I ′, k ′) is called problem karnel.
If a parameterized problem has a kernel, then it is FPT
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 19 / 25
Instance of 2-Dimensional Rectangle Stabbing
Instance
Let (R,L,k) is an instance.
R is the set of axis parallel rectangles.
L = V ∪ H.
V = {v1, v2, . . . , vn} are the vertical lines ordered from left to right.
H = {h1, h2, . . . , hm} are the horizontal lines ordered from top tobottom.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 20 / 25
Instance of 2-Dimensional Rectangle Stabbing
Instance
Let (R,L,k) is an instance.
R is the set of axis parallel rectangles.
L = V ∪ H.
V = {v1, v2, . . . , vn} are the vertical lines ordered from left to right.
H = {h1, h2, . . . , hm} are the horizontal lines ordered from top tobottom.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 20 / 25
Instance of 2-Dimensional Rectangle Stabbing
Definitions
lx(r) : index of the leftmost line intersecting r ∈ R
rx(r) : index of the rightmost line intersecting r ∈ R
tx(r) : index of the topmost line intersecting r ∈ R
bx(r) : index of the bottommost line intersecting r ∈ R
wh(r) = rx(r) - lx(r) + 1 is the nnumber of vertical lines intersecting r.
ht(r) = bx(r) - tx(r) + 1 is the number of horizontal lines intersectingr.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 21 / 25
Instance of 2-Dimensional Rectangle Stabbing
Data Reduction Rules
If there is a rectangle that is intersected by no line from L, then thegiven instance is a NO-instance.
If there is a rectangle that is intersected by exactly one line l ∈ L,then delete all rectangles that are intersected by l , delete l , anddecrease k by 1.
If there are two lines l1, l2 ∈ L such that every rectangle in R that isintersected by l2 is also intersected by l1, then delete l2.
If there are two rectangles r1, r2 ∈ R such that every line in L thatintersects r1 also intersects r2, then delete r2.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 22 / 25
Instance of 2-Dimensional Rectangle Stabbing
Observations
In a reduced problem instance, for every vertical line vj ∈ V thereexists rectangles r , r ′ ∈ R with lx(r) = j and rx(r’) = j.
In a reduced problem instance, for every horizontal line hi ∈ H thereexists rectangles r , r ′ ∈ R with tx(r) = i and bx(r’) = i.
In the reduced problem instance, there exists rectangles r , r ′ ∈ R suchthat wh(r) = 1 and ht(r’) = 1.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 23 / 25
Algorithm
Assumption
The height of every rectangle in R is bounded by a number b.
Simple Search Tree Algorithm
At every step, apply the data reduction rules until the currentinstance is reduced.
Search for a rectangle r ∈ R with rx(r) = 1, and branch.
either select the single vertical line that intrsects r or select one of theat most b horizontal lines that intersect r.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 24 / 25
Algorithm
Assumption
The height of every rectangle in R is bounded by a number b.
Simple Search Tree Algorithm
At every step, apply the data reduction rules until the currentinstance is reduced.
Search for a rectangle r ∈ R with rx(r) = 1, and branch.
either select the single vertical line that intrsects r or select one of theat most b horizontal lines that intersect r.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 24 / 25
Algorithm
Assumption
The height of every rectangle in R is bounded by a number b.
Simple Search Tree Algorithm
At every step, apply the data reduction rules until the currentinstance is reduced.
Search for a rectangle r ∈ R with rx(r) = 1, and branch.
either select the single vertical line that intrsects r or select one of theat most b horizontal lines that intersect r.
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 24 / 25
Algorithm
Copmplexity
In the search tree, starting from a rectangle at root (b+1) branchingpossibilities are there.
The height of the tree can be no more than k.
So, for each rectangle search tree exploration would required (b + 1)k
time.
Therefore, total running time of this algorithm is O((b + 1)k · nO(1)).
Apurba Das (ISI, Kolkata) Rectangle Stabbing Problem 25 / 25