There's more than one way to do things | |
PerlMonks |
Sets of subsetsby jpearl (Scribe) |
on Jul 22, 2009 at 19:51 UTC ( [id://782421]=perlquestion: print w/replies, xml ) | Need Help?? |
jpearl has asked for the wisdom of the Perl Monks concerning the following question: I have an interesting problem that i've been thinking about. Basically we have a series of different "things" (say 4 of them). I would like to group each thing together by a given set of attributes. The way this is calculated is something like:
From the table we can see similarities and differences between the things. For example the difference between t1 and t4 is 0, and the similarity is 3. My idea is to group the "t#"s together by maximizing the average difference between them, and minimize the similarity. To do that, however I need to be able to split the "things" into multiple different subsets. For example:
etc. Then basically iterate over all different possible combinations and find the maximum average distance and/or minimum similarity resulting from a comparison of the groups. My question is: is there a module available which will return sets of subsets like this? I'm finding a lot of modules that return permutations and the like, but not subsets. I can of course write my own, but reinventing the wheel and all that. Any suggestions of a better/different way to do a grouping of this nature are of course completely appreciated. Thanks!
Back to
Seekers of Perl Wisdom
|
|