# Quantum optimization algorithms

Mathematical optimization deals with finding the best solution to a problem (according to some criteria) from a set of possible solutions. Mostly, the optimization problem is formulated as a minimization problem, where one tries to minimize an error which depends on the solution: the optimal solution has the minimal error. Different optimization techniques are applied in various fields such as mechanics, economics and engineering, and as the complexity and amount of data involved rise, more efficient ways of solving optimization problems are needed. The power of quantum computing may allow solving problems which are not practically feasible on classical computers, or suggest a considerable speed up with respect to the best known classical algorithm. Among other quantum algorithms, there are quantum optimization algorithms which might suggest improvement in solving optimization problems.[1]

## Quantum data fitting

Data fitting is a process of constructing a mathematical function that best fits a set of data points. The fit's quality is measured by some criteria, usually the distance between the function and the data points.

### Quantum least squares fitting

One of the most common types of data fitting is solving the least squares problem, minimizing the sum of the squares of differences between the data points and the fitted function.

The algorithm is given as input ${\displaystyle N}$ data points ${\displaystyle (x_{1},y_{1}),(x_{2},y_{2}),...,(x_{N},y_{N})}$ and ${\displaystyle M}$ continuous functions ${\displaystyle f_{1},f_{2},...,f_{M}}$. The algorithm finds and gives as output a continuous function ${\displaystyle f_{\vec {\lambda }}}$ that is a linear combination of ${\displaystyle f_{j}}$:

${\displaystyle f_{\vec {\lambda }}(x)=\sum _{j=1}^{M}f_{j}(x)\lambda _{j}}$

In other words, the algorithm finds the complex coefficients ${\displaystyle \lambda _{j}}$, and thus finds the vector ${\displaystyle {\vec {\lambda }}=(\lambda _{1},\lambda _{2},...,\lambda _{M})}$.

The algorithm is aimed at minimizing the error, which is given by:

${\displaystyle E=\sum _{i=1}^{N}\left\vert f_{\vec {\lambda }}(x_{i})-y_{i}\right\vert ^{2}=\sum _{i=1}^{N}\left\vert \sum _{j=1}^{M}f_{j}(x_{i})\lambda _{j}-y_{i}\right\vert ^{2}=\left\vert F{\vec {\lambda }}-{\vec {y}}\right\vert ^{2}}$

where we define ${\displaystyle F}$ to be the following matrix:

${\displaystyle {F}={\begin{pmatrix}f_{1}(x_{1})&\cdots &f_{M}(x_{1})\\f_{1}(x_{2})&\cdots &f_{M}(x_{2})\\\vdots &\ddots &\vdots \\f_{1}(x_{N})&\cdots &f_{M}(x_{N})\\\end{pmatrix}}}$

The quantum least-squares fitting algorithm[2] makes use of a version of Harrow, Hassidim, and Lloyd's quantum algorithm for linear systems of equations (HHL), and outputs the coefficients ${\displaystyle \lambda _{j}}$ and the fit quality estimation ${\displaystyle E}$. It consists of three subroutines: an algorithm for performing a pseudo-inverse operation, one routine for the fit quality estimation, and an algorithm for learning the fit parameters.

Because the quantum algorithm is mainly based on the HHL algorithm, it suggests an exponential improvement[3] in the case where ${\displaystyle F}$ is sparse and the condition number (namely, the ratio between the largest and the smallest eigenvalues) of both ${\displaystyle FF^{\dagger }}$ and ${\displaystyle F^{\dagger }F}$ is small.

## Quantum semidefinite programming

Semidefinite programming (SDP) is an optimization subfield dealing with the optimization of a linear objective function (a user-specified function to be minimized or maximized), over the intersection of the cone of positive semidefinite matrices with an affine space. The objective function is an inner product of a matrix ${\displaystyle C}$ (given as an input) with the variable ${\displaystyle X}$. Denote by ${\displaystyle \mathbb {S} ^{n}}$ the space of all ${\displaystyle n\times n}$ symmetric matrices. The variable ${\displaystyle X}$ must lie in the (closed convex) cone of positive semidefinite symmetric matrices ${\displaystyle \mathbb {S} _{+}^{n}}$. The inner product of two matrices is defined as:

