This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Solve the knapsack problem using recursive descent. | |
// This wraps the actual solver below with a nice interface. | |
// It also handles non-integer cost, but then the complexity | |
// scales with the precision of the cost! | |
// | |
// obj is an object of named [cost, benefit] pairs, e.g. | |
// { banana: [5, 33], | |
// apple: [1, 12], | |
// kiwi: [1, 7] | |
// } |