Download presentation
Presentation is loading. Please wait.
1
Approximation Algorithms
2
Introduction Approximation algorithms for optimization problems. Approximation algorithm - an algorithm that is guaranteed to run quickly (in time polynomial in the input size) and to produce a solution for which the value of the objective function is quantifiably close to the optimal value. Dao Thanh Tinh 2
3
Bin Parking Problem: Given S={s1, s2, ...,sn}, 0<si1, i=1,2,...,n.
How to pack S into as few bins as possible, where which bin has capacity 1. Dao Thanh Tinh 3
4
Bin Parking capacity of 1 0.8 0.5 0.4 0.3 0.2 2019-02-19
Dao Thanh Tinh 4
5
Bin Parking 4 bins used 0.5 0.8 0.4 0.3 0.2 2019-02-19 Dao Thanh Tinh
6
Bin Parking Nonincreasing order 0.8 0.5 0.4 0.3 0.2 2019-02-19
Dao Thanh Tinh 6
7
Bin Parking Nonincreasing first fit 4 bins used 0.8 0.3 0.5 0.4 0.2
Dao Thanh Tinh 7
8
Bin Parking Problem: Given S={s1, s2, ...,sn}, 0< s i T, i = 1,2,...,n. How to pack S into as few bins as possible, where which bin has capacity T. Set yi = 1 if bin i is used, otherwise yi=0. Number of the used bins is Set xij = 1 if item j is put into bin i, otherwise xij=0. An each item can put exactly into only one bin!!! Each bin have capacity T minimize B Dao Thanh Tinh 8
9
Bin Parking Nonincreasing first fit (Niff)
Problem: Given S={s1, s2, ...,sn}, 0< s i T, i = 1,2,...,n. How to pack S into as few bins as possible, where which bin has capacity T. Nonincreasing first fit (Niff) Input: s(1), s(2), ..., s(n), 0 < si ≤ 1, i=1,..,n. Output: An array b(1),...,b(n), where b(k)=i if s(k) is placed into bin i. sort s(1) ≥ s(2) ≥ ... ≥ s(n); for (j=1; j≤n; j++) used(j)=0; for (j=1 ; j≤n; j++) i=1; while (used(j)+s(i)>T) do i++; used(i) = used(i) + s(j); b(j) = i; Dao Thanh Tinh 9
10
Bin Parking Nonincreasing order 0.8 0.5 0.4 0.4 0.3 0.2 0.2 0.2
Dao Thanh Tinh 10
11
Bin Parking The Optimal Solution 0.8 0.5 0.4 0.3 0.3 0.8 0.5 0.4 0.2
Dao Thanh Tinh 11
12
Bin Parking The Optimal Solution Lemma 1.
0.8 0.4 0.3 0.5 0.2 0.8 0.4 0.3 0.5 0.2 Lemma 1. Let S={s1, s2, ..., sn} - input objects op(S) be the minimum number of bins for S All of the objects placed by Niff in the extra bins have size (weight) at most T/3 (1/3) Dao Thanh Tinh 12
13
Bin Parking Suppose that si>T/3 Niff: then: 1) s1, ...,si1>T/3
Lemma 1. Let S={s1, s2, ..., sn} - input objects op(S) be the minimum number of bins for S All of the objects placed by Niff in the extra bins have size (weight) at most T/3 (1/3) Proof. Let i is index of the first objects placed by Niff in bin op(S)+1. Suppose that si>T/3 then: 1) s1, ...,si1>T/3 2) bins bj, j=1,..,op(S), contain at most 2 objects Niff: ...... op(S) bins Extra bins si Dao Thanh Tinh 13
14
Bin Parking bp bq st st” st’ si In an optimal solution:
op(S) bins Extra bins bp bq p < q st st” st’ si if bin bp contains 2 objects bins bp+1,..., bop(S) contain 2 objects Suppose bq, p<q, contains st’. Let 2 objects in bp: st, st” Follow Niff: st st’ st” si st st” T st+st” st’+si Niff would have put si into bq! bins b1,.., bk contains s1,...,sk bins bk+1,...bop(S) contains 2 objects sk+1,...si-1 In an optimal solution: sk+1,..., si1, si,... will be in bins bk,..,bop(S) But it is imposible therefore the assumtion that si>T/3 must be false. op(S) bins Extra bins st st” si bop(S) bk bk1 b1 ... Dao Thanh Tinh 14
15
Bin Parking bp bq st st” st’ si Lemma 2. For S={s1,...,sn}
op(S) bins Extra bins bp bq p < q st st” st’ si Lemma 2. For S={s1,...,sn} Let F(S) is the number of objects which placed in extra bins bop(S)+1,... Then F(S) < op(S) Proof. Suppose that F(S) = op(S) Let: u1, ..., uop(S) be the objects which placed into extra bins t1,..., top(S) be the final contents of bins b1,..., bop(S) There are: bj + uj > T, j =1,...,op(S) which is impossible Dao Thanh Tinh 15
16
Bin Parking bp bq st st” st’ Remark. For S={s1,...,sn}
op(S) bins Extra bins bp bq p < q st st” st’ Remark. For S={s1,...,sn} The number of extra bins is at most (op(S)-1)/3 si Proof. The number of objects placed by Niff in extra bins is at most op(S)-1 and size of each object at most T/3 Then, each extra bin contain at least 3 objects. It show that the number of extra bins at most (op(S)-1)/3 Dao Thanh Tinh 16
17
Stategies Remark. For S={s1,...,sn}
The number of extra bins is at most (op(S)-1)/3 Proof. The number of objects placed by Niff in extra bins is at most op(S)-1 and size of each object at most T/3 Then, each extra bin contain at least 3 objects. It show that the number of extra bins at most (op(S)-1)/3 Dao Thanh Tinh 17
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.