Fetching contributors…
Cannot retrieve contributors at this time
10 lines (8 sloc) 273 Bytes
language Essence 1.3
$ prob133.essence: Knapsack Problem
given items new type enum
given weight, gain : function (total) items --> int
given capacity : int
find picked : set of items
maximising sum i in picked . gain(i)
such that (sum i in picked . weight(i)) <= capacity