Code
qcr:2606.84638.1

Quadratic Unconstrained Binary Optimization (QUBO)

This PennyLane demo provides an end-to-end walkthrough of solving a real optimization problem by casting it as a Quadratic Unconstrained Binary Optimization (QUBO) problem and tackling it with a quantum algorithm. QUBO is the canonical form for combinatorial optimization on quantum hardware: an objective quadratic in binary variables with no explicit constraints, which maps directly onto the ground-state problem of an Ising Hamiltonian. The tutorial takes a concrete, relatable example (such as a knapsack-style or assignment problem), shows how to translate its objective and constraints into QUBO form by folding the constraints into the objective as penalty terms, and then converts the QUBO into the corresponding Ising Hamiltonian. It then solves the problem with QAOA in PennyLane, building the cost and mixer layers, optimizing the variational parameters, and decoding the measured bitstring back into a solution of the original problem. Along the way it explains the modeling choices, such as how penalty weights enforce constraints and how the encoding affects qubit count. By covering the full pipeline from a worded problem to a quantum solution, the demo is a practical bridge from real optimization problems to quantum solvers in PennyLane.
Optimization
Qubit
Circuit-based
Uploaded 2 days ago
15
Views
GitHub667
Citing this entry? Use this QCR ID
Uploaded by
QL
QCR Librarian

Overview

PennyLaneAI/demos
667238
README.md

Quadratic Unconstrained Binary Optimization (QUBO)

This PennyLane demo provides an end-to-end walkthrough of solving a real optimization problem by casting it as a Quadratic Unconstrained Binary Optimization (QUBO) problem and tackling it with a quantum algorithm. QUBO is the canonical form for combinatorial optimization on quantum hardware: an objective quadratic in binary variables with no explicit constraints, which maps directly onto the ground-state problem of an Ising Hamiltonian. The tutorial takes a concrete, relatable example (such as a knapsack-style or assignment problem), shows how to translate its objective and constraints into QUBO form by folding the constraints into the objective as penalty terms, and then converts the QUBO into the corresponding Ising Hamiltonian. It then solves the problem with QAOA in PennyLane, building the cost and mixer layers, optimizing the variational parameters, and decoding the measured bitstring back into a solution of the original problem. Along the way it explains the modeling choices, such as how penalty weights enforce constraints and how the encoding affects qubit count. By covering the full pipeline from a worded problem to a quantum solution, the demo is a practical bridge from real optimization problems to quantum solvers in PennyLane.

Run it

pip install -r requirements.txt
python demo.py

Source and license

Imported from demonstrations_v2/tutorial_QUBO/demo.py in PennyLaneAI/demos at c52c0abeb5122218aa96b38eea848864cce7323f, under the Apache License 2.0. Original authors: Xanadu and the PennyLane community. The upstream LICENSE is included alongside this example.

Join the Discussion

Comments (0)

No comments yet. Be the first to share your thoughts!

Indexed by QCR Librarian

This entry was created automatically from publicly available records. QCR links to public sources and only stores repository content where the license permits redistribution.

Versions

v1 Latest
Jun 16, 2026
qcr:2606.84638.1

Cite all versions? Use the base QCR ID to always reference the latest version of this entry.

Tools used

PennyLane

Keywords

qubo
optimization
ising
qaoa
pennylane

You may also like5