Learning Notes
Home
Home
  • Guide
    • Shortkeys
    • Commands
  • Cpp
    • Basic
    • Scope, Duration, and Linkage
    • Pointers(1)
    • Pointers(2)
  • Rust Learning
    • 1.Number Types
    • 2.Ownership
    • 3.Struct
    • 4.Enum
    • 5.Package-management
    • 6.Vector
    • 7.Error handle
    • 8.Trait 泛型
    • 9.Life time
    • 10.Test
    • 11.Minigrep
    • 12.Closure 闭包
    • 13.Smart pointer 智能指针
    • 14.Fearless concurrency 无畏并发
  • Quantum Computing
    • Basic computing and quantum computing Theory
    • Teleportation
    • QKD and QFT
    • QFE and Shor's algorithm
    • QAOA
    • Quantum algorithms
    • Week 11
  • Statical Machine Learning
    • Bayesian Linear Regression
    • Linear regression and logistic regresion
    • Bais
    • SVM, Kernel Methods
    • Precepction and Artificial Neural Network
    • Cross validation, experts learning, MAB
    • Bayesian inference
    • GMM-EM
    • final
  • Software Project Management
    • Lecture
    • Revision
  • AI-planning
    • Classical planning
    • MDP and reinforcement learning
    • Game theory and final recap

QAOA (week 5 to week6)

The Max-Cut Problem

  • Goal: To partition the vertices of a graph into two sets such that the number of edges between the two sets is maximized.
  • The Max-Cut problem is a NP-hard problem.
  • Binary representation: For each vertex iii, define a binary variable xix_ixi​, where xi=1x_i = 1xi​=1 if iii belongs to one set, and xi=0x_i = 0xi​=0 if iii belongs to the other set. For each edge (i,j)(i,j)(i,j), it contributes to the cut if xi≠xjx_i \neq x_jxi​=xj​.

QUBO Formulation

  • The MaxCut objective function is exressed as:
    Maximize ∑(i,j)∈Ewij(1−xixj)\sum_{(i,j) \in E} w_ij (1 - x_i x_j)∑(i,j)∈E​wi​j(1−xi​xj​)

Hamiltonian

Using the substitution, xi=1−Zi2x_i = \frac{1 - Z_i}{2}xi​=21−Zi​​, we can formulate the equtaion:

H^MaxCut=∑(i,j)∈EI−ZiZj2 =−12∑(i,j)∈E(ZiZj)+12∣E∣I  \hat{H}MaxCut = \sum_{(i,j) \in E} \frac{I - Z_i Z_j}{2} \ = -\frac{1}{2} \sum_{(i,j) \in E} (Z_i Z_j) + \frac{1}{2} |E| I \ H^MaxCut=(i,j)∈E∑​2I−Zi​Zj​​ =−21​(i,j)∈E∑​(Zi​Zj​)+21​∣E∣I 

Where ∣E∣|E|∣E∣ is the size of the edge

The Minimum Vertex Cover Problem

  • Goal: To find the smallest set of vertices such that each edge in the graph has at least one endpoint in the set.
  • Binary Representation: For each vertex jjj, xj=1x_j=1xj​=1 if jjj is in the vertex cover, and xj=0x_j=0xj​=0 otherwise

QUBO Formulation

Minimize ∑j∈Vxj\sum_{j \in V}{x_j}∑j∈V​xj​,
for all (i,j)(i,j)(i,j) in Edge EEE , xi+xj≥1x_i + x_j \geq 1xi​+xj​≥1

For the constraint of MVC, we using the penalty function: P(1−x−y+xy)P(1-x-y+xy)P(1−x−y+xy)

The penalty function can convert a constrinat problem to an unconstrained problem
The unconstrained alternative for MVC is (PPP: Penalty Coefficient, wjw_jwj​: weight to vertex jjj, usually wj=1w_j = 1wj​=1):

Minimize ∑j∈Vwjxj+P(∑(i,j)∈E(1−xi−xj+xixj)) \text{Minimize } \sum_{j \in V}{w_j x_j} + P\left(\sum_{(i,j)\in E} (1 - x_i - x_j + x_i x_j)\right) Minimize j∈V∑​wj​xj​+P​(i,j)∈E∑​(1−xi​−xj​+xi​xj​)​

Hamiltonian

