Combination of values targeting a result.

  • Thread starter Thread starter Carlos Matheus
  • Start date Start date
C

Carlos Matheus

Hi guys.

I have a combination problem to solve and I am facing problems on how to picture the solution code in VBA.

I have a given number (n) of groups of 3 numbers each, and I need to create3 bigger groups containing only one number of each of these n groups.
So, at the end, I will have only 3 groups of n numbers each one.

So the problem is finding the combination that gives me the smallest difference between the sum of the elements of each group.
In other words: sum_elements_big_group_1 ≈ sum_elements_big_group_2≈ sum_elements_big_group_3 ≈ sum_all_elements_divided_by_3

Would you have any idea on how to do so?

Cheers.
 
Back
Top