Quadratic unconstrained binary optimization

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

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

[edit | edit source]

Let 𝔹={0,1} the set of binary digits (or bits), then 𝔹n is the set of binary vectors of fixed length n. Given a symmetric or upper triangular matrix 𝑸n×n, whose entries Qij define a weight for each pair of indices i,j{1,,n}, we can define the function f𝑸:𝔹n that assigns a value to each binary vector 𝒙 through

f𝑸(𝒙)=𝒙𝑸𝒙=i=1nj=1nQijxixj.

Alternatively, the linear and quadratic parts can be separated as

f𝑸,𝒒(𝒙)=𝒙𝑸𝒙+𝒒𝒙,

where 𝑸n×n and 𝒒n. This is equivalent to the previous definition through 𝑸=𝑸+diag[𝒒] using the diag operator, exploiting that x=xx for all binary values x.

Intuitively, the weight Qij is added if both xi=1 and xj=1. The QUBO problem consists of finding a binary vector 𝒙* that minimizes f𝑸, i.e., 𝒙𝔹n:f𝑸(𝒙*)f𝑸(𝒙).

In general, 𝒙* is not unique, meaning there may be a set of minimizing vectors with equal value w.r.t. f𝑸. The complexity of QUBO arises from the number of candidate binary vectors to be evaluated, as |𝔹n|=2n grows exponentially in n.

Sometimes, QUBO is defined as the problem of maximizing f𝑸, which is equivalent to minimizing f𝑸=f𝑸.

Properties

[edit | edit source]

QUBO is scale invariant for positive factors α>0, which leave the optimum 𝒙* unchanged:

fα𝑸(𝒙)=𝒙(α𝑸)𝒙=α(𝒙𝑸𝒙)=αf𝑸(𝒙).

In its general form, QUBO is NP-hard and cannot be solved efficiently by any polynomial-time algorithm.[6] However, there are polynomially-solvable special cases, where 𝑸 has certain properties,[7] for example:

  • If all coefficients are positive, the optimum is trivially 𝒙*=(0,,0). Similarly, if all coefficients are negative, the optimum is 𝒙*=(1,,1).
  • If 𝑸 is diagonal, the bits can be optimized independently, and the problem is solvable in 𝒪(n). The optimal variable assignments are simply xi*=1 if Qii<0, and xi*=0 otherwise.
  • If all off-diagonal elements of 𝑸 are non-positive, the corresponding QUBO problem is solvable in polynomial time.[8]

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 xixj by an additional binary variable zij𝔹 and add the constraints xizij, xjzij and xi+xj1zij. Note that zij can also be relaxed to continuous variables within the bounds zero and one.

Applications

[edit | edit source]

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.[9]

Maximum Cut

[edit | edit source]

Given a graph G=(V,E) with vertex set V={1,,n} and edges EV×V, the maximum cut (max-cut) problem consists of finding two subsets S,TV with T=VS, such that the number of edges between S and T is maximized.

The more general weighted max-cut problem assumes edge weights wij0i,jV, with (i,j)Ewij=0, and asks for a partition S,TV that maximizes the sum of edge weights between S and T, i.e.,

maxSViS,jSwij.

By setting wij=1 for all (i,j)E this becomes equivalent to the original max-cut problem above, which is why we focus on this more general form in the following.

For every vertex in iV we introduce a binary variable xi with the interpretation xi=0 if iS and xi=1 if iT. As T=VS, every i is in exactly one set, meaning there is a 1:1 correspondence between binary vectors 𝒙𝔹n and partitions of V into two subsets.

We observe that, for any i,jV, the expression xi(1xj)+(1xi)xj evaluates to 1 if and only if i and j are in different subsets, equivalent to logical XOR. Let 𝑾+n×n with Wij=wiji,jV. By extending above expression to matrix-vector form we find that

𝒙𝑾(1𝒙)+(1𝒙)𝑾𝒙=2𝒙𝑾𝒙+(𝑾1+𝑾1)𝒙

is the sum of weights of all edges between S and T, where 1=(1,1,,1)n. As this is a quadratic function over 𝒙, it is a QUBO problem whose parameter matrix we can read from above expression as

𝑸=2𝑾diag[𝑾1+𝑾1],

after flipping the sign to make it a minimization problem.

Cluster Analysis

