Quadratic unconstrained binary optimization explained
Quadratic unconstrained binary optimization (QUBO), also known as unconstrained binary quadratic programming (UBQP), is a combinatorial optimization problem with a wide range of applications from finance and economics to machine learning.[1] QUBO is an NP hard problem, and for many classical problems from theoretical computer science, like maximum cut, graph coloring and the partition problem, embeddings into QUBO have been formulated.[2] [3] Embeddings for machine learning models include support-vector machines, clustering and probabilistic graphical models.[4] Moreover, due to its close connection to Ising models, QUBO constitutes a central problem class for adiabatic quantum computation, where it is solved through a physical process called quantum annealing.[5]
Definition
The set of binary vectors of a fixed length
is denoted by
, where
is the set of binary values (or
bits).We are given a real-valued upper
triangular matrix
, whose entries
define a weight for each pair of indices
i,j\in\lbrace1,...,n\rbrace
within the binary vector.We can define a function
that assigns a value to each binary vector through
Intuitively, the weight
is added if both
and
have value 1.When
, the values
are added if
, as
for all
.
The QUBO problem consists of finding a binary vector
that is minimal with respect to
, namely
In general,
is not unique, meaning there may be a set of minimizing vectors with equal value w.r.t.
.The complexity of QUBO arises from the number of candidate binary vectors to be evaluated, as
grows exponentially in
.
Sometimes, QUBO is defined as the problem of maximizing
, which is equivalent to minimizing
.
Properties
QUBO is scale invariant for positive factors
, which leave the optimum
unchanged:
f\alpha(x)=\sumi\leq(\alphaQij)xixj=\alpha\sumi\leqQijxixj=\alphafQ(x)
In its general form, QUBO is NP-hard and cannot be solved efficiently by any polynomial-time algorithm.However, there are polynomially-solvable special cases, where
has certain properties, for example:
- If all coefficients are positive, the optimum is trivially
. Similarly, if all coefficients are negative, the optimum is
.
is
diagonal, the bits can be optimized independently, and the problem is solvable in
. The optimal variable assignments are simply
if
, and
otherwise.
- If all off-diagonal elements of
are non-positive, the corresponding QUBO problem is solvable in polynomial time.
[6] QUBO can be solved using integer linear programming solvers like CPLEX or Gurobi Optimizer.This is possible since QUBO can be reformulated as a linear constrained binary optimization problem.To achieve this, substitute the product
by an additional binary variable
and add the constraints
,
and
.Note that
can also be
relaxed to continuous variables within the bounds zero and one.
Applications
QUBO is a structurally simple, yet computationally hard optimization problem.It can be used to encode a wide range of optimization problems from various scientific areas.[7]
Cluster Analysis
As an illustrative example of how QUBO can be used to encode an optimization problem, we consider the problem of cluster analysis.Here, we are given a set of 20 points in 2D space, described by a matrix
, where each row contains two
cartesian coordinates.We want to assign each point to one of two classes or
clusters, such that points in the same cluster are similar to each other.For two clusters, we can assign a binary variable
to the point corresponding to the
-th row in
, indicating whether it belongs to the first (
) or second cluster (
).Consequently, we have 20 binary variables, which form a binary vector
that corresponds to a cluster assignment of all points (see figure).
One way to derive a clustering is to consider the pairwise distances between points.Given a cluster assignment
, one of
or
evaluates to 1 if points
and
are in the same cluster.Similarly, one of
or
indicates that they are in different clusters.Let
denote the
Euclidean distance between points
and
.In order to define a cost function to minimize, when points
and
are in the same cluster we add their positive distance
, and subtract it when they are in different clusters.This way, an optimal solution tends to place points which are far apart into different clusters, and points that are close into the same cluster.The cost function thus comes down to
\begin{align}
f(x)&=\sumi<jdij(xixj+(1-xi)(1-xj))-dij(xi(1-xj)+(1-xi)xj)\\
&=\sumi<j\left[4dijxixj-2dijxi-2dijxj+dij\right]
\end{align}
From the second line, the QUBO parameters can be easily found by re-arranging to be:
\begin{align}
Qij&=\begin{cases}
dij&ifi ≠ j\\
dki
di\ell\right)&ifi=j
\end{cases}
\end{align}
Using these parameters, the optimal QUBO solution will correspond to an optimal cluster w.r.t. above cost function.
Connection to Ising models
QUBO is very closely related and computationally equivalent to the Ising model, whose Hamiltonian function is defined as
H(\sigma)=-\sum\langleJij\sigmai\sigmaj-\mu\sumjhj\sigmaj
with real-valued parameters
for all
.The
spin variables
are binary with values from
instead of
.Moreover, in the Ising model the variables are typically arranged in a lattice where only neighboring pairs of variables
can have non-zero coefficients.Applying the identity
yields an equivalent QUBO problem:
[2] \begin{align}f(x)&=\sum\langle-Jij(2xi-1)(2xj-1)+\sumj\muhj(2xj-1)\\
&=\sum\langle(-4Jijxixj+2Jijxi+2Jijxj-Jij)+\sumj(2\muhjxj-\muhj)&&usingxj=xjxj\\
&=\sum\langle(-4Jijxixj)+\sum\langle2Jijxi+\sum\langle2Jijxj+\sumj2\muhjxj-\sum\langleJij-\sumj\muhj\\
&=\sum\langle(-4Jijxixj)+\sum\langle2Jjixj+\sum\langle2Jijxj+\sumj2\muhjxj-\sum\langleJij-\sumj\muhj&&using\sum\langle=\sum\langle\\
&=\sum\langle(-4Jijxixj)+\sumj\sum\langle2Jkixj+\sumj\sum\langle2Jikxj+\sumj2\muhjxj-\sum\langleJij-\sumj\muhj\\
&=\sum\langle(-4Jijxixj)+\sumj\left(\sum\langle(2Jki+2Jik)+2\muhj\right)xj-\sum\langleJij-\sumj\muhj&&using\sum\langle=\sum\langle\\
&=
Qijxixj+C\end{align}
where
\begin{align}Qij&=\begin{cases}-4Jij&ifi ≠ j\\
\sum\langle(2Jki+2Jik)+2\muhj&ifi=j\end{cases}\\
C&=-\sum\langleJij-\sumj\muhj\end{align}
and using the fact that for a binary variable
.
As the constant
does not change the position of the optimum
, it can be neglected during optimization and is only important for recovering the original Hamiltonian function value.
External links
- QUBO Benchmark (Benchmark of software packages for the exact solution of QUBOs; part of the well-known Mittelmann benchmark collection)
- Local search heuristics for Quadratic Unconstrained Binary Optimization (QUBO). Journal of Heuristics. 10.1007/s10732-007-9009-3. Endre Boros, Peter L Hammer & Gabriel Tavares. 13. 2. April 2007. 99–132. Association for Computing Machinery. 32887708. 12 May 2013.
- Analyzing quadratic unconstrained binary optimization problems via multicommodity flows. Discrete Applied Mathematics. Di Wang & Robert Kleinberg. 157. 18. November 2009. 10.1016/j.dam.2009.07.009. 20161596. 2808708. 3746–3753. Elsevier.
Notes and References
- Kochenberger . Gary . Hao . Jin-Kao . Fred . Glover . Mark . Lewis . Zhipeng. Lu . Haibo . Wang . Yang . Wang . The unconstrained binary quadratic programming problem: a survey. . Journal of Combinatorial Optimization . 2014 . 28 . 58–81 . 10.1007/s10878-014-9734-0 . 16808394 .
- Glover . Fred . Kochenberger. Gary . 1811.11538 . A Tutorial on Formulating and Using QUBO Models . cs.DS. 2019 .
- Lucas . Andrew . Ising formulations of many NP problems . Frontiers in Physics . 2014 . 2 . 5 . 10.3389/fphy.2014.00005 . 1302.5843 . 2014FrP.....2....5L . free .
- Mücke . Sascha . Piatkowski . Nico . Morik . Katharina . Katharina Morik. Learning Bit by Bit: Extracting the Essence of Machine Learning . LWDA . 2019 . 202760166 . https://web.archive.org/web/20200227143739/https://pdfs.semanticscholar.org/f484/b4a789e1563b91a416a7cfabbf72f0aa3b2a.pdf . dead . 2020-02-27 .
- Web site: D-Wave's Quantum Computer Goes to the Races, Wins . Tom Simonite . MIT Technology Review . 8 May 2013 . 12 May 2013 . 24 September 2015 . https://web.archive.org/web/20150924141050/http://www.technologyreview.com/view/514686/d-waves-quantum-computer-goes-to-the-races-wins/ . dead.
- See Theorem 3.16 in Punnen (2022); note that the authors assume the maximization version of QUBO.
- Web site: List of QUBO formulations . Ratke . Daniel . 2021-06-10 . 2022-12-16.