Loading...
Loading...
Dedicated QAOA for Max-Cut and combinatorial graph problems
The Quantum Approximate Optimization Algorithm is a variational hybrid quantum-classical protocol specifically designed to tackle combinatorial optimization problems such as Max-Cut by alternating between problem-specific cost Hamiltonians and uniform mixing operators. Its p-layer ansatz interpolates between the quantum approximate optimization regime and adiabatic quantum computing as the depth p increases, with bounded approximation ratios for certain graph families. QAOA has become a flagship NISQ algorithm for demonstrating quantum advantage in structured optimization landscapes.
The QAOA ansatz is constructed from two non-commuting Hamiltonians: a problem-dependent cost Hamiltonian \hat{H}_C that encodes the objective function to be minimized, and a transverse-field mixing Hamiltonian \hat{H}_M that enables exploration of the solution space. The algorithm prepares a variational state by alternately applying evolution operators generated by these Hamiltonians for p rounds, creating a 2p-parameter quantum circuit. The initial state is the uniform superposition |+\rangle^{\otimes n}, which is the ground state of the mixing Hamiltonian and an equally weighted sum over all computational basis states.
Each layer consists of a cost evolution e^{-i\gamma_k \hat{H}_C} followed by a mixing evolution e^{-i\beta_k \hat{H}_M}. The cost evolution applies a phase to each computational basis state proportional to its objective value, while the mixing evolution rotates amplitudes between states, creating interference patterns that amplify low-cost solutions. As the number of layers p increases, the QAOA state family becomes more expressive, eventually containing the adiabatic path as p \rightarrow \infty under appropriate parameter schedules.
The variational parameters \{\gamma, \beta\} are optimized classically to minimize the expectation value of the cost Hamiltonian with respect to the quantum state. This hybrid loop leverages quantum resources for state preparation and measurement while using classical optimizers to navigate the parameter landscape. The choice of classical optimizer, initialization strategy, and parameter constraints significantly impact the quality of solutions achievable at finite depth.
QAOA State
Mixing Hamiltonian
Objective Function
The Max-Cut problem asks for a partition of a graph's vertices into two sets that maximizes the number of edges crossing between the sets. This NP-hard combinatorial problem maps naturally to an Ising Hamiltonian where each vertex is assigned a spin variable and each edge contributes an energy penalty when its endpoints share the same partition. The ground state of this Ising model corresponds to the optimal Max-Cut partition, making it an ideal target for QAOA.
The cost Hamiltonian for Max-Cut on an unweighted graph G = (V, E) takes the form of a sum over edges with ZZ interactions. Each term (\hat{I} - \hat{Z}_i \hat{Z}_j)/2 evaluates to 0 when vertices i and j are in different partitions and to 1 when they are in the same partition. The total cost Hamiltonian therefore counts the number of uncut edges, so minimizing its expectation value is equivalent to maximizing the cut size. For weighted graphs, each edge term is multiplied by its weight.
The classical Goemans-Williamson algorithm provides a semidefinite programming relaxation that achieves an approximation ratio of approximately 0.878 for general graphs, which serves as an important benchmark for QAOA. For specific graph families, such as bounded-degree graphs or those with particular symmetries, QAOA at fixed depth can sometimes match or exceed this bound. However, for general graphs, the achievable approximation ratio at finite p and the scaling behavior with graph size remain active areas of theoretical research.
Max-Cut Hamiltonian
Cut Size
Approximation Ratio
At p = 1, QAOA admits analytical solutions for certain graph topologies, including the complete graph and regular graphs with uniform weights. These exact results reveal how the optimal parameters depend on graph degree and structure, providing intuition for parameter initialization in more complex instances. However, as graph irregularity increases, the p = 1 ansatz becomes insufficient, and deeper circuits are required to capture non-local correlations and competing constraints.
Increasing the QAOA depth p generally improves the approximation quality but introduces several practical challenges. Deeper circuits suffer from accumulated gate errors and decoherence on NISQ devices, often reaching a noise-induced optimum at modest p before performance degrades. On the classical optimization side, the parameter landscape becomes increasingly non-convex and riddled with local minima, making gradient-based and derivative-free optimizers prone to suboptimal convergence.
Recent advances include warm-start strategies that initialize QAOA parameters from classical relaxation solutions, recursive QAOA that iteratively reduces problem size by fixing high-confidence variables, and problem-specific ansatz modifications that tailor the mixer to constraints. These techniques aim to push QAOA beyond its vanilla formulation and improve its competitiveness with state-of-the-art classical solvers on industrially relevant problem instances.
Depth-p Expectation
Parameter Scaling
Variance Bound
Runnable implementations you can copy and experiment with.
Construct and optimize a QAOA ansatz for a three-node Max-Cut instance using Qiskit's circuit library.
from qiskit import QuantumCircuit
from qiskit.circuit.library import QAOAAnsatz
from qiskit.quantum_info import SparsePauliOp
from qiskit.primitives import Estimator
from qiskit_algorithms.optimizers import COBYLA
import numpy as np
# Max-Cut for 3-node line graph: edges (0,1) and (1,2)
cost_hamiltonian = SparsePauliOp.from_list([
("IZZ", 0.5),
("ZZI", 0.5)
])
ansatz = QAOAAnsatz(cost_hamiltonian, reps=2)
estimator = Estimator()
optimizer = COBYLA(maxiter=100)
def cost_func(params):
job = estimator.run(ansatz, cost_hamiltonian, params)
return job.result().values[0]
initial_point = np.random.random(ansatz.num_parameters) * 2 * np.pi
result = optimizer.minimize(cost_func, initial_point)
print(f"Minimum energy: {result.fun}")
print(f"Optimal parameters: {result.x}")Implement a custom p=2 QAOA circuit for Max-Cut on a three-node graph using PennyLane.
import pennylane as qml
from pennylane import numpy as np
n_qubits = 3
edges = [(0, 1), (1, 2)]
dev = qml.device("default.qubit", wires=n_qubits)
coeffs = [0.5, 0.5]
obs = [qml.PauliZ(0) @ qml.PauliZ(1), qml.PauliZ(1) @ qml.PauliZ(2)]
cost_h = qml.Hamiltonian(coeffs, obs)
@qml.qnode(dev)
def qaoa_circuit(params, p=1):
for i in range(n_qubits):
qml.Hadamard(i)
for i in range(p):
for (u, v) in edges:
qml.IsingZZ(params[i], wires=[u, v])
for j in range(n_qubits):
qml.RX(2 * params[p + i], wires=j)
return qml.expval(cost_h)
p = 2
opt = qml.GradientDescentOptimizer(stepsize=0.01)
params = np.array(np.random.uniform(0, 2*np.pi, 2*p), requires_grad=True)
for i in range(200):
params = opt.step(lambda v: qaoa_circuit(v, p=p), params)
print(f"Optimal value: {qaoa_circuit(params, p=p)}")
print(f"Parameters: {params}")