implement penalty functions on knapsack from a research paper