I actually have a map of the form map>. Each key is an integer value and the value is a set with the elements that the key value can be aggregated with.
For example:
0: 0 1 3 4 6 7 9
1: 0 1 2 4 6
2: 1 2 4
3: 0 3 4 7 9
4: 0 1 2 3 4 6 7 9
5: 5 6 7 8
6: 0 1 4 5 6 7 8 9
7: 0 3 4 5 6 7 8 9
8: 5 6 7 8
9: 0 3 4 6 7 9
So, a possible aggregation, for K <= 4, where K represents the number of aggregated groups is:
k1: 0, 5, 7, 8
k2: 1, 2, 4, 6
k3: 3, 9
Another one:
k1: 0 3 4 7 9
k2: 5 6 8
k3: 1 2
If K <= 8, we can have the same aggregations but also:
k1: 0
k2: 1
k3: 2
k4: 3
k5: 4
k6: 5
k7: 6
k8: 7 8 9
Note that, in order to aggregate elements, these elements must be also possible to aggregate between them. For example:
We cannot aggregate: 0,1,3,4, because 3 cannot be aggregated with 1 (3: 0 3 4 7 9).
The problem is to find a possible aggregation, closer to K.
I tried pairing the elements, this is easy, but with this approach I can only get #elements/2 groups.
I would like to select the possible aggregation closer to K.
Aucun commentaire:
Enregistrer un commentaire