A Constant Factor Approximation Algorithm for the Storage

A Constant Factor Approximation Algorithm
for the Storage Allocation Problem
Reuven Bar-Yehuda
Michael Beder
Dror Rawitz
Technion
Technion
Tel Aviv University
An O(1)-approximation algorithm for the storage allocation problem
1 / 14
Bandwidth Allocation Problem (BAP)
Input:
– Path P = (V, E) with edge capacities c : E → Q+
– Set of n tasks, where each j has:
⊲
⊲
⊲
Interval Ij
Demand dj
Weight wj
dj
|
{z
}
Ij
P
Solution: Subset S s.t. ∀e,
Goal: Solution S s.t. w(S) is maximized
j∈S:e∈Ij
d j ≤ ce
An O(1)-approximation algorithm for the storage allocation problem
2 / 14
Bandwidth Allocation Problem (BAP)
Input:
– Path P = (V, E) with edge capacities c : E → Q+
– Set of n tasks, where each j has:
⊲
⊲
⊲
Interval Ij
Demand dj
Weight wj
dj
|
{z
}
Ij
P
Solution: Subset S s.t. ∀e,
Goal: Solution S s.t. w(S) is maximized
AKA: Unsplittable Flow Problem on Paths
Special Cases:
j∈S:e∈Ij
d j ≤ ce
– Independent Set in intervals graphs
– Knapsack
An O(1)-approximation algorithm for the storage allocation problem
2 / 14
Storage Allocation Problem (SAP)
Additional Constraint:
– Tasks get a contiguous portion of the resource
(e.g., memory, frequency range, banner, line network of processors)
⇒ A packing of rectangles
An O(1)-approximation algorithm for the storage allocation problem
3 / 14
Storage Allocation Problem (SAP)
Additional Constraint:
– Tasks get a contiguous portion of the resource
(e.g., memory, frequency range, banner, line network of processors)
⇒ A packing of rectangles
Formally: Solution is a pair (S, h):
– Subset S
– Height function h
such that
– ∀j ∈ S, e ∈ Ij : h(j) + dj ≤ ce
– ∀j, i ∈ S s.t. Ij ∩ Ii 6= ∅: h(i) ≥ h(j) + dj or h(j) ≥ h(i) + di
An O(1)-approximation algorithm for the storage allocation problem
3 / 14
Storage Allocation Problem (SAP)
Additional Constraint:
– Tasks get a contiguous portion of the resource
(e.g., memory, frequency range, banner, line network of processors)
⇒ A packing of rectangles
Formally: Solution is a pair (S, h):
– Subset S
– Height function h
such that
– ∀j ∈ S, e ∈ Ij : h(j) + dj ≤ ce
– ∀j, i ∈ S s.t. Ij ∩ Ii 6= ∅: h(i) ≥ h(j) + dj or h(j) ≥ h(i) + di
SAP is NP-hard: Knapsack is a special case
An O(1)-approximation algorithm for the storage allocation problem
3 / 14
SAP vs. BAP
A SAP solution is a BAP solution, but the converse is not always true:
Non-uniform capacities:
1
d2 = 2
d1 = 1
2
An O(1)-approximation algorithm for the storage allocation problem
4 / 14
SAP vs. BAP
A SAP solution is a BAP solution, but the converse is not always true:
Non-uniform capacities:
1
d2 = 2
d1 = 1
2
Uniform capacities:
[Chen Hassin Tzur 02]
An O(1)-approximation algorithm for the storage allocation problem
4 / 14
SAP vs. BAP
A SAP solution is a BAP solution, but the converse is not always true:
Non-uniform capacities:
1
d2 = 2
d1 = 1
2
Uniform capacities:
[Chen Hassin Tzur 02]
An O(1)-approximation algorithm for the storage allocation problem
4 / 14
SAP vs. BAP
A SAP solution is a BAP solution, but the converse is not always true:
Non-uniform capacities:
1
d2 = 2
d1 = 1
2
Uniform capacities:
[Chen Hassin Tzur 02]
An O(1)-approximation algorithm for the storage allocation problem
4 / 14
SAP vs. BAP
A SAP solution is a BAP solution, but the converse is not always true:
Non-uniform capacities:
1
d2 = 2
d1 = 1
2
Uniform capacities:
[Chen Hassin Tzur 02]
An O(1)-approximation algorithm for the storage allocation problem
4 / 14
δ-small and δ-large Instances
δ ∈ (0, 1)
Unit Capacities:
– j is δ-small if dj ≤ δ
j is δ-large if dj > δ
An O(1)-approximation algorithm for the storage allocation problem
1
δ
5 / 14
δ-small and δ-large Instances
δ ∈ (0, 1)
Unit Capacities:
1
– j is δ-small if dj ≤ δ
δ
j is δ-large if dj > δ
General Capacities:
– bottleneck of j:
ce
△
b(j) = ce , where e = argminf ∈Ij cf
δce
e
An O(1)-approximation algorithm for the storage allocation problem
5 / 14
δ-small and δ-large Instances
δ ∈ (0, 1)
Unit Capacities:
1
– j is δ-small if dj ≤ δ
δ
j is δ-large if dj > δ
General Capacities:
– bottleneck of j:
ce
△
b(j) = ce , where e = argminf ∈Ij cf
– j is δ-small if dj ≤ δ · b(j)
δce
e
j is δ-large if dj > δ · b(j)
An O(1)-approximation algorithm for the storage allocation problem
5 / 14
δ-small and δ-large Instances
δ ∈ (0, 1)
Unit Capacities:
1
– j is δ-small if dj ≤ δ
δ
j is δ-large if dj > δ
General Capacities:
– bottleneck of j:
ce
△
b(j) = ce , where e = argminf ∈Ij cf
– j is δ-small if dj ≤ δ · b(j)
δce
e
j is δ-large if dj > δ · b(j)
Standard Approach: Partition instance into two instances:
– δ-small instance: ∀j, dj ≤ δb(j)
– δ-large instance: ∀j, dj > δb(j)
An O(1)-approximation algorithm for the storage allocation problem
5 / 14
Related Work: SAP with Unit Capacities
[Leonardi Marchetti-Spaccamela Vitaletti 00]
–
12-approx for SAP/unit
An O(1)-approximation algorithm for the storage allocation problem
6 / 14
Related Work: SAP with Unit Capacities
[Leonardi Marchetti-Spaccamela Vitaletti 00]
–
12-approx for SAP/unit
[Bar-Noy Bar-Yehuda Freund Naor Scheiber 00]
–
7-approx for SAP/unit
Based on 3-approx for BAP/unit
An O(1)-approximation algorithm for the storage allocation problem
6 / 14
Related Work: SAP with Unit Capacities
[Leonardi Marchetti-Spaccamela Vitaletti 00]
–
12-approx for SAP/unit
[Bar-Noy Bar-Yehuda Freund Naor Scheiber 00]
–
7-approx for SAP/unit
Based on 3-approx for BAP/unit
[Chen Hassin Tzur 02]
–
–
O(n(nK)K )-time DP alg. for case where dj ’s are multiples of
e
+ ε)-approx for case where ∀j, dj =
( e−1
1
K
O(1)
K
An O(1)-approximation algorithm for the storage allocation problem
6 / 14
Related Work: SAP with Unit Capacities
[Leonardi Marchetti-Spaccamela Vitaletti 00]
–
12-approx for SAP/unit
[Bar-Noy Bar-Yehuda Freund Naor Scheiber 00]
–
7-approx for SAP/unit
Based on 3-approx for BAP/unit
[Chen Hassin Tzur 02]
–
–
O(n(nK)K )-time DP alg. for case where dj ’s are multiples of
e
+ ε)-approx for case where ∀j, dj =
( e−1
1
K
O(1)
K
[Bar-Yehuda Beder Cohen Rawitz 06]
–
–
( 2e−1
+ ε)-approx for SAP/unit
e−1
Randomized (2 + ε)-approx for SAP/unit
Based on (2 + ε)-approx for BAP/unit by [Calinescu Chakrabarti Karloff Rabani 02]
An O(1)-approximation algorithm for the storage allocation problem
6 / 14
Our Results
(9 + ε)-approximation algorithm for SAP
Based on (7 + ε)-approx for BAP by [Bonsma Schulz Wiese 11]
An O(1)-approximation algorithm for the storage allocation problem
7 / 14
Our Results
(9 + ε)-approximation algorithm for SAP
Based on (7 + ε)-approx for BAP by [Bonsma Schulz Wiese 11]
Size (δ = δ(ǫ))
Small (δ-small)
Medium (1/2-small & δ-large)
Large (1/2-large)
BAP [BSW11]
1+ε
2
4
7+ε
An O(1)-approximation algorithm for the storage allocation problem
SAP (our result)
4+ε
2+ε
3
9+ε
7 / 14
Our Results
(9 + ε)-approximation algorithm for SAP
Based on (7 + ε)-approx for BAP by [Bonsma Schulz Wiese 11]
Size (δ = δ(ǫ))
Small (δ-small)
Medium (1/2-small & δ-large)
Large (1/2-large)
BAP [BSW11]
1+ε
2
4
7+ε
SAP (our result)
4+ε
2+ε
3
9+ε
SAP is strongly NP-hard
– No bottleneck assumption: maxj dj ≤ mine ce
– Unit capacities
An O(1)-approximation algorithm for the storage allocation problem
7 / 14
Small Tasks: Almost Uniform Capacities
Special Case:
– δ-small instances: ∀j, dj ≤ δb(j)
– Almost uniform: ∀e, ce ∈ [B, 2B)
– Goal: B2 -packable solution –
(S, h) s.t. ∀j ∈ S, h(j) + dj ≤
B
2
An O(1)-approximation algorithm for the storage allocation problem
2B
B
B
2
8 / 14
Small Tasks: Almost Uniform Capacities
Special Case:
2B
– δ-small instances: ∀j, dj ≤ δb(j)
– Almost uniform: ∀e, ce ∈ [B, 2B)
– Goal: B2 -packable solution –
(S, h) s.t. ∀j ∈ S, h(j) + dj ≤
B
B
2
B
2
(4 + ε)-approximation algorithm:
– Compute optimal solution x
for LP-relaxation of BAP
∗
max
s.t.
P
w x
Pj∈J j j
j:e∈Ij dj xj ≤ ce
xj ∈ {0, 1}
∀e
∀j
– If δ is small enough
⊲
⊲
Round 41 x∗ using [Chekuri Mydlarz Shepherd 03]
Transform to SAP solution using [Bar-Yahuda Beder Cohen Rawitz 06]
An O(1)-approximation algorithm for the storage allocation problem
8 / 14
Small Tasks
δ-small instances: ∀j, dj ≤ δb(j)
Algorithm:
k
k+1
– Classify tasks: Jk = j : b(j) ∈ [2 , 2
– ∀k compute 2k−1 -packable (Sk , hk )
)
An O(1)-approximation algorithm for the storage allocation problem
9 / 14
Small Tasks
δ-small instances: ∀j, dj ≤ δb(j)
Algorithm:
k
k+1
– Classify tasks: Jk = j : b(j) ∈ [2 , 2 )
– ∀k compute 2k−1 -packable (Sk , hk )
– Stack solutions
2k+1
by adding 2k−1 to hk
2k
2k−1
An O(1)-approximation algorithm for the storage allocation problem
9 / 14
Small Tasks
δ-small instances: ∀j, dj ≤ δb(j)
Algorithm:
k
k+1
– Classify tasks: Jk = j : b(j) ∈ [2 , 2 )
– ∀k compute 2k−1 -packable (Sk , hk )
– Stack solutions
2k+1
by adding 2k−1 to hk
2k
2k−1
An O(1)-approximation algorithm for the storage allocation problem
9 / 14
Small Tasks
δ-small instances: ∀j, dj ≤ δb(j)
Algorithm:
k
k+1
– Classify tasks: Jk = j : b(j) ∈ [2 , 2 )
– ∀k compute 2k−1 -packable (Sk , hk )
– Stack solutions
2k+1
by adding 2k−1 to hk
2k
2k−1
2k−2
An O(1)-approximation algorithm for the storage allocation problem
9 / 14
Small Tasks
δ-small instances: ∀j, dj ≤ δb(j)
Algorithm:
k
k+1
– Classify tasks: Jk = j : b(j) ∈ [2 , 2 )
– ∀k compute 2k−1 -packable (Sk , hk )
– Stack solutions
2k+1
by adding 2k−1 to hk
2k
2k−1
2k−2
An O(1)-approximation algorithm for the storage allocation problem
9 / 14
Small Tasks
δ-small instances: ∀j, dj ≤ δb(j)
Algorithm:
k
k+1
– Classify tasks: Jk = j : b(j) ∈ [2 , 2 )
– ∀k compute 2k−1 -packable (Sk , hk )
– Stack solutions
2k+1
by adding 2k−1 to hk
2k
2k−1
2k−2
Analysis: Since (Sk , hk ) is (4 + ε)-approximate:
w(S) =
P
k w(Sk ) ≥
1
4+ε
P
k optk ≥
1
4+ε
P
∗
w(S
∩ Jk ) =
k
An O(1)-approximation algorithm for the storage allocation problem
1
4+ε
· w(S ∗ )
9 / 14
Medium Tasks
δ-large 21 -small instances: ∀j, dj ∈ (δb(j), 12 b(j)]
An O(1)-approximation algorithm for the storage allocation problem
10 / 14
Medium Tasks
δ-large 21 -small instances: ∀j, dj ∈ (δb(j), 12 b(j)]
(2 + ε)-approx algorithm:
– ℓ ← ℓ(ε)
k k+ℓ
– Jk = j : b(j) ∈ [2 , 2 )
An O(1)-approximation algorithm for the storage allocation problem
10 / 14
Medium Tasks
δ-large 21 -small instances: ∀j, dj ∈ (δb(j), 12 b(j)]
(2 + ε)-approx algorithm:
– ℓ ← ℓ(ε)
k k+ℓ
– Jk = j : b(j) ∈ [2 , 2 )
– For every Jk :
Compute 2-approximate (Sk , hk ) s.t. ∀j ∈ Sk , hk (j) ≥
An O(1)-approximation algorithm for the storage allocation problem
2k
4
10 / 14
Medium Tasks
δ-large 21 -small instances: ∀j, dj ∈ (δb(j), 12 b(j)]
(2 + ε)-approx algorithm:
– ℓ ← ℓ(ε)
k k+ℓ
– Jk = j : b(j) ∈ [2 , 2 )
– For every Jk :
–
k
Compute 2-approximate (Sk , hk ) s.t. ∀j ∈ Sk , hk (j) ≥ 24
S
(S≡r , h≡r ) ← k mod (ℓ+2)=r (Sk , hk ), for r ∈ {0, . . . , ℓ + 1}
An O(1)-approximation algorithm for the storage allocation problem
10 / 14
Medium Tasks
δ-large 21 -small instances: ∀j, dj ∈ (δb(j), 12 b(j)]
(2 + ε)-approx algorithm:
– ℓ ← ℓ(ε)
k k+ℓ
– Jk = j : b(j) ∈ [2 , 2 )
– For every Jk :
–
k
Compute 2-approximate (Sk , hk ) s.t. ∀j ∈ Sk , hk (j) ≥ 24
S
(S≡r , h≡r ) ← k mod (ℓ+2)=r (Sk , hk ), for r ∈ {0, . . . , ℓ + 1}
– (S, h) ← argmax(S≡r ,h≡r ) w(S≡r )
An O(1)-approximation algorithm for the storage allocation problem
10 / 14
Medium Tasks
δ-large 21 -small instances: ∀j, dj ∈ (δb(j), 12 b(j)]
(2 + ε)-approx algorithm:
– ℓ ← ℓ(ε)
k k+ℓ
– Jk = j : b(j) ∈ [2 , 2 )
– For every Jk :
–
k
Compute 2-approximate (Sk , hk ) s.t. ∀j ∈ Sk , hk (j) ≥ 24
S
(S≡r , h≡r ) ← k mod (ℓ+2)=r (Sk , hk ), for r ∈ {0, . . . , ℓ + 1}
– (S, h) ← argmax(S≡r ,h≡r ) w(S≡r )
Analysis:
w(S) ≥
1
X
ℓ+2 r
w(S≡r ) ≥
1
X
X
2(ℓ + 2) r k∈K(r)
optk =
1
X
2(ℓ + 2) k
An O(1)-approximation algorithm for the storage allocation problem
optk ≥
ℓ · opt
2(ℓ + 2)
opt
=
2+ε
10 / 14
Medium Tasks: Computing an elevated Solution
δ-large 21 -small instance s.t. ∀j, b(j) ∈ [2k , 2k+ℓ )
An O(1)-approximation algorithm for the storage allocation problem
11 / 14
Medium Tasks: Computing an elevated Solution
δ-large 21 -small instance s.t. ∀j, b(j) ∈ [2k , 2k+ℓ )
Given a solution we may apply “gravity”:
An O(1)-approximation algorithm for the storage allocation problem
11 / 14
Medium Tasks: Computing an elevated Solution
δ-large 21 -small instance s.t. ∀j, b(j) ∈ [2k , 2k+ℓ )
Given a solution we may apply “gravity”:
An O(1)-approximation algorithm for the storage allocation problem
11 / 14
Medium Tasks: Computing an elevated Solution
δ-large 21 -small instance s.t. ∀j, b(j) ∈ [2k , 2k+ℓ )
Given a solution we may apply “gravity”:
An O(1)-approximation algorithm for the storage allocation problem
11 / 14
Medium Tasks: Computing an elevated Solution
δ-large 21 -small instance s.t. ∀j, b(j) ∈ [2k , 2k+ℓ )
Given a solution we may apply “gravity”:
An O(1)-approximation algorithm for the storage allocation problem
11 / 14
Medium Tasks: Computing an elevated Solution
δ-large 21 -small instance s.t. ∀j, b(j) ∈ [2k , 2k+ℓ )
Given a solution we may apply “gravity”:
An O(1)-approximation algorithm for the storage allocation problem
11 / 14
Medium Tasks: Computing an elevated Solution
δ-large 21 -small instance s.t. ∀j, b(j) ∈ [2k , 2k+ℓ )
Given a solution we may apply “gravity”:
Observations: Given a solution (S, h):
– At most 2ℓ /δ tasks containing an edge
ℓ
/δ
) possible task sets per edge
ℓ
/δ
) possible heights per edge
–
n
ℓ
2 /δ
= O(n2
–
n
ℓ
2 /δ
= O(n2
An O(1)-approximation algorithm for the storage allocation problem
11 / 14
Medium Tasks: Computing an elevated Solution
δ-large 21 -small instance s.t. ∀j, b(j) ∈ [2k , 2k+ℓ )
Given a solution we may apply “gravity”:
Observations: Given a solution (S, h):
– At most 2ℓ /δ tasks containing an edge
ℓ
/δ
) possible task sets per edge
ℓ
/δ
) possible heights per edge
–
n
ℓ
2 /δ
= O(n2
–
n
ℓ
2 /δ
= O(n2
2-approx algorithm:
– Compute (S, h) for Jk using dynamic programming
k
k
– (S1 , h1 ) ← ({j ∈ S : h(j) < 24 }, h + 24 )
– (S2 , h2 ) ← (S \ S1 , h)
– Return (Si , hi ) where i = argmaxi w(Si )
An O(1)-approximation algorithm for the storage allocation problem
2k
2k
4
11 / 14
Large Tasks
1
2 -large
instances: ∀j, dj > 12 b(j)
An O(1)-approximation algorithm for the storage allocation problem
12 / 14
Large Tasks
instances: ∀j, dj > 12 b(j)
1
2 -large
4-approx algorithm for BAP [Bonsma Schulz Wiese 11]
– Reduction to Rectangle Packing:
⊲
⊲
Assign h(j) ← b(j) − dj
Rectangle Packing instance R(J)
An O(1)-approximation algorithm for the storage allocation problem
12 / 14
Large Tasks
instances: ∀j, dj > 12 b(j)
1
2 -large
4-approx algorithm for BAP [Bonsma Schulz Wiese 11]
– Reduction to Rectangle Packing:
⊲
⊲
Assign h(j) ← b(j) − dj
Rectangle Packing instance R(J)
– Algorithm that solves R(J), for BAP instances
– Lemma: Given a BAP solution S, R(S) can be colored using 4 colors
⇒ opt(R(J)) ≥ 41 optBAP (J)
An O(1)-approximation algorithm for the storage allocation problem
12 / 14
Large Tasks
instances: ∀j, dj > 12 b(j)
1
2 -large
4-approx algorithm for BAP [Bonsma Schulz Wiese 11]
– Reduction to Rectangle Packing:
⊲
⊲
Assign h(j) ← b(j) − dj
Rectangle Packing instance R(J)
– Algorithm that solves R(J), for BAP instances
– Lemma: Given a BAP solution S, R(S) can be colored using 4 colors
⇒ opt(R(J)) ≥ 41 optBAP (J)
3-approx algorithm for SAP
– Algorithm computes a SAP solution
– Lemma: Given a SAP solution (S, h), R(S) can be colored using 3 colors
An O(1)-approximation algorithm for the storage allocation problem
12 / 14
Strong NP-hardness of SAP
Reduction from Bin Packing
Given s1 , . . . , sn and k, we construct:
– The following structure (k = 4):
n+4
n+5
n+3
n+6
n+2
n+7
e1
An O(1)-approximation algorithm for the storage allocation problem
e2
n+1
e3 e4
e5
e6
e7
e8
e9
7
6
5
4
3
2
1
0
13 / 14
Strong NP-hardness of SAP
Reduction from Bin Packing
Given s1 , . . . , sn and k, we construct:
– The following structure (k = 4):
n+4
n+5
n+3
n+6
n+2
n+7
– ith task: di = si , I(i) = {ek+2 }
e1
An O(1)-approximation algorithm for the storage allocation problem
e2
n+1
e3 e4
e5
e6
e7
e8
e9
7
6
5
4
3
2
1
0
13 / 14
Strong NP-hardness of SAP
Reduction from Bin Packing
Given s1 , . . . , sn and k, we construct:
– The following structure (k = 4):
n+4
n+5
n+3
n+6
n+2
n+7
– ith task: di = si , I(i) = {ek+2 }
e1
e2
n+1
e3 e4
e5
e6
e7
e8
e9
7
6
5
4
3
2
1
0
Items can be packed in k bins iff ∃ SAP solution with n + 2k − 1 tasks
An O(1)-approximation algorithm for the storage allocation problem
13 / 14
Strong NP-hardness of SAP
Reduction from Bin Packing
Given s1 , . . . , sn and k, we construct:
– The following structure (k = 4):
n+4
n+5
n+3
n+6
n+2
n+7
– ith task: di = si , I(i) = {ek+2 }
e1
e2
n+1
e3 e4
e5
e6
e7
e8
e9
Items can be packed in k bins iff ∃ SAP solution with n + 2k − 1 tasks
Applies to SAP under no bottleneck assumption: maxj dj ≤ mine ce
Extends to unit capacities
An O(1)-approximation algorithm for the storage allocation problem
7
6
5
4
3
2
1
0
13 / 14
Conclusion
Our Results:
(9 + ε)-approximation algorithm for SAP
SAP is strongly NP-hard, even with unit capacities
An O(1)-approximation algorithm for the storage allocation problem
14 / 14
Conclusion
Our Results:
(9 + ε)-approximation algorithm for SAP
SAP is strongly NP-hard, even with unit capacities
Open Problems:
Improve approximation ratio
PTAS for SAP (or BAP)? Unit capacities?
APX-hardness of SAP (or BAP)?
An O(1)-approximation algorithm for the storage allocation problem
14 / 14
Conclusion
Our Results:
(9 + ε)-approximation algorithm for SAP
SAP is strongly NP-hard, even with unit capacities
Open Problems:
Improve approximation ratio
PTAS for SAP (or BAP)? Unit capacities?
APX-hardness of SAP (or BAP)?
An O(1)-approximation algorithm for the storage allocation problem
14 / 14