Added function to project onto knapsack constraints.