qubithubknapsack
Solves the 0/1 Knapsack problem using the Quantum Approximate Optimization Algorithm (QAOA) with QUBO penalty method. Select items to maximize total value without exceeding weight capacity. Default: 4 items with optimal solution {1,2} yielding value 35 at weight 18/18. Uses quadratic penalty P*(Σwᵢxᵢ - C)² to enforce the capacity constraint via RZZ interactions.
- Framework
- Qiskit
- Qubits
- 4
- Depth
- 9
- Gate set
- H, RZZ, RX
- Licence
- Apache-2.0
- Version
- v1
- Updated
- 1 day ago
- Runs
- None completed
Circuit
circuit.py · Qiskit · depth 9Loading circuit diagram…
Lineage
Not a fork.
No forks yet.
Suggested citation
@software{qubithub_knapsack_2026,
author = {QubitHub Circuits},
title = {QAOA for Knapsack},
year = {2026},
version = {v1},
url = {https://qubithub.co/qubithub/knapsack},
}Generated from this circuit's metadata. QubitHub does not mint DOIs, so this is not a registered identifier — check it against your venue's requirements before publishing.