Download
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