Implemented knapsack solver