QAOA: Quantum Approximate Optimization
QAOA: Quantum Approximate Optimization Algorithm
The Quantum Approximate Optimization Algorithm (QAOA), introduced by Farhi, Goldstone, and Gutmann (2014), is a leading candidate for demonstrating quantum advantage on combinatorial optimization problems.
The MaxCut Problem
Given a graph , MaxCut asks for a partition of vertices into two sets and that maximizes the number of edges crossing between them.
MaxCut is NP-hard in general, but QAOA provides a systematic quantum approximation scheme that improves with the number of layers .
Cost Hamiltonian
For each edge , the cost Hamiltonian encodes a +1 energy whenever the edge is cut:
When qubits and are in different states (), this contributes 1; when in the same state (), it contributes 0. So is exactly the expected number of cut edges.
The QAOA Circuit
Starting from the uniform superposition (all vertices equally in both sets), QAOA applies alternating layers:
- Phase separator : applies phase to basis states where edge is cut
- Mixer where : applies independently to each qubit, exploring the superposition
As with optimal parameters, QAOA converges to the exact MaxCut solution.
2-Node Example (p=1)
For the simplest graph with one edge , the MaxCut optimum is 1 (the edge is always cut when the two nodes are in opposite sets).
The QAOA state-vector evolution for basis states :
Initial:
After phase separator (cost = 1 for and , cost = 0 for and ):
After mixer : each qubit independently mixed via:
Optimal parameters: , achieve — the exact maximum cut!
Why QAOA Finds the Optimum Here
At the phase separator applies to the cut states, creating destructive interference for the non-cut states and after the mixer. At the mixer balances the interference precisely so that all probability flows into and .
Your Task
Implement:
qaoa_maxcut(gamma, beta)— simulate the p=1 QAOA circuit on a 2-node graph with edge (0,1), returning the expected cut valueqaoa_optimize()— grid-search over and (20 steps each) to find the maximum , returned rounded to 4 decimal places