Minimum Set Cover is a question where you must find the minimum number of sets needed to cover every element.
For example, imagine that we have a set of X=array(1,2,3,4,5,6) and 5 another set S, where
The problem is to find minimum number of sets of S which cover every element of X. So obviously the minimum set cover in our case will be S[4] and S[5] because they cover all the elements.Does anybody have an idea how to implement this code in PHP. Note, that this is NP-complete so there is no fast algorithm to solve it. Any solution in PHP will be welcomed. And BTW it is not a homework, I need to use this algorithm in my web application in order to generate suggestion list. Thanks in advance. Update 1 There are many applications of Set Covering Problem. Some of the interesting ones are:
For example, you can see the working version of the problem I mentioned. Here, even it shows visually the sets. But I need the pure PHP code for that, if somebody has it please be kind to provide us with the working example in PHP. Thanks Update 3 Finally, I have solved the problem in PHP. My solution based on the algorithm proposed on a very famous book called Introduction to Algorithms, section The set-covering problem. Here how my solution looks like:
|
Entri Populer
-
Diposkan oleh blogqu | undefined undefined String menghitung=""; int panjg=0; int lebar=0; int...
Kamis, 13 Januari 2011
gredy
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar