Item

This module 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),
]
class pykp.item.Item(value: int, weight: int)

Bases: object

Represents an item for the knapsack problem.

value

The value of the item.

Type:

int

weight

The weight of the item.

Type:

int

value: int
weight: int