pykp.item#

Provides an interface for defining items inside a knapsack problem instance.

Example

Use the Item class to define items for the knapsack problem:

from pykp import Item

items = [
    Item(value=10, weight=5),
    Item(value=20, weight=10),
    Item(value=30, weight=15),
]

Classes

Item(value, weight)

Represents an item for the knapsack problem.