-2

What is the most time-efficient and correct algorithm that finds the minimum set cover? I don't need the code itself. I would like an explanation or pseudo code on how it works.
For an example, we have

Set S = {1,2,3,..,12}

Subsets S1 = {1,2,3,4,5,6}, S2 = {5,6,7,8,9}, S3 = {1,4,7,10}, S4={2,5,7,8,11}

S5 = {3,6,9,12}, S6 = {10,11}

The min set cover would be S3 U S4 U S5. Thanks in advance!

Niklas B.
  • 92,950
  • 18
  • 194
  • 224
  • You should've mentioned if by "algorithm" you meant **approximation algorithm** With a little research on Google you could've found that this is a NP Complete problem shown to be NP Complete back in 1972. – Fallen Apr 11 '14 at 19:18
  • @Fallen Why? IMO it is legitimate and sensible to ask for the most efficient *optimal* algorithm for the problem (which is exponential in this case). I mean it's still a bad question because that information is easily accessible – Niklas B. Apr 11 '14 at 19:19
  • @NiklasB: "Fastest Algorithm for Finding a Minimum Set Cover". He might have asked for an approximation algorithm or algorithm to work with a small set that could be done accurately. – Fallen Apr 11 '14 at 19:24
  • 1
    @Fallen That it's only possible for small enough inputs pretty much follows automatically from the exponential bound (unless P = NP that is) I still don't see your point, but I agree that it would be helpful to know the number of sets. So you should ask a clarification about that rather than pointing to approximation algorithms that OP is clearly not interested in. If it's hard, it's hard, but it can still be viable to solve small inputs – Niklas B. Apr 11 '14 at 19:31

1 Answers1

1

As noted in the comments, set cover is NP-hard. I believe that, for "natural" instances, the best exact approaches in practice are based on integer programming. Writing a good integer program solver requires a fair amount of craft, so you probably just want to use a solver library.

David Eisenstat
  • 64,237
  • 7
  • 60
  • 120