Skip to main content

View on GitHub

Open this notebook in GitHub to run it yourself
This notebook demonstrates the implementation of the Variational Quantum Imaginary Time Evolution (VarQITE) algorithm for solving combinatorial optimization problems, specifically the Max-Cut problem following the paper Performant near-term quantum combinatorial optimization.

Generate Graph

Output:
output

Generate Ansatz

Given a graph G, return a quantum circuit for the maxcut problem. The circuit consists of single-qubit Hadamard gates, followed by a series of two-qubit Pauli (Y-Z) rotations. The two-qubit rotations are parameterized by angles, which are the variational parameters of the ansatz.
Output:
Output:
Output:

Var-IT Optimization

Ansatz

The quantum circuit has one qubit for each node in the graph. All qubits are initialized to the ∣+⟩|+\rangle state. Subsequently, each pair of nodes in the graph is rotated by a Y–ZY\text{--}Z rotation, RYZ(θj)R_{YZ}\left(\theta_j\right). For a graph with VV nodes, there are Np=V(V−1)/2N_p = V(V-1)/2 pairs, giving NpN_p parametric angles.

Cost Function

Representing the Max-Cut cost hamiltonian as a sum of Paulis: Hc=∑αPα,Hc∣z⟩=C(z)∣z⟩H_c=\sum_{\alpha} P_\alpha, \quad H_c|z\rangle=C(z)|z\rangle Where the cost is defined either by the physics convention: C(z)=∑(i,j)∈Ewijzizjzi∈{1,−1}C(z)=\sum_{(i,j)\in E} w_{ij} z_i z_j \quad z_i\in\{1,-1\} or the computer science convention: C(z)=−∑(i,j)∈Ewij(zi+zj−2zizj)/2zi∈{0,1}C(z)=-\sum_{(i,j)\in E} w_{ij}\left(z_i + z_j - 2 z_i z_j\right)/2 \quad z_i\in\{0,1\}

Parameter Optimization

The parametric angles are updated by solving the linear equation: G⋅θ⃗˙=DG\cdot\dot{\vec{\theta}}=D and updating the angles: θ⃗→θ⃗+Δτθ⃗˙\vec{\theta}\rightarrow\vec{\theta}+\Delta\tau\dot{\vec{\theta}} The matrix GG, and vector DD, are defined as: Gα,j=ℜ(⟨Ψ(θ⃗)∣Pα∂∣Ψ(θ⃗)⟩∂θj)G_{\alpha,j}= \Re \left(\langle\Psi\left(\vec{\theta}\right)|P_\alpha\frac{\partial |\Psi\left(\vec{\theta}\right)\rangle}{\partial \theta_j} \right) Dα=−12⟨Ψ(θ⃗)∣{Pα,Hc−Eτ}∣Ψ(θ⃗)⟩D_\alpha=-\frac{1}{2}\langle\Psi\left(\vec{\theta}\right)| \{P_\alpha, H_c-E_\tau\} |\Psi\left(\vec{\theta}\right)\rangle where PαP_\alpha is one of the Pauli strings that make up the cost Hamiltonian, HcH_c is the entire cost Hamiltonian, and EτE_\tau is the previous value of the cost Hamiltonian

VAR-IT Optimization

Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:

Create a Convergence Figure

output