I have a matrix M with size NxN where each position M(i,j) is an integer representing the relationship between item i and j. If i and j are the same item then the positions M(i,j) and M(j,i) are 0.
What I'd need is to regroup these N items in subgroups of 5 elements each one. The value of each group would be Σ(M(i,j) for each i, j in the group).
And I would need to maximize the total value of all groups.
I studied lots of algorithms more than 15 years ago and I forgot the most of them, and nowadays are lots of new algorithms, so I'm a bit lost trying to find the best one for these case.
A friend told me to investigate Clustering algorithms but they have lots of different versions and specializations, so I don't know which one to look at first.
And just one more thing, besides this algorithm to maximize each group, would I need an algorithm to maximize the total value of all groups, discarding the non optimal selections? I remember algorithms that made this but I don't even remember their name.