qlauncher.problems.optimization.knapsack#
This module contains the Knapsack class.
Summary#
Classes:
Class for 0/1 Knapsack Problem. |
Reference#
- class qlauncher.problems.optimization.knapsack.Knapsack(values: Sequence[int], weights: Sequence[int], capacity: int, instance_name: str = 'unnamed')[source]#
Bases:
ProblemClass for 0/1 Knapsack Problem.
This class represents the 0/1 Knapsack problem: maximize the total value of chosen items subject to a capacity constraint on total weight. The class wraps a concrete instance and can be passed into QLauncher.