[edit | edit source]
Binary Clustering with QUBO
Visual representation of a clustering problem with 20 points: Circles of the same color belong to the same cluster. Each circle can be understood as a binary variable in the corresponding QUBO problem.

Next, we consider the problem of cluster analysis, where we are given a set of N points in d-dimensional space and 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 this example we set N=20 and d=2. The data is given as a matrix 𝑿20×2, where each row contains two cartesian coordinates. For two clusters, we can assign a binary variable xi𝔹 to the point corresponding to the i-th row in 𝑿, indicating whether it belongs to the first (xi=0) or second cluster (xi=1). Consequently, we have 20 binary variables, which form a binary vector 𝒙𝔹20 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 𝒙, the expression xixj+(1xi)(1xj) evaluates to 1 if points i and j are in the same cluster. Similarly, xi(1xj)+(1xi)xj=1 indicates that they are in different clusters. Let dij>0 denote the Euclidean distance between the points i and j, i.e.,

dij=𝑿i𝑿j,

where 𝑿i is the i-th row of 𝑿.

In order to define a cost function to minimize, when points i and j are in the same cluster we add their positive distance dij, 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.

Let 𝑫N×N with Dij=dij/2 for all i,j{1,,n}. Given an assignment 𝒙𝔹N, such a cost function is given by

f(𝒙)=𝒙𝑫𝒙𝒙𝑫(1𝒙)(1𝒙)𝑫𝒙+(1𝒙)𝑫(1𝒙)=4𝒙𝑫𝒙41𝑫𝒙+1𝑫1,

where 1=(1,1,,1)N.

From the second line we can see that this expression can be re-arranged to a QUBO problem by defining

𝑸=4𝑫4diag[𝑫1]

and ignoring the constant term 1𝑫1. Using these parameters, a binary vector minimizing this QUBO instance 𝑸 will correspond to an optimal cluster assignment w.r.t. above cost function.

Connection to Ising models

[edit | edit source]

QUBO is very closely related and computationally equivalent to the Ising model, whose Hamiltonian function is defined as

H(𝝈)=𝝈𝑱𝝈+𝒉𝝈=i,jJijσiσj+jhjσj

with real-valued parameters hj,Jij for all i,j. The spin variables σj are binary with values from {1,+1} instead of 𝔹. Note that this formulation is simplified, since, in a physics context, σi are typically Pauli operators, which are complex-valued matrices of size 2n×2n, whereas here we treat them as binary variables. Many formulations of the Ising model Hamiltonian further assume that the variables are arranged in a lattice, where only neighboring pairs of variables ij can have non-zero coefficients; here, we simply assume that Jij=0 if i and j are not neighbors.

Applying the identity σ=12x yields an equivalent QUBO problem [10]

𝝈𝑱𝝈+𝒉𝝈=(12𝒙)𝑱(12𝒙)+𝒉(12𝒙)=4𝒙𝑱𝒙41𝑱𝒙+1𝑱12𝒉𝒙+𝒉1=𝒙(4𝑱)𝒙(4𝑱1+2𝒉)𝒙+1𝑱1+𝒉1const.,

whose weight matrix 𝑸 is given by

𝑸=4𝑱diag[4𝑱1+2𝒉],

again ignoring the constant term, which does not affect the minization. Using the identity x=(1σ)/2, a QUBO problem with matrix 𝑸 can be converted to an equivalent Ising model using the same technique, yielding

𝑱=𝑸/4,𝒉=(𝑸1+𝑸1)/4,

and a constant offset of 1𝑸1/4.[10]

References

[edit | edit source]
  1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  4. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  5. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  6. ^ A. P. Punnen (editor), Quadratic unconstrained binary optimization problem: Theory, Algorithms, and Applications, Springer, Springer, 2022.
  7. ^ Çela, E., Punnen, A.P. (2022). Complexity and Polynomially Solvable Special Cases of QUBO. In: Punnen, A.P. (eds) The Quadratic Unconstrained Binary Optimization Problem. Springer, Cham. https://doi.org/10.1007/978-3-031-04520-2_3
  8. ^ See Theorem 3.16 in Punnen (2022); note that the authors assume the maximization version of QUBO.
  9. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  10. ^ a b Mücke, S. (2025). Quantum-Classical Optimization in Machine Learning. Shaker Verlag. https://d-nb.info/1368090214
[edit | edit source]