${\displaystyle \langle A,B\rangle _{\mathbb {S} ^{n}}={\rm {tr}}(A^{T}B)=\sum _{i=1,j=1}^{n}A_{ij}B_{ij}.}$

The problem may have additional constraints (given as inputs), also usually formulated as inner products. Each constraint forces the inner product of the matrices ${\displaystyle A_{k}}$ (given as an input) with the optimization variable ${\displaystyle X}$ to be smaller than a specified value ${\displaystyle b_{k}}$ (given as an input). Finally, the SDP problem can be written as:

${\displaystyle {\begin{array}{rl}{\displaystyle \min _{X\in \mathbb {S} ^{n}}}&\langle C,X\rangle _{\mathbb {S} ^{n}}\\{\text{subject to}}&\langle A_{k},X\rangle _{\mathbb {S} ^{n}}\leq b_{k},\quad k=1,\ldots ,m\\&X\succeq 0\end{array}}}$

The best classical algorithm known runs polynomial time in the worst case.

### The quantum algorithm

The algorithm inputs are ${\displaystyle A_{1}...A_{m},C,b_{1}...b_{m}}$ and parameters regarding the solution's trace, precision and optimal value (the objective function's value at the optimal point).

The quantum algorithm[4] consists of several iterations. In each iteration, it solves a feasibility problem, namely, finds any solution satisfying the following conditions (giving a threshold ${\displaystyle t}$):

${\displaystyle {\begin{array}{lr}\langle C,X\rangle _{\mathbb {S} ^{n}}\leq t\\\langle A_{k},X\rangle _{\mathbb {S} ^{n}}\leq b_{k},\quad k=1,\ldots ,m\\X\succeq 0\end{array}}}$

In each iteration, a different threshold ${\displaystyle t}$ is chosen, and the algorithm outputs either a solution ${\displaystyle X}$ such that ${\displaystyle \langle C,X\rangle _{\mathbb {S} ^{n}}\leq t}$ (and the other constraints are satisfied, too) or an indication that no such solution exists. The algorithm performs a binary search to find the minimal threshold ${\displaystyle t}$ for which a solution ${\displaystyle X}$ still exists: this gives the minimal solution to the SDP problem.

The quantum algorithm provides a quadratic improvement over the best classical algorithm in the general case, and an exponential improvement when the input matrices are of low rank.

## Quantum combinatorial optimization

The combinatorial optimization problem is aimed at finding an optimal object from a finite set of objects. The problem can be phrased as a maximization of an objective function which is a sum of boolean functions. Each boolean function ${\displaystyle \,C_{\alpha }\colon \lbrace {0,1\rbrace }^{n}\rightarrow \lbrace {0,1}\rbrace }$ gets as input the ${\displaystyle n}$-bit string ${\displaystyle z=z_{1}z_{2}\ldots z_{n}}$ and gives as output one bit (0 or 1). The combinatorial optimization problem of ${\displaystyle n}$ bits and ${\displaystyle m}$ clauses is finding an ${\displaystyle n}$-bit string ${\displaystyle z}$ that maximizes the function

${\displaystyle C(z)=\sum _{\alpha =1}^{m}C_{\alpha }(z)}$

Approximate optimization is a way of finding an approximate solution to an optimization problem, which is often NP-hard. The approximated solution of the combinatorial optimization problem is a string ${\displaystyle z}$ that is close to maximizing ${\displaystyle C(z)}$.

### Quantum Approximate Optimization Algorithm

For combinatorial optimization, the Quantum Approximate Optimization Algorithm (QAOA)[5] briefly had a better approximation ratio than any known polynomial time classical algorithm (for a certain problem),[6] until a more effective classical algorithm was proposed.[7] The relative speed-up of the quantum algorithm is an open research question.

The heart of the QAOA relies on the use of unitary operators dependent on ${\displaystyle 2p}$ angles, where ${\displaystyle p>1}$ is an input integer. These operators are iteratively applied on a state that is an equal-weighted quantum superposition of all the possible states in the computational basis. In each iteration, the state is measured in the computational basis and ${\displaystyle C(z)}$ is calculated. After a sufficient number of repetitions, the value of ${\displaystyle C(z)}$ is almost optimal, and the state being measured is close to being optimal as well.