Substitute xi=1−Zi2x_i = \frac{1 - Z_i}{2}xi​=21−Zi​​, we can get the Hamiltonian for MVC:

y=∑j∈V(1−zj)wj2+P∑(i,j)∈E[1−1−zj2−1−zi2+1−zj21−zi2]=∣V∣wj2−∑j∈Vwjzj2+P∑(i,j)∈E[1−12+zj2−12+zi2+1−zi−zj+zizj4]=∣V∣wj2−∑j∈Vwjzj2+P∑(i,j)∈E[1+zizj+zi+zj4] \begin{align} y &= \sum_{j\in V} \frac{(1-z_j)w_j}{2} + P \sum_{(i,j)\in E} \left[1-\frac{1-z_j}{2}-\frac{1-z_i}{2}+\frac{1-z_j}{2}\frac{1-z_i}{2}\right] \\ &= \frac{|V|w_j}{2} - \sum_{j\in V}w_j\frac{z_j}{2} + P \sum_{(i,j)\in E} \left[1-\frac{1}{2}+\frac{z_j}{2}-\frac{1}{2}+\frac{z_i}{2}+\frac{1-z_i-z_j+z_iz_j}{4}\right] \\ &= \frac{|V|w_j}{2} - \sum_{j\in V}w_j\frac{z_j}{2} + P \sum_{(i,j)\in E} \left[\frac{1+z_iz_j+z_i+z_j}{4}\right] \end{align} y​=j∈V∑​2(1−zj​)wj​​+P(i,j)∈E∑​[1−21−zj​​−21−zi​​+21−zj​​21−zi​​]=2∣V∣wj​​−j∈V∑​wj​2zj​​+P(i,j)∈E∑​[1−21​+2zj​​−21​+2zi​​+41−zi​−zj​+zi​zj​​]=2∣V∣wj​​−j∈V∑​wj​2zj​​+P(i,j)∈E∑​[41+zi​zj​+zi​+zj​​]​​

Then we have:

H^MVC=−∑j∈VwjZj2+P∑(i,j)∈E[ZiZj+Zi+Zj4]+∣V∣wj2I+∣E∣P4I \hat{H}_\text{MVC} = -\sum_{j\in V} w_j \frac{Z_j}{2} + P \sum_{(i,j)\in E} \left[\frac{Z_iZ_j + Z_i + Z_j}{4}\right] + \frac{|V|w_j}{2}\mathbb{I} + \frac{|E|P}{4}\mathbb{I} H^MVC​=−j∈V∑​wj​2Zj​​+P(i,j)∈E∑​[4Zi​Zj​+Zi​+Zj​​]+2∣V∣wj​​I+4∣E∣P​I

where ∣V∣|V|∣V∣ is the number of vertices, ∣E∣|E|∣E∣ is the number of edges.

QUBO and Ising Model

The Ising Model is a mathematicla formulation used in quantum systems to encode Optimization Problems.

  • For a single qubit, energy can be encoded using Z gate:
    • Z gate: Assigns +1 energy for the state ∣0⟩\ket{0}∣0⟩ and -1 energy for the state ∣1⟩\ket{1}∣1⟩.
  • For multiple qubits, interactions are defined using Ising couplings between qubits:
    • ZiZiZ_i Z_iZi​Zi​ interactions for two qubits:
      • +1 for states ∣00⟩\ket{00}∣00⟩ or ∣11⟩\ket{11}∣11⟩
      • -1 for states ∣01⟩\ket{01}∣01⟩ or ∣10⟩\ket{10}∣10⟩ The total energy of the system is determined by these couplings.

The objective in QUBO is to minimize a cost function of the from:

E(x1,x2,...,xn)=∑incixi+∑i,jnQijxixjE(x_1, x_2, ..., x_n) = \sum_{i}^n c_i x_i + \sum_{i,j}^n Q_ij x_i x_jE(x1​,x2​,...,xn​)=∑in​ci​xi​+∑i,jn​Qi​jxi​xj​
where xix_ixi​ are binary variables (0 or 1)

  • This cost function can be mapped to the Ising Hamiltonian:
    • xi=1−Zi2x_i = \frac{1 - Z_i}{2}xi​=21−Zi​​
      ziz_izi​ is the Pauli z operator
Last Updated:
Contributors: pingzhihe
Prev
QFE and Shor's algorithm
Next
Quantum algorithms