Optimization Problem with Fixed Discreet Variables

Copper Contributor
Hello!
My problem is relatively simple, but I can't find a way to make it.
I have 14 parts of type A and 14 parts of type B and their weights. I need to group they in 7 sets containing 2 of each (each part can be used only once).
I want to group the parts so all sets are as close as possible in weight. Would mean targeting the smallest StdDev of the total weight of each set:
 
Annotation 2020-02-26 161715.jpg
 
Anyone can help?
5 Replies

@Telles65 See attached. Next time, please upload an Excel file rather than a screen-shot.

@Jan Karel Pieterse 

 

Thank you for the attempt!

On the file you've sent the sets have the biggest possible StdDev of the totals. 

I would like to be able to combine to find the smallest possible StdDev.

I've also tried to use the Solver, did not work because I need it to iterate using fixed specific values of the table.

The file is attached this time!

Regards,

 

 

Is set A always smaller than set B? If so your second table is likely to be the best solution.

@Jan Karel Pieterse No, not always.

I'm still stuck with this...

I think it is like this:
Either you write VBA code that tries all possible combinations and picks the best (complicated to do and due to the many possibilities probably very slow), or you accept the second best solution which is where you try to create sets where you try to create pairs of both columns which are both as close to the column average as you can get. This is done by combining the largest with the smallest of A, then the one-but largest and one-but smallest, and etcetera. Depending on the precise numbers another strategy may potentially give a better result, but this strategy will likely work in more cases.