title: Selecting top N most different items of a product
body: <p>I have several sets of items (options), for example like this:</p>
  <pre><code>set1 = ['a', 'b', 'c', 'd']
  set2 = ['!', '@', '#', '$']
  set3 = [1, 2, 3, 4]
  </code></pre>
  <p>and I create list of all the combinations (using <code>itertools.product</code>), which gives me something like this:</p>
  <pre><code>('a', '!', 1),
  ('a', '!', 2),
  ('a', '!', 3),
  ('a', '!', 4),
  ('a', '@', 1),
  ('a', '@', 2),
  ('a', '@', 3),
  ...
  ('d', '#', 3),
  ('d', '#', 4),
  ('d', '$', 1),
  ('d', '$', 2),
  ('d', '$', 3),
  ('d', '$', 4)
  </code></pre>
  <p>This is a simple example, I have actually more sets with more options, which result in many thousands of combinations. Now I need to select N combinations where the resulting set of combinations would conform to several properties:</p>
  <ol>
  <li>Every option of every set must be present at least once.</li>
  </ol>
  <ul>
  <li>It would be nice if distribution of each option would be somewhat similar (as in &quot;a should be in ~25% of combinations, so should b,c,e...Having 'a' in 90% combinations would be considered bad).</li>
  </ul>
  <ol start="2">
  <li>Combinations should be as distant from other combinations as possible. By distant I mean this: <code>('a', '!', 1)</code> is very  &quot;close&quot; to <code>('a', '!', 2)</code>, but very distant to <code>('d', '$', 4)</code>. The point is to have minimal number of same options between the two.</li>
  </ol>
  <p>I'm struggling to even figure out where to start. I was thinking of serializing combinations and hashing them, hoping for somewhat equal distribution, but I don't think this would have the necessary properties I need.</p>
  <p>Thank you</p>