Tutorials
qcr:2606.99610.1

Introduction to QAOA with PennyLane

This PennyLane tutorial is a gentle, thorough introduction to the Quantum Approximate Optimization Algorithm (QAOA), the leading near-term quantum heuristic for combinatorial optimization, using PennyLane's dedicated QAOA module. QAOA encodes an optimization problem's objective into a cost Hamiltonian whose ground state is the optimal solution, and prepares a parameterized trial state by alternating, for a chosen number of layers, an evolution under the cost Hamiltonian (which imprints objective-dependent phases) with an evolution under a mixer Hamiltonian (which explores candidate solutions). A classical optimizer then tunes the layer angles to minimize the expected cost. The tutorial explains the building blocks, cost and mixer Hamiltonians and their layered application, and shows how PennyLane's qaoa module makes them easy to construct, then assembles a full QAOA circuit, defines the cost as an expectation value, and optimizes it with PennyLane's automatic differentiation. It applies the method to a small graph problem and recovers the optimal solution. By pairing clear explanation with PennyLane's high-level QAOA tooling, the tutorial gives an approachable, reusable foundation for variational quantum optimization in PennyLane.
Optimization
Qubit
Circuit-based
Uploaded 2 days ago
29
Views
GitHub667
Citing this entry? Use this QCR ID
Uploaded by
QL
QCR Librarian

Overview

PennyLaneAI/demos
667238
README.md

Introduction to QAOA with PennyLane

This PennyLane tutorial is a gentle, thorough introduction to the Quantum Approximate Optimization Algorithm (QAOA), the leading near-term quantum heuristic for combinatorial optimization, using PennyLane's dedicated QAOA module. QAOA encodes an optimization problem's objective into a cost Hamiltonian whose ground state is the optimal solution, and prepares a parameterized trial state by alternating, for a chosen number of layers, an evolution under the cost Hamiltonian (which imprints objective-dependent phases) with an evolution under a mixer Hamiltonian (which explores candidate solutions). A classical optimizer then tunes the layer angles to minimize the expected cost. The tutorial explains the building blocks, cost and mixer Hamiltonians and their layered application, and shows how PennyLane's qaoa module makes them easy to construct, then assembles a full QAOA circuit, defines the cost as an expectation value, and optimizes it with PennyLane's automatic differentiation. It applies the method to a small graph problem and recovers the optimal solution. By pairing clear explanation with PennyLane's high-level QAOA tooling, the tutorial gives an approachable, reusable foundation for variational quantum optimization in PennyLane.

Run it

pip install -r requirements.txt
python demo.py

Source and license

Imported from demonstrations_v2/tutorial_qaoa_intro/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.99610.1

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

Tools used

PennyLane

Keywords

qaoa
optimization
variational
pennylane
introduction

You may also like5