Problem: In the generalized assignment problem with unit-value items, there are $m$ bins of capacity $C$ each. There are $n$ items where each item $i$ has weight $w_{ij}$ with bin $j$. The objective is to assign the items to the bins (while respecting the bins capacities) such that the number of assigned items is maximum. I know that this problem is NP-hard.
Question: why the following algorithm is not optimal?
Algorithm:
- For each bin $j$, assign the maximum. Here, assign the maximum means to iterate the items such that $w_{1j}\leq w_{2j}\leq\cdots\leq w_{nj}$ and add to bin $j$ the items in that order until the capacity $C$ is filled.
- Take the union. This means that, if bin $j$ is assigned a set $S_j$ of items, then the result would be: $\bigcup_j S_j$.
So for example if I have this instance: $C=4$ and $m=3$ and $n=7$. The weights are given by: $$\begin{pmatrix} 2 & 4 & 4\\ 2 & 1 & 4\\ 4 & 1 & 2\\ 4 & 1 & 4\\ 4 & 1 & 4\\ 4 & 4 & 4\\ 4 & 4 & 2 \end{pmatrix}.$$
So the algorithm gives the following assignment:
- bin 1: items 1 & 2,
- bin 2: items 2, 3, 4, & 5
- bin 3: items 3 & 7
Finally, we choose the following assignment:
- bin 1: items 1 & 2,
- bin 2: items 3, 4, & 5
- bin 3: item 7
Maybe I choose the bad example, can you show me how this algorithm fails?