# Improving the Solving of Optimization Problems:
## 5 Quantum Circuit Model-Based Solvers
### Qaoa
To represent the mixed Hamiltonian with unitary quantum gates, it is transformed into the following operator, since the \(\sigma_{j}^{x}\) matrices commute:  
\[e^{i\beta_{m}H_{0}}=e^{-i\beta_{m}\bigotimes_{j=0}^{n-1}\sigma_{j}^{x}}= \bigotimes_{j=0}^{n-1}e^{-i\beta_{m}\sigma_{j}^{x}}=R_{X}(2\beta_{m}). \tag{16}\]  
Therefore, the operator \(U_{M}(\beta_{m})\) is implemented just by applying the \(R_{X}\) gate to every qubit in the circuit (Figure 1). Concerning the Ising Hamiltonian operator, \(H_{1}\) comprises only diagonal matrices; thus, they commute as well. Consequently, the linear and quadratic terms can be separated into two distinct operators:  
\[U_{c}(\gamma_{m})=e^{i\gamma_{m}H_{1}}=e^{i\gamma_{m}\sum_{j}h_{j}\sigma_{j}^{ x}+\sum_{j}h_{j}\sigma_{j}^{x}\otimes\sigma_{k}^{x}}=\prod_{j}e^{i\gamma_{m}h_{j} \sigma_{j}^{x}}\prod_{j,k}e^{i\gamma_{m}h_{j}\sigma_{j}^{x}\otimes\sigma_{k}^ {x}}\,. \tag{17}\]  
The operator associated with the linear Ising term has the same form as the mixed Hamiltonian one--a product of operators applied on different qubits is equivalent to the tensor product of these operators. Therefore, it can be implemented by applying the \(R_{Z}(-2\gamma_{m}h_{j})\) quantum gate on the \(j^{\text{th}}\) qubit. The operator associated with the quadratic term includes a tensor product between two diagonal matrices; hence, it should be performed by a two-qubit gate. Two different cases can be discerned:  
* If qubits \(j\) and \(k\) have the same value, the operator becomes \(e^{i\gamma_{m}J_{jk}}\),
* If qubits \(j\) and \(k\) have different value, the operator becomes \(e^{-i\gamma_{m}J_{jk}}\). Therefore, this transformation is equivalent to applying the \(R_{Z}(-2\gamma_{m}J_{jk})\) gate on the \(k^{\text{th}}\) between two controlled not gates (Figure 1). In this way, if \(|j\rangle=|1\rangle\) and \(|k\rangle=|0\rangle\), \(|k\rangle\) is inverted and its phase is flipped. If \(|j\rangle=|0\rangle\) and \(|k\rangle=|1\rangle\), the CNOT gate does not affect \(|k\rangle\) and its phase is flipped. Hence, the operator flips the phase only when the two qubits have different values. The sequence of these gates produces a quantum circuit implementing the operators \(U_{M}(\beta_{m})U_{c}(\gamma_{m})\), which is also called ansatz since it is a parametric circuit repeated many times (\(p\)) in the algorithm to approximate AQC as discrete evolution. Since QAOA is a variational circuit (Figure 1), a classical optimization part is needed to properly select the circuit parameters and obtain the ground state of the problem Hamiltonian. Therefore, the algorithm steps are reported below [57]:  
1. The effective quantum circuit is defined by selecting a proper value for the number of discretization steps \(p\). 2. Initial values for the parameters \(\mathbf{\beta}=(\beta_{1},\dots,\beta_{p})\) and \(\mathbf{\gamma}=(\gamma_{1},\dots,\gamma_{p})\) are chosen. 3. The quantum circuit is executed multiple times and the expectation value with respect to the problem Hamiltonian is calculated. 4. The circuit parameters \(\mathbf{\beta}=(\beta_{1},\dots,\beta_{p})\) and \(\mathbf{\gamma}=(\gamma_{1},\dots,\gamma_{p})\) are updated by the classical optimizer exploration approach exploiting the obtained expectation value. 5. Repeat from step 2 until the algorithm's stop condition--e.g., a selected number of iterations or the convergence of the classical optimizer--is met. The classical optimizer can be any algorithm that does not require an explicit expression for the objective function, but only a cost evaluation based on the selected parameters. The results produced by QAOA may significantly vary according to the optimizer used to tune the angle parameters. However, the execution time of these algorithms is crucial; since a quantum algorithm is exploited as a heuristic, increasing the number of iterations may be more favorable than relying on more accurate classical optimizers. An overview and comparison of the best classical optimizers for QAOA is provided in [58].