Matching plus Allocation

By Rod Carvalho

Suppose we are given n = 3 red balls and n = 3 black balls. All of these balls are labeled with a real number. For example

Red + Black ballsWe now pair red balls with black balls. There are n! = 3! = 6 such matchings, as illustrated below

6 matchings

Additionally, suppose that a pair composed of a red ball with label r \in \mathbb{R} and a black ball with label b \in \mathbb{R} can be exchanged for a white ball with label b - r. For example

3 reds & 3 blacks produce 3 whitesSince there are 3! = 6 matchings, in general there will be 6 collections of 3 white balls, as depicted below

6x3 white ballsNote that the sum of the labels of the white balls is always 6, regardless of the matching. This is due to the fact that addition is commutative and associative. Note also that the 3! = 6 resulting collections of 3 white balls are not necessarily distinct.

Suppose now that we would like to allocate the n = 3 white balls to m = 2 bowls such that the sum of the labels of the white balls in each bowl is 50% of the total sum of the labels of the white balls. Pictorially, we have

123-50-50 allocationand, since the sum of the labels of the white balls in each bowl is exactly 3, the allocation is feasible. Nonetheless, this allocation is not unique: we could also have allocated ball with label 3 to bowl 1 and balls with labels 1 and 2 to bowl 2. If we wanted to allocate 1/3 of the total to bowl 1 and 2/3 of the total to bowl 2, we could have allocated ball with label 2 to bowl 1, and balls with labels 1 and 3 to bowl 2, for instance. This allocation would also be feasible.

However, not all desired allocations are feasible. For example, suppose that we want to allocate 90% to bowl 1 and 10% to bowl 2. This allocation is unfeasible. We can allocate a total of 5 to bowl 1 and 1 to bowl 2, which corresponds to 83.3% and 16.7% instead of 90% and 10%.

123-90-10 allocationThough we cannot attain the desired allocation exactly, we are able to get relatively “close” to it. We could use, for instance, a quadratic criterion to measure how “far” a particular allocation is from the desired one.

In each bowl we are attempting to reconstruct a given real number from a finite collection of real numbers. Hence, the unfeasibility of a desired allocation stems from the “chunkiness” of the “parts” we have at our disposal. But here is the interesting aspect of this problem: we can change the “parts” (i.e., the white balls) by matching the red and black balls in a different way. Therefore, allocation can not be “decoupled” from matching, so to say. The two operations are now intertwined. When performing the matching, we should strive to build a good collection of white balls so that the actual allocation is as “close” as possible to the desired one.

If we have n red balls and n black balls, then there are n! matchings. Each red-black pair is then allocated to one of m \leq n bowls. Hence, our search space has n! m^n points, and an exhaustive search will run in time O(n! m^n) which is intractable for “large” values of n. For example, if n = 10 and m = 3, the search space has over 200 billion points! Yet once again, we are doomed by the curse of combinatorial explosion.

Our challenge (and only hope) is to design a heuristic-based algorithm which, although not optimal, is “good enough” most of the time. Any ideas?

This problem seems to have some of the ingredients of many classical problems such as integer partitions, knapsack, and bipartite / tripartite matching. It is not difficult to formulate the problem as a constrained quadratic binary optimization problem, but solving it is hard.

Tags: ,

One Response to “Matching plus Allocation”

  1. Paolo Says:

    The second part of your problem, the “allocation” is a classical problem in Computer Science. It is called the partition problem (for the 50% case): this is a special case of the subset sum problem (the 10%-90%, or any other thing is also a special case of subset sum), and it’s known to be NP-complete. You can look at the wikipedia page for subset sum: they discuss some approximation results for it, and have reasonable links. In terms of both your problems together, this seems like a restriction of the subset sum problem as follows: the “red” numbers are positive, the “black” numbers are negative, and you want to find a partition into two sets that sums to half, with the added constraint that you must place the same number of “red” and “black” numbers in your set.

Leave a Reply