I am given 3 sets A, B and C, each with n elements. These sets can contain duplicates (not certain if Set is the right term).
Now I am trying to form a set D with n elements (say D1 to Dn), each element Di containing 3 elements, one from A, one from B and one from C.
My objective is to find the set D which minimizes the sum of products of elements in Di.
Brute force seems to be a pretty bad idea here because even for n>5, the algorithm slows down pretty badly. Can anyone suggest a better approach? Is Linear Programming suitable for this problem?
So you want to form two bipartite graphs that create a matching of elements of A-B and B-C, such that the average product (a_i * b_j * c_k) is minimized.
Unfortunately I believe this is an NP-hard problem. (if you take the number of matchings n=3 as a variable)
I don’t think the two matchings can be made seperately:
Consider A = {1, 10}, B = {1, 10}
The matching of A,B in isolation is 1 x 10 = 10 and 1 x 10 = 10 (for a total of 20)
However consider C = { 1, 10000 }
If we take the greedy match of A,B with C we get 10 x 1 = 10 and 10 x 10000 = 100000 (for a total of 100010)
However if we had of taken the non-optimal matching A,B as 1 x 1 = 1 and 10 x 10 = 100 (for a total of 101)
We could then match it with C as 1 x 10000 = 10000 and 100 x 10 = 1000 (for a total of 11000)
So we can see that it is necessary to consider all possible combinations.
This isn’t a proof that it’s NP-hard, but I hope it communicates an intuition.