Decoupling the knapsack algorithm from the Item type.