pykp.knapsack#

Core classes for the knapsack problem.

PyKP knapsack provides classes to represent the knapsack problem and its solutions. It includes classes to represent the knapsack problem, the items to be packed, and the arrangement of items in the knapsack. It also provides a sampler to generate random knapsack instances.

Classes#

Arrangement(items, state)

Represents an arrangement of items for the knapsack problem.

Item(value, weight)

Represents an item for the knapsack problem.

Knapsack(items, capacity)

Represents a knapsack problem solver.