pykp.knapsack.Knapsack.
empty#
- Knapsack.empty()#
Remove all items from the knapsack.
- Returns:
- list
The updated binary state array, all set to 0.
Examples
>>> knapsack = Knapsack(items=[Item(10, 2), Item(15, 4)], capacity=6) >>> knapsack.add(knapsack.items[0]) array([1, 0]) >>> knapsack.empty() array([0, 0])