{
  "id": "quadratic-unconstrained-binary-optimization",
  "title": "Quadratic Unconstrained Binary Optimization",
  "lang": "en",
  "source_lang": "en",
  "summary": "Quadratic unconstrained binary optimization minimizes a quadratic function of binary variables, providing a common formulation for discrete optimization and Ising-model computation.",
  "category": "mathematics",
  "subcategory": "applied",
  "type": "concept",
  "aliases": [
    "QUBO",
    "unconstrained binary quadratic programming",
    "unconstrained binary quadratic optimization",
    "UBQP"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/quadratic-unconstrained-binary-optimization/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/quadratic-unconstrained-binary-optimization/",
      "json": "https://aiwiki.page/zh/quadratic-unconstrained-binary-optimization.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Quadratic unconstrained binary optimization (QUBO) is a class of mathematical optimization problems in which a quadratic objective is minimized over variables restricted to \\(0\\) or \\(1\\), with no additional explicit constraints. Despite its simple form, QUBO can represent many problems in scheduling, resource allocation, graph optimization, and statistical modeling. It is closely related to integer programming and is mathematically equivalent, through a change of variables, to finding a minimum-energy configuration of an Ising model with pairwise interactions."
    },
    {
      "heading": "Mathematical formulation",
      "text": "A QUBO problem can be written as\n\n\\[\\min_{x\\in\\{0,1\\}^{n}} f(x), \\qquad f(x)=c+\\sum_{i=1}^{n}a_i x_i+ \\sum_{1\\leq i<j\\leq n}b_{ij}x_i x_j,\\]\n\nwhere \\(a_i\\), \\(b_{ij}\\), and \\(c\\) are real coefficients. The constant \\(c\\) changes the objective value but not the minimizing assignments.\n\nThe variables usually encode yes-or-no decisions: whether an item is selected, a task occupies a time slot, or a vertex belongs to a particular group. Linear terms assign individual costs or rewards, while pairwise terms describe interactions between decisions. In a minimization problem, a positive \\(b_{ij}\\) penalizes simultaneously setting \\(x_i=x_j=1\\); a negative coefficient rewards that joint choice, although the full objective determines which assignments are optimal.\n\nAn equivalent matrix formulation is\n\n\\[\\min_{x\\in\\{0,1\\}^{n}} x^{\\mathsf T}Qx+c.\\]\n\nBecause binary variables satisfy \\(x_i^2=x_i\\), linear terms can be placed on the diagonal of \\(Q\\). Two conventions are common:\n\n- Upper-triangular convention: \\(Q_{ii}=a_i\\), \\(Q_{ij}=b_{ij}\\) for \\(i<j\\), and \\(Q_{ij}=0\\) for \\(i>j\\).\n- Symmetric convention: \\(Q_{ii}=a_i\\) and \\(Q_{ij}=Q_{ji}=b_{ij}/2\\) for \\(i\\ne j\\).\n\nFailing to distinguish these conventions can introduce a factor-of-two error in interaction coefficients. For an arbitrary real matrix, only its symmetric part contributes to the quadratic form, since\n\n\\[x^{\\mathsf T}Qx = x^{\\mathsf T}\\frac{Q+Q^{\\mathsf T}}{2}x.\\]\n\n“Unconstrained” does not mean that the variables are unrestricted: the binary domain remains essential. It means that there are no explicit constraints beyond that domain."
    },
    {
      "heading": "Relation to pseudo-Boolean optimization",
      "text": "A pseudo-Boolean function maps binary vectors to real values. Every such function has a unique multilinear polynomial representation on \\(\\{0,1\\}^{n}\\). QUBO is the case in which that representation has degree at most two.\n\nThe restriction to quadratic degree is substantial, but auxiliary binary variables can be used to convert higher-degree objectives into quadratic ones. For example, a product \\(x_i x_j\\) can be represented by a new binary variable \\(y\\), with consistency enforced by the penalty\n\n\\[P(x_i,x_j,y) = x_i x_j-2x_i y-2x_j y+3y.\\]\n\nFor binary arguments, \\(P=0\\) exactly when \\(y=x_i x_j\\), and \\(P>0\\) otherwise. A cubic term \\(x_i x_j x_k\\) can therefore be replaced by \\(yx_k\\), together with a sufficiently strong multiple of \\(P\\).\n\nThis process, called quadratization, can increase both the number of variables and the required coefficient magnitudes. Its usefulness depends on the resulting formulation, not merely on the existence of a reduction."
    },
    {
      "heading": "Encoding constraints as penalties",
      "text": "Many applications begin with a constrained problem rather than a QUBO. Constraints can sometimes be moved into the objective function as penalties:\n\n\\[F(x)=f(x)+M P(x),\\]\n\nwhere \\(P(x)=0\\) for feasible assignments and \\(P(x)>0\\) for infeasible ones. The coefficient \\(M>0\\) must be large enough that violating a constraint cannot produce a better objective value.\n\nLinear equalities\n\nA linear equality\n\n\\[\\sum_i d_i x_i=b\\]\n\ncan be enforced with\n\n\\[P(x)=\\left(\\sum_i d_i x_i-b\\right)^2.\\]\n\nExpansion produces only linear and quadratic terms because \\(x_i^2=x_i\\).\n\nA common example is an exactly-one constraint,\n\n\\[\\sum_{i=1}^{k}x_i=1,\\]\n\nwith penalty\n\n\\[P(x)= \\left(\\sum_{i=1}^{k}x_i-1\\right)^2 = 1-\\sum_{i=1}^{k}x_i+ 2\\sum_{i<j}x_i x_j.\\]\n\nThis encoding is useful when a task must receive exactly one resource or an object must occupy exactly one position.\n\nInequalities and auxiliary variables\n\nAn integer-valued inequality can often be converted to an equality by introducing a nonnegative integer slack variable. A bounded slack variable can then be encoded using binary variables before applying a squared penalty.\n\nNot every constraint requires slack variables. For example, the prohibition against selecting both \\(i\\) and \\(j\\) can be enforced directly by a term \\(M x_i x_j\\). Choosing an encoding involves trade-offs among variable count, interaction density, and coefficient range.\n\nPenalty strength\n\nLet\n\n\\[R=\\max_x f(x)-\\min_x f(x)\\]\n\nbe the range of the original objective over all binary assignments. Suppose the feasible set is nonempty and the penalty is at least \\(\\delta>0\\) on every infeasible assignment. Then\n\n\\[M\\delta>R\\]\n\nis a sufficient condition for every global minimizer of \\(F\\) to be feasible.\n\nThis bound is often conservative. If \\(M\\) is too small, the encoded optimum may violate the intended constraints. If it is unnecessarily large, the objective can become dominated by penalty terms, making relevant cost differences harder for numerical solvers or finite-precision hardware to distinguish. Moreover, even a correctly chosen penalty guarantees feasibility only for global optima; a heuristic can still return an infeasible assignment."
    },
    {
      "heading": "Equivalence to the Ising model",
      "text": "Introduce spin variables \\(s_i\\in\\{-1,+1\\}\\) through\n\n\\[x_i=\\frac{1+s_i}{2}.\\]\n\nSubstitution gives\n\n\\[f(x(s)) = C+\\sum_i h_i s_i+ \\sum_{i<j}J_{ij}s_i s_j,\\]\n\nwhere\n\n\\[J_{ij}=\\frac{b_{ij}}{4},\\]\n\n\\[h_i=\\frac{a_i}{2} +\\frac14\\sum_{j\\ne i}b_{\\min(i,j),\\max(i,j)},\\]\n\nand\n\n\\[C=c+\\frac12\\sum_i a_i+\\frac14\\sum_{i<j}b_{ij}.\\]\n\nThus QUBO and Ising energy minimization have corresponding configurations and objective values up to an additive constant. Sign conventions vary: some descriptions of the Ising model place an overall minus sign before the interaction or field terms.\n\nThe equivalence explains why QUBO is used in quantum annealing and other Ising-based optimization systems. It also allows methods developed for statistical physics to be applied to binary optimization. The equivalence is mathematical; by itself, it implies neither an efficient algorithm nor a quantum computational advantage."
    },
    {
      "heading": "Example: maximum cut",
      "text": "The maximum-cut problem provides a direct QUBO formulation without auxiliary variables. Let an undirected graph have edge weights \\(w_{ij}\\), and let \\(x_i\\) indicate the side of a partition containing vertex \\(i\\).\n\nAn edge crosses the partition exactly when its endpoint variables differ. Its cut indicator is\n\n\\[x_i+x_j-2x_i x_j.\\]\n\nThe total cut weight is therefore\n\n\\[W(x)=\\sum_{\\{i,j\\}\\in E} w_{ij}(x_i+x_j-2x_i x_j).\\]\n\nMaximizing \\(W(x)\\) is equivalent to minimizing the QUBO\n\n\\[f(x)= -\\sum_{\\{i,j\\}\\in E}w_{ij}(x_i+x_j) + 2\\sum_{\\{i,j\\}\\in E}w_{ij}x_i x_j.\\]\n\nComplementing every bit leaves the cut unchanged, so assignments \\(x\\) and \\(1-x\\) represent the same partition with its two sides exchanged. Such symmetries can sometimes be removed by fixing one variable."
    },
    {
      "heading": "Computational complexity and special cases",
      "text": "General QUBO is NP-hard, as follows, for example, from its ability to express maximum cut. With rational coefficients represented in binary, the decision problem of whether an assignment has objective value at most a given rational threshold is NP-complete.\n\nAn exhaustive search examines \\(2^n\\) assignments. Practical algorithms may perform much better on particular instances, but no polynomial-time algorithm is known for arbitrary QUBO.\n\nThe interaction graph has one vertex per variable and an edge wherever \\(b_{ij}\\ne0\\). Its structure is often more informative than variable count alone:\n\n- If there are no interactions, each variable can be optimized independently.\n- Disconnected components can be solved separately.\n- Graphs with bounded treewidth admit dynamic-programming methods whose exponential dependence is confined to the width rather than the total number of variables.\n- A submodular quadratic objective, characterized in this representation by \\(b_{ij}\\leq0\\) for every pair, can be minimized using a suitable minimum-cut construction.\n\nDiscrete difficulty should not be inferred solely from whether a displayed coefficient matrix is positive semidefinite. Since \\(x_i^2-x_i=0\\) on the binary domain, adding\n\n\\[\\lambda\\sum_i(x_i^2-x_i)\\]\n\nleaves every binary objective value unchanged while modifying the curvature of its continuous extension. In particular, a convex continuous extension does not remove the difficulty imposed by binary decisions."
    },
    {
      "heading": "Solution methods",
      "text": "Exact algorithms\n\nExact methods include enumeration, branch and bound, cutting-plane methods, and algorithms based on graph structure. They seek a global optimum and can, when completed, provide a certificate of optimality.\n\nA QUBO can also be converted into a mixed-integer linear formulation. For each quadratic product, introduce \\(y_{ij}=x_i x_j\\) and impose\n\n\\[y_{ij}\\leq x_i,\\qquad y_{ij}\\leq x_j,\\qquad y_{ij}\\geq x_i+x_j-1,\\qquad y_{ij}\\geq0.\\]\n\nWhen \\(x_i\\) and \\(x_j\\) are binary, these inequalities enforce the product relation even if \\(y_{ij}\\) is continuous. The objective then becomes linear, allowing mixed-integer linear programming techniques to be used.\n\nHeuristic methods\n\nCommon heuristics include local search, tabu search, simulated annealing, population-based search, and hybrid decomposition methods. They seek good assignments without generally proving global optimality.\n\nFor the coefficient representation above, flipping variable \\(x_i\\) changes the objective by\n\n\\[\\Delta_i = (1-2x_i) \\left( a_i+\\sum_{j\\ne i} b_{\\min(i,j),\\max(i,j)}x_j \\right).\\]\n\nThis expression supports efficient incremental evaluation of candidate moves. A state for which no single flip improves the objective is a one-flip local minimum, but several coordinated flips may still improve it.\n\nRelaxations and specialized hardware\n\nContinuous relaxations replace binary restrictions with a larger domain and provide bounds or guidance for search. Approaches include linear, convex quadratic, and semidefinite programming relaxations.\n\nQuantum annealers and other specialized devices attempt to find low-energy states of an encoded model. Limited connectivity may require additional physical variables to represent a single logical variable or interaction structure. Coefficient precision, noise, embedding overhead, and postprocessing can all affect the result.\n\nConsequently, optimization performance is evaluated using solution quality, feasibility, runtime, success probability, and any available bounds—not simply whether a device accepts a QUBO input."
    },
    {
      "heading": "Development and applications",
      "text": "QUBO developed from classical work on zero–one quadratic programming and discrete optimization. Connections with spin systems and energy-based neural networks broadened its use, while quantum annealing increased interest in QUBO as a shared input format for optimization hardware.\n\nRepresentative applications include:\n\n- Scheduling and assignment: binary indicators encode allocation choices, with penalties enforcing exclusivity and capacity conditions.\n- Graph optimization: cuts, independent sets, cliques, and coloring can be expressed directly or through penalties.\n- Routing: formulations of the traveling salesman problem often use variables indicating which city occupies each tour position.\n- Machine learning: feature selection, clustering, and some discrete model-selection tasks admit quadratic binary formulations.\n- Portfolio selection: binary decisions represent inclusion or discrete allocation choices, while quadratic terms can express pairwise contributions derived from a covariance matrix.\n\nA QUBO representation is not necessarily the most compact or effective formulation of an application. Penalties may create dense interaction graphs, integer encodings may add many variables, and quadratization may enlarge coefficient ranges. Comparisons with alternative formulations therefore depend on the complete modeling and solution process, including construction, embedding where applicable, feasibility checking, and verification of solution quality."
    }
  ],
  "links": [
    "mathematical-optimization",
    "integer-programming",
    "ising-model",
    "matrix",
    "quadratic-form",
    "objective-function",
    "quantum-annealing",
    "np-hardness",
    "branch-and-bound",
    "linear-programming",
    "simulated-annealing",
    "semidefinite-programming",
    "traveling-salesman-problem",
    "machine-learning",
    "covariance-matrix"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}