Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there polynomial algorithm to this? Possibly dynamic programming approach?

Assume you are given a set A = {1, 2, ..., m} and a set B = {1, 2, ..., n}, such that each element from the set A has to be assigned to some element from B. The following parameters for each element i from the set A and each element j from the set B are known:

  • Sij is the cost of assignment an element i to element j greater or equal to zero;
  • tij is the minimal preference of element i to element j greater or equal to zero;
  • Tij is the maximal preference of element i to element j greater or equal to zero.

For each fixed i, all values of tij, Tij (for all j's) are different. m and n are integers greater than 0, and the other variables are non-negative real numbers.

Elements from the set A are assigned to elements from B according to their preferences tij (or Tij). For example, if tij < tik (preferences Tij or Tik might be used in any case instead, read further), then element i will be assigned to j rather then k. Out of mn preferences, exactly r of them have to use value of Tij as a value of preference, and remaining mn - r have to use value of tij (which is lower value then Tij).

If element i is assigned to an element j, then the cost Sij is added to the total cost of assignment to element j, i.e., Cj = Cj + Sij. Let Max be the maximum among all costs Cj and Min the minimum among all costs Cj. The goal is to choose which preferences of assignment element i to element j will take the value of Tij, and which preferences will take the value of tij, such that the value of:

  1. Max is minimal;
  2. Max - Min is minimal.

I think there is some dynamic programming algorithm, but I'm not sure. Does anybody know how to solve this by DP approach, or any other? It might not be polynomial, however, but I think it is.

Example. Let m = 3, n = 2, i.e. A = {1, 2, 3} and B = {1, 2, 3}. Let r = 2, and matrices S, t and T be given as

    |5 9|      |1 3|      |10  7|
S = |7 1|, t = |4 2|, T = | 5  4|.
    |8 4|      |3 4|      | 9 12|

Solution is equal to 5 in the case of minimizing the value of Max. Similar example might be constructed for minimizing Max - Min.

like image 610
user3372185 Avatar asked Mar 03 '14 02:03

user3372185


1 Answers

The problem is NP-hard, which can be shown by reducing Partition to it.

Let's assume we have an algorithm M that solves your problem optimally.

We are given a Partition instance X = {x1, x2, ..., xm} and want to find a partition of S into two subsets with minimum sum difference. Let's define n = 2, Sij = xi, tij = -j, Tij = j. Now we just iterate over all possible r and call M as a subroutine to find the global minimum for Max. We can show that the assignment that results in the minimum Max is an optimal 2-partition of X.

Since you're not working with integer costs but with real costs and since your problem is likely to get harder for n > 2 (we can also reduce Bin packing with n bins to your problem in a straight-forward way), it seems highly unlikely that there exists even a pseudopolyonomial solution for your problem unless P = NP. You should consider using heuristics to get a good approximative solution. A good starting point would be to look at the approximation schemes for Bin packing and try to adapt them to your problem. Maybe a simple first-fit approach is enough for your needs. Two more things you should keep in mind:

  • You can binary search for Max and then use it as a fixed upper bound for your "bins"
  • tij and Tij can be reduced to their respective argmins for a fixed i. You have a set of preferences Ti,1 (extracted from tij) and an alternative set of preferences Ti,2 (extracted from Tij) for every i. No point even considering the non-minimal preferences.
like image 183
Niklas B. Avatar answered Oct 21 '22 06:10

Niklas B.