enum ITEM;
int: capacity;
array[ITEM] of int: profits;
array[ITEM] of int: weights;
var set of ITEM: knapsack;
constraint sum (i in knapsack) (weights[i]) <= capacity;
solve maximize sum (i in knapsack) (profits[i]) ;
output ["knapsack = \(knapsack)\n"];