Pair up numbers of a set of real numbers such that variance of sum of pairs is minimal

23 Views Asked by At

I am trying to pair up real numbers such that the sums of the numbers in the pairs "are as similar as possible".

I know, this is quite a vague statement, but let me explain with a concrete example: Say you need two resistors with somewhere around 200Ω. The exact value does not matter much, but it is very important that the values are as similar as possible. But resistors have tolerances outside of what you can allow. You could buy four 100Ω resistors, measure their exact resistance and then pair them up.
$Resistors = \{101Ω, 102Ω, 104Ω, 106Ω\}$

A good way of pairing them up would be:
$GoodPairs = \{\{101Ω, 106Ω\}, \{102Ω, 104Ω\}\}$
Take the sums:
$SumsOfGoodPairs = \{207Ω, 206Ω\}$
This is good. The difference is only 1Ω.

A bad way of pairing them up would be:
$BadPairs = \{\{101Ω, 104Ω\}, \{102Ω, 106Ω\}\}$
Take the sums:
$SumsOfBadPairs = \{205Ω, 208Ω\}$
The difference is 3Ω in this case, which is worse than before.

In my particular case I need 30 zener-diodes, built from 60 zener-diodes with slightly varying voltages, and four groups of such zener-diodes. That's something like 10^41 possible arrangements per group alone, so bruteforcing this is out of the question.
My problem is coming up with a good strategy. I have a total of 240 zener-diodes and I can freely select pairs from that, so I maybe should not divide those randomly into 4 groups and consider each group separately.
A very simple strategy is this:

  • Sort the numbers (ascending or descending does not matter).
  • Create pairs from the highest and lowest numbers.
    $P=\{\{R_{0},R_{239}\},\{R_{1},R_{238}\},\{R_{2},R_{237}\},...,\{R_{119},R_{120}\}\}$
  • Sort the pairs by their sum.
  • Split the list of pairs into four.
    $G=\{\{P_{0}\ to\ P_{29}\}, \{P_{30}\ to\ P_{59}\}, \{P_{60}\ to\ P_{89}\}, \{P_{90}\ to\ P_{119}\}\}$

This will give somewhat similar sums in each group. But can we do better?