perlquestion
jpearl
<p>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:</p>
<code> a1 a2 a3
t1 y y n
t2 y n y
t3 n y y
t4 y y n</code>
<p>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: </p>
<code>Subset(s)1 = {t1,t2}{t3}{t4}
Subset(s)2 = {t1}{t2,t3}{t4}
Subset(s)3 = {t1}{t2}{t3,t4}</code>
<p>etc.</p>
<p>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.</p>
<p>Thanks!</p>