Download presentation
Presentation is loading. Please wait.
Published byEustace Preston Modified over 9 years ago
1
Efficient and Effective Practical Algorithms for the Set-Covering Problem Qi Yang, Jamie McPeek, Adam Nofsinger Department of Computer Science and Software Engineering University of Wisconsin at Platteville
2
The Set-Covering Problem Given N sets, let X be the union of all the sets. A cover of X is a group of sets from the N sets such that every element of X belongs to a set in the group. The set-covering problem is to find a cover of X of the minimum size.
3
Matrix Representation of the Set- covering Problem abcde f S10110 10 S200110 0 S311010 1 S4010011 Number of sets: N = 4 Number of elements: M = 6 One cover: S1, S3, S4 One minimal cover: S1, S3 Not a cover: S1, S2, S4 (a is not covered)
4
NP-Hard Problem Introduction to Algorithms by T. H. Cormen, C.E. Leiserson, R. L. Rivest The Set-covering problem has been proved to be NP hard A Greedy Algorithm
5
Algorithm Greedy ResultCover : The minimum cover to be found. Uncovered : The set of elements not covered yet. 1. Set ResultCover to the empty set 2. Set Uncovered to the union of all sets 3. While Uncovered is not empty a. select a set S that is not in ResultCover and covers the most elements of Uncovered b. add S to ResultCover c. remove all elements of S from Uncovered
6
Algorithm Check And Remove (CAR) Identifying Redundant Search Engines in a Very Large Scale Metasearch Engine Context 8th ACM International Workshop on Web Information and Data Management The set-covering problem is equivalent to the problem of identifying redundant search engines on the Web Algorithm CAR is much faster than Algorithm Greedy
7
Algorithm CAR (Check And Remove) 1. Set ResultCover to the empty set 2. For each set S a. determine if S has an element that is not covered by ResultCover b. add S to ResultCover if S has such an element c. exit the for loop if ResultCover is a cover of X 3. For each set S in ResultCover a. determine if S has an element that is not covered by any other set of ResultCover b. Remove S from ResultCover if S has no such an element
8
Example abcde f S10110 10 S200110 0 S311010 1 S4010011 Set ResultCover UnCovered {} {a, b, c, d, e, f} S1 {S1} {a, d, f} S2 {S1, S2} {a, f} S3 {S1, S2, S3} {} Removing S2 {S1, S3} {}
9
Time Complexity Algorithm Greedy O(M * N * min(M, N)) Algorithm CAR O(M * N) N: number of sets M: number of elements of the union X
10
CPU Time 0 5000 10000 15000 20000 25000 30000 35000 40000 100200300400500600700800900 1000 Actual Cover Size CPU Time (Sec) Greedy CAR
11
Cover Size Cover Sizes of the Two Algorithms Actual100300500700900 Greedy105300501700900 CAR485300500700900
12
Implementation Details Read data Binary search tree BitMap indicating which sets cover an element Convert the tree to an array of BitMaps Matrix representation of the set-cover problem Find a cover
13
Binary Search Tree and BitMap element Number of sets (N) is known Number of elements of each set is known The total number of elements is unknown Reading elements of one set at a time BitMap size N which sets cover the element a column of the matrix
14
Array of Column BitMaps element Row Operations Find the number of elements in a set that are not covered by the result cover Determine if a set contains an element that is not covered by the result cover Determine if a set in the result cover has an element that is not covered by any other sets in result cover ….......... e 1 e 2 e 3 e 4 e m-1 e m
15
Array of Row BitMaps element It takes some time to convert column BitMaps to row BitMaps. But all row operations are performed within a row BitMap.
16
CPU Time Running Times (seconds) of the Greedy Algorithm Col0.6353.93001220213034575056 Row0.287.641161274437629 Running Times (seconds) of the CAR algorithm Col0.010.311.636.3611.1516.9220.70 Row0.090.390.962.123.274.345.46 The CPU time includes the time to convert column BitMaps to row BitMaps, but not the time to build the tree.
17
CPU Time (Row BitMap) Running Times (seconds) of the Two algorithms Greed0.287.641161274437629 CAR0.090.390.962.123.274.345.46
18
Algorithm Greedy 1. Set ResultCover to the empty set 2. Set Uncovered to the union of all sets 3. While Uncovered is not empty a. select a set S that is not in ResultCover and covers the most elements of Uncovered b. add S to ResultCover c. remove all elements of S from Uncovered
19
Algorithm Greedy Update UncoveredCount: number of elements of a set not covered by ResultCover 1. Set ResultCover to the empty set 2. Set Uncovered to the union of all sets 3. For each set, set the UncoveredCount to the size of the set 4. While Uncovered is not empty a.select a set that has the largest value of UncoveredCount among all sets not in ResultCover b.add the set to ResultCover c.remove all elements of the set from Uncovered d.update the value of UncoveredCount for each set not in ResultCover
20
Update Uncovered Count For each element in the set to be added to the ResultCover If the result cover does not covers it For each set not in the result cover If the set contains the element uncovered count is decremented by one
21
Time Complexity Algorithm Greedy O(M * N * min(M, N)) Algorithm CAR O(M * N) Algorithm Greedy Update O(M * N)
22
CPU Time Running Times (seconds) of the Two algorithms Update0.150.922.265.137.3110.113.1 CAR0.090.390.962.123.274.345.46
23
Algorithm List And Remove (LAR) Implemented the matrix using linked list instead of array of BitMaps Algorithm Update plus the remove phase from algorithm CAR
24
Linked List for Matrix e1e2e3e4e5e6e7 S5 S4 S3 S2 S1
25
CPU Time Running Times (seconds) of the Two algorithms LAR0.210.350.510.861.111.401.66 CAR0.260.490.651.011.241.461.67
26
Cover Size Cover Sizes of the Two algorithms LAR1087191422607815971 CAR16120235467648824975
27
Cover Size (Different Data Sets) Cover Sizes of the Two algorithms Actual507090110200500900 LAR507090110200500900 CAR291391496528200500900
28
Summary Algorithm LAR runs faster than Algorithm CAR Algorithm LAR generates smaller cover sets than Algorithm CAR Algorithm: Updating vs. searching every time Data Structure: Link list vs. array of BitMaps
29
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.