AAn Optimal Constraint for QUBO Models
Clark Alexander ∗ email: the authorJanuary 11, 2021 Abstract
A quadratic binary unconstrained optimization model, hereafter QUBO,by definition is unconstrained. This, however, is not ideal if one needs toselect a model containing only a fixed size binary vector. In this workwe show how to add a constraint to a QUBO to force a particular sizesolution.
As the industry of quantum computing has been making inroads in applica-tions, the first set of problems which are in-line for fast, efficient “solutions” arecombinatorial optimization problems [CQ1, DwaveI, STB] As of this writing,the technique which appears to be furthest along is quantum annealing. This isan appealing technique as it allows one with a reasonably powerful laptop anda high level language compiler to benchmark the quantum annealing process.Generally speaking, the most-straightforward way to apply quantum annealingis to pose one’s problem in terms of a quadratic form. In particular, if one canpose a problem in terms of a solution which marks a set of elements as “in” or“out” then quantum annealing works well. Additionally, there are many clas-sical, heuristic, and probabilistic techniques which one can use to benchmark aquantum annealer; for example, simulated annealing, genetic algorithms, simu-lated bifurcation machines, branch-and-bound, etc. [DA, GKD, SBM, EKU].However, quadratic forms with “in”/“out” solutions require binary vectorsand depending on the particular type of quadratic form given, one can expect avery specific set of solutions to show up. For example, if one provides a positivedefinite matrix as a quadratic form then the known minimum is the zero vector.There is no need to apply probabilistic techniques, all non zero vectors will givepositive solutions and in searching for a minimum, we cannot go lower than zero.Additionally if the quadratic form is a well known random matrix, a Gaussianensemble, for instance, then the best solution will contain roughly half “in” andhalf “out.” These solutions are expected, but maybe not completely useful. ∗ Chicago Quantum a r X i v : . [ m a t h . O C ] J a n ecently, there has been a push for using quadratic forms in financial op-timization [CQ3, CQ2, MLO] One common strategy is to maximize expectedreturn while minimizing volatility. Volatility is, however, covariance, which ispositive semi-definite. In reality covariance is positive definite with real data.Thus trying to minimize a positive definite matrix reveals the “mathematicallycorrect” solution of not investing as that reduces volatility to zero. However,for an investor, this is not a useful solution. Perhaps an investor wants to investin an “optimal” set of 15 assets. An unconstrained problem will never producesuch an answer, thus one wishes to add a constraint in a somewhat natural wayso that a set of 15 assets becomes visible. A quadratic unconstrained binary optimization (hereafter QUBO) can be thoughtof as a square matrix. While this is a slight abuse of notation, there should notbe too much confusion as the actual optimization involves finding a vector forthe particular matrix. So where it is clear we will refer to the matrix and theoptimization problem both as QUBO.
Definition 1.
Given a real symmetric matrix A ∈ R N × N and a real vector B ∈ R N , a quadratic unconstrained binary optimization is a problem in whichone seeks the vector x ∈ { , } N so that Q ( A, B ) = x t Ax + B · x (1)achieves a minimum value. That ismin x x t Ax + B · x (2)It is also common to expect A to be upper or lower triangular and traceless.However by considering ( A + A t ) / A (or a small variantthereof) as a Hamiltonian in an Ising model which is the current technologyused in quantum annealing and simulated bifurcation machines. This also al-lows one the ability to easily translate between quantum, digital, and simulatedannealing for bench marking purposes. Lemma 2.
While considering a binary vector x ∈ { , } N one can reduce aQUBO into a single matrix (which need not be traceless). That is one canreduce x t Ax + B · x → x t ˜ Ax where ˜ A = A + diag ( B ) (3) with diag ( B ) being a diagonal matrix with diag ( B ) ij = B i δ ij roof. Since each x i is 0 or 1 we trivially have x i = x i . This reveals B · x = x t diag( B ) x Which allows us to factor x t on the left and x on the right x t Ax + B · x = x t Ax + x t diag( B ) x = x t ( A + diag( B )) x = x t ˜ Ax (4)From here forward we shall simply refer to ˜ A as A .In quantum annealing, the vector x i ∈ { , } is exchanged for a vector z i ∈ {− , } with the simple transformation z i = 2 x i − A and also gives one an offset vector where x t Ax = z t Jz + C · z + const (5)The matrix J = A/ C are calculated by a simple change ofvariables. For the purposes of this article we will remain in the space x i ∈ { , } and only mention that can transform when necessary. Given our model min x x t Ax with A a real symmetric matrix of size N × N we wish to add a constraintmatrix C to A so that our vector x has norm (cid:107) x (cid:107) = m ; or more simply the L norm is M , (cid:107) x (cid:107) = M for some 1 ≤ M ≤ N Thus our new model becomesmin x x t ( A + C ) x If we pass this quadratic form to a solver (whether a simulated annealer orquantum annealing computer or a simulated bifurcation machine) we can expectthat a “good” solver will produce a vector x of the required size. Theorem 3.
Let A be a real symmetric matrix of size N × N . Then the additionof matrix C = αJ N + βI N (6) to A will produce a QUBO with optimal vector x of size (cid:107) x (cid:107) = M when M = − β α (7) In particular there is a line of solutions. The larger α the stronger the pulltoward (cid:107) x (cid:107) = M . roof. Since we wish to minimize x t Ax where | x | = M we consider the additionof the matrix C = αJ N + βI N where J N is the N × N matrix of all ones and I N is the N × N identity matrix.This reduces our calculation tomin x x t ( A + C ) x = ⇒ min | x | = M x t Cx (8)Since J N and I N yield straightforward multiplications we have x t ( αJ N + βI N ) x = αM + βM (9)Now we see the results directly. We choose α and β to minimize x t Cx by M = − β α (10)Noting that α > α < C ( α ) = α ( J N − M I N ) (11)We can also see this as C ( α ) = α − M . . .
11 1 − M . . .
11 1 1 − M . . . . . . − M Example . Let’s take a quick look at how to simulate this in a modern com-puting language. We’ll produce a random symmetric matrix of size N × N andrequire a solution of size M where M is significantly different from N/ x t Ax , (b) the solution vector. Algorithm 1
Picking M asets; Julia/Octave style A = randn ( N, N ) A = ( A + A t ) / C ( α ) = α ∗ (ones( N, N ) − M ∗ eye( N ))cost, solution = anneal( A + C (0 . N = 30 , M = 8 we have a his-tograms for α ∈ { , . , . , . , , , } . When α = 0 we have the uncon-strained model, where ones expects a solution of size 15 ± √
30 so we expectbetween 10 and 20 as the global best solution. We are running our simulatedannealer cooling very quickly and only a few trials per degree so as to show theefficacy of the constraint. We can see the pull toward 8 assets as α increases. (a) Unconstrained (b) α = . α = 0 . α = 0 . Figure 1: Histograms with increasing constraintsThe final frame in 2 is a stacked histogram showing all 7 histograms together.We see the density of selections increasing as we move toward 8. Looking all theway back to the first figure in 1 we see that the global minimum is likely largerthan 15, most likely at 17. If we were to have a larger Gaussian ensemble or onein which the global minimum is at or below N/ Example . For our second example, we’ll use a positive semi-definite matrix ofsize 30 ×
30 and again apply constraints to select 8 assets.It is important to note that the simulated annealer on the author’s computertends to avoid picking exactly zero assets. Thus in our first figure in 3 we seea split between zero and one, even though we know the mathematically soundanswer is exactly zero. 5 a) α = 1 (b) α = 2(c) α = 10 (d) α = 0 . Figure 2: Histograms with increasing constraintsWe see the efficacy of the constraint here much more prominently. Simulatedannealers are not necessary with such small scale QUBO as 30 ×
30 as a bruteforce solution can be obtained in a matter of minutes. Additionally, small shiftsin small QUBO models don’t have such a large effect. If one were to repeatthese examples with N = 5000 and M = 50 the effects of α = 0 . α as small as 0 . α = 0 . α = 2 andabove we select 8 assets without fail. Thus is the last figure in 4 we see anintense density at 8 assets. With all other assets smaller. This is consistentwith the first example in which 8 assets becomes the minimum number of assetschosen as the unconstrained solution has greater than 8 assets, in this case theunconstrained solution has fewer. References [CQ1] Cohen, J., Alexander, C.,
Picking Efficient Portfolios from 3,171 USCommon Stocks with New Quantum and Classical Solvers https://arxiv.org/abs/2011.01308 a) Unconstrained (b) α = . α = 0 . α = 0 . Figure 3: Histograms with increasing constraints[CQ2] Cohen, J., Khan, A., Alexander, C.,
Portfolio Optimization of 60 StocksUsing Classical and Quantum Algorithms https://arxiv.org/abs/2008.08669 [CQ3] Cohen, J., Khan, A., Alexander, C.,
Portfolio Optimization of 40Stocks Using the DWave Quantum Annealer https://arxiv.org/abs/2007.01430 [DA] Fujitsu Research Lab,
Quantum Future - Quantum Present https://sp.ts.fujitsu.com/dmsp/Publications/public/wp-da-overview-ww-en.pdf [DwaveI] https://docs.dwavesys.com/docs/latest/c_gs_3.html [EKU] Eren,Y., K¨u¸c¨ukdemiral, ˙I, ¨Usto˘glu1, ˙I,
Optimization in RenewableEnergy Systems, Chapter 2 - Introduction to Optimization , [GKD] Glover, F., Kochenberger, G., Du, Y., A Tutorial on Formulating andUsing QUBO models , 2019 https://arxiv.org/pdf/1811.11538.pdf [MLO] Miguel, S., Lizaso, E., Orus, R.,
Use Cases of Quantum Optimizationfor Finance https://arxiv.org/abs/2010.01312 a) α = 1 (b) α = 2(c) α = 10 (d) α = 0 . Figure 4: Histograms with increasing constraints[SBM] Goto, H., Tatsumura, K., & Dixon, A.R.(2019) Combinatorial optimiza-tion by simulating adiabaticbifurcations in nonlinear Hamiltonian systems,Science Advances, 5(4), DOI:10.1126/sciadv.aav2372[STB] S¸eker O., Tanoumand N., Bodur M.,
Digital Annealer for quadraticunconstrained binary optimization: a comparative performance analy-sis https://arxiv.org/abs/2012.12264 [Wiki] https://en.wikipedia.org/wiki/Quadratic_unconstrained_binary_optimizationhttps://en.wikipedia.org/wiki/Quadratic_unconstrained_binary_optimization