Solving the knapsack problem (NP-complete!) in Prolog: https://newtocode.wordpress.com/2013/11/23/knapsack-problem-in-prolog/