***Welcome to ashrafedu.blogspot.com * * * This website is maintained by ASHRAF***

Thursday 9 April 2020

Set Cover Problem


Set Cover Problem



Given a universe U of n elements, a collection of subsets of U say S = {S1, S2…,Sm} where every subset Si has an associated cost. Find a minimum cost subcollection of S that covers all elements of U.

There is no polynomial time solution available for this problem as the problem is a known NP-Hard problem. There is a polynomial time Greedy approximate algorithm, the greedy algorithm provides a Log n approximate algorithm.

2-Approximate Greedy Algorithm:

Let U be the universe of elements, {S1, S2, … Sm} be collection of subsets of U and Cost(S1), C(S2), … Cost(Sm) be costs of subsets.

1) Let I represents set of elements included so far.  Initialize I = {}

2) Do following while I is not same as U.

    a) Find the set Si in {S1, S2, ... Sm} whose cost effectiveness is
       smallest, i.e., the ratio of cost C(Si) and number of newly added
       elements is minimum.
       Basically we pick the set for which following value is minimum.
           Cost(Si) / |Si - I|
    b) Add elements of above picked Si to I, i.e.,  I = I U Si

Example:

   U = {1,2,3,4,5}
   S = {S1,S2,S3}
    S1 = {4,1,3},    Cost(S1) = 5
   S2 = {2,5},      Cost(S2) = 10
   S3 = {1,4,3,2},  Cost(S3) = 3
Output: Minimum cost of set cover is 13 and set cover is {S2, S3}

No comments:

Post a Comment