A Polynomial-Time Algorithm for Unconstrained Binary Quadratic
Total Page:16
File Type:pdf, Size:1020Kb
A Polynomial-Time Algorithm for Unconstrained Binary Quadratic Optimization Juan Ignacio Mulero-Mart´ınez Department of Automatic Control, Electrical Engineering and Electronic Technology, Technical University of Cartagena, Campus Muralla del Mar 30203, Spain. E-mail: [email protected] Abstract In this paper, an exact algorithm in polynomial time is developed to solve unre- 15 stricted binary quadratic programs. The computational complexity is O n 2 , although very conservative, it is sufficient to prove that this minimization prob- lem is in the complexity class P . The implementation aspects are also described in detail with a special emphasis on the transformation of the quadratic program into a linear program that can be solved in polynomial time. The algorithm was implemented in MATLAB and checked by generating five million matrices of arbitrary dimensions up to 30 with random entries in the range [−50, 50]. All the experiments carried out have revealed that the method works correctly. Keywords: Unconstrained binary quadratic programming, global optimization, complexity measures, and classes 1. Introduction The unconstrained binary quadratic programming (UBQP) problem occurs in many computer vision, image processing, and pattern recognition applica- tions, including but not limited to image segmentation/pixel labeling, image registration/matching, image denoising/restoration, partitioning of graphs, data arXiv:2005.07030v6 [cs.DS] 30 Jan 2021 clustering, and data classification. Much of the algorithmic progress at UBQP has been due to the computer vision research community, [1], [2], [3], [4]. For example, the objective functions in the UBQP problem are a class of energy functions that are widely useful and have had very striking success in computer vision (see [5] for a recent survey). The UBQP problem dates back to the 1960s where pseudo-boolean functions and binary quadratic optimization were introduced by Hammer and Rudeanu, [6]. Since then, it has become an active research area in Discrete Mathematics and Complexity Theory (surveys in [7] and in [8], give a good account of this topic). Currently, this problem has become a major problem in recent years due to the discovery that UBQP represents a unifying framework for a very wide variety Preprint submitted to ArXiv February 2, 2021 of combinatorial optimization problems. In particular, as pointed out in [9] the UBQP model includes the following important combinatorial optimization prob- lems: maximum cut problems, maximum, click problems, maximum indepen- dent set problems, graph coloring problems, satisfiability problems, quadratic knapsack problems, etc. The UBQP problem is generally NP-Hard, [10] (you can use the UBQP problem to optimize the number of constraints satisfied on a 0/1 integer Pro- gramming instance, one of the Karp’s 21 NP-complete problems). Only a few special cases are solvable in polynomial time. In fact, the problem of deter- mining local minima of pseudo-boolean functions is found in the PLS-complete class (the class of hardest polynomial local search problems), [10], [11], and in general, local search problems are found in the EXP class, [12], [13], [14], [15], [16], [17]. Global optimization methods are NP-complete. To obtain a global optimal solution by exact methods (generally based on branch and bound strategies), the following techniques should be highlighted: the combinatorial variable elimination algorithm1, [6], [18], [19]; the continuous relaxation with linearization (where the requirement of binary variables is replaced by a weaker restriction of membership to the closed interval [0, 1]), [20], [21]; the posiform transformations, [22], [23]; the conflict graphs (the connection between posi- form minimization problem and the maximum weighted stability), [24], [25], [26], [27], [28], [29]; the linearization strategies such as standard linearization (consisting in transforming the minimization problem into an equivalent linear 0–1 programming problem), [30], [31], [32], [33], Glover method, [34], improved linearization strategy, [35], (the reader is referred to [36] for a recent comparison of these methods); semidefinite-based solvers, [37] (and the references therein), et cetera. The reader is referred to the survey [38] for a detailed description of these techniques until 2014. Many researchers have extensively studied the UBQP problem, however, up to date nobody has succeeded in developing an algorithm running in polynomial time. We claim, and this is the main contribution of this work, that UBQP is in the complexity class P . The main idea is to transform the UBQP problem into a linear programming (LP) problem, that is solved in polynomial time. We guar- antee that the minimum of the LP problem is also the minimum of the UBQP problem. We also provide the implementation details of the algorithm, moti- vated by the following aspects that any work on discrete optimization should present: (i) Describe in detail the algorithms to be able to reproduce the experiments and even improve them in the future. (ii) Providing the source code so that it is openly available to the scientific community: Interestingly, a recent study by Dunning has revealed that only 4% of papers on heuristic methods provide the source code, [39]. 1This algorithm is in the class EXP and only runs in polynomial time for pseudo-Boolean functions associated with graphs of bounded tree-width. 2 (iii) Establish random test problems with an arbitrary input size. Here it is important to indicate the ranges of the parameters in the UBQP problem. This procedure has been implemented in MATLAB (source code is provided as supplementary material) and checked with five million random matrices up to dimension 30, with entries in the range [−50, 50]. An advantage of this algorithm is its modularity concerning the dimension of the problem: the set of linear constraints of the equivalent linear programming problem is fixed for a constant arbitrary dimension regardless of the objective function of the quadratic problem. Finally, we highlight that the objective of the work is not the speed of resolution of the problem but simply to show that the UBQP problem can be solved in polynomial time. Future works will analyze large-scale UBQP problems as well as the design of more efficient polynomial- time algorithms. The paper is organized as follows: Section 2 describes the relaxation process for the UBQP problem. Next in section 3, the main result about the equiva- lence of the UBQP problem with a linear programming problem is addressed. For simplicity in the exposition, the case n = 3 is presented first and then it is generalized for n > 3. The computational complexity in both time and space is analyzed in section 4. The implementation features about primary variables, transformation of the objective function, and convexity and consistency con- straints are treated in section 5. The design of the experiment for testing the solution is presented in section 6. Finally, section 7 is dedicated to discussing the main aspects presented in this work as well as possible future works. 2. Background Let B = {0, 1} and f : Bn → R be a quadratic objective function defined as f (x) = xT Qx + bT x with Q = QT ∈ Rn×n, diag (Q) = (0,..., 0) and b ∈ Rn. The UBQP problem is defined as follows: UBQP: minx∈B f (x). The objective function f is usually called a quadratic pseudo-boolean func- tion, i.e. multilinear polynomials in binary unknowns. These functions repre- sent a class of energy functions that are widely useful and have had very striking success in computer vision (see [5] for a recent survey). n This problem can naturally be extended to the solid hypercube Hn = [0, 1] spanned by Bn. The extension of the pseudo-Boolean function f : Bn → R is a pol function f : Hn → R that coincides with f at the vertices of Hn. Rosenberg discovered an attractive feature regarding the multilinear polynomial extension pol pol f , [40]: the minimum of f is always attained at a vertex of Hn, and hence, that this minimum coincides with the minimum of f. From this, our optimization problem is reduced to the following relaxed quadratic problem: (Pn): minx∈Hn f (x). 3 3. Main Result In this section, we prove that Problem (P) can be reduced to a Linear Pro- gramming Problem. 3.1. A Simple Case We begin with the simple case of minimization of a quadratic form f (x) in the cube H3. Here the minimization problem is stated as follows: (P3): minx∈H3 f (x). 3 1 3 Associated with the cube H3 we have a map φ : H3 → [0, 2] × 0, 2 defined as x1+2x1x2+x2 2 x1+2x1x3+x3 2 x2+2x2x3+x3 φ (x , x , x )= − 2 . 1 2 3 x1 2x1x2+x2 − 2 x1 2x1x3+x3 − 2 x2 2x2x3+x3 2 An important fact is that the cube H3 can be expressed as a convex hull of a finite set of vertices V = {0, 1}3. For simplicity, we enumerate the vertices in V as p1,p2,...,p8 so that H3 can be written as convex combinations of those vertices, i.e. H3 = conv (V ), where 8 8 conv (V )= αipi : ai ≥ 0, αi =1 . (i=1 i=1 ) X X 6 6 The map φ is a composition of the maps α : H3 → [0, 1] and β : [0, 1] → 3 1 3 [0, 2] × 0, 2 defined as α (x) = (x1, x1x2, x1x3, x2, x2x3, x3) , (1) 6 β (y)= E3y for every y ∈ [0, 1] , (2) where E3 is 12 0100 10 2001 1 00 0121 E = . (3) 3 2 1 −20100 1 0 −20 0 1 00 01 −2 1 More specifically φ = β ◦ α. As a summary, the maps φ, α, and β are represented in the diagram of Figure 1. The map φ is composition of α with β, i.e. φ = β ◦ α, where α can be T T built from H3 as a selection of the Kronecker productx ˜ ⊗ x˜ withx ˜ = 1, x 4 x1+2x1x2+x2 x1+2x1x3+x3 x2+2x2x3+x3 x1−2x1x2+x2 x1−2x1x3+x3 x2−2x2x3+x3 w = φ(x)= 2 , 2 , 2 , 2 , 2 , 2 w x u φ 12 u13 β(y)= E3y C H n 3 u β(α(x)) = φ(x)= 23 v12 y +2y + y v13 1 2 4 α y +2y + y β v23 1 3 6 1 y4 +2y5 + y6 2 = β(y) y1 − 2y2 + y4 y1 − 2y3 + y6 α(H ) y 3 y4 − 2y5 + y6 α(x) = (x1, x1x2, x1x3, x2, x2x3 , x3) Figure 1: Diagram for the maps φ, α, and β.