Huge Unimodular N-Fold Programs
aa r X i v : . [ m a t h . O C ] J a n Huge Unimodular N-Fold Programs
Shmuel Onn ∗ Pauline Sarrabezolles † Abstract
Optimization over l × m × n integer 3-way tables with given line-sums isNP-hard already for fixed l = 3, but is polynomial time solvable with both l, m fixed. In the huge version of the problem, the variable dimension n is encodedin binary , with t layer types . It was recently shown that the huge problem canbe solved in polynomial time for fixed t , and the complexity of the problemfor variable t was raised as an open problem. Here we solve this problem andshow that the huge table problem can be solved in polynomial time even whenthe number t of types is variable . The complexity of the problem over 4-waytables with variable t remains open. Our treatment goes through the moregeneral class of huge n -fold integer programming problems . We show that hugeinteger programs over n -fold products of totally unimodular matrices can besolved in polynomial time even when the number t of brick types is variable. Consider the following optimization problem over 3-way tables with given line-sums:min { wx : x ∈ Z l × m × n + , X i x i,j,k = e j,k , X j x i,j,k = f i,k , X k x i,j,k = g i,j } . It is NP-hard already for l = 3, see [3]. Moreover, every bounded integer programcan be isomorphically represented in polynomial time for some m and n as some3 × m × n table problem, see [4]. However, when both l, m are fixed, it is solvable inpolynomial time [2, 8, 10], and in fact, in time which is cubic in n and linear in thebinary encoding of w, e, f, g , see [7]. Assume throughout then that l, m are fixed,and regard each table as a tuple x = ( x , . . . , x n ) consisting of n many l × m layers .The problem is called huge if the variable number n of layers is encoded in binary .We are then given t types of layers, where each type k has its cost matrix w k ∈ Z l × m ,column-sums vector e k ∈ Z m + , and row-sums vector f k ∈ Z l + . In addition, we are ∗ Technion - Israel Institute of Technology, Haifa, Israel. Email: [email protected] † Ecole des Ponts, Paris, and Technion, Haifa. Email: [email protected] n , . . . , n t , n with n + · · · + n t = n , all encoded in binary.A feasible table x = ( x , . . . , x n ) then must have first n layers of type 1, next n layers of type 2, and so on, with last n t layers of type t . The special case of t = 1 isthe case of symmetric tables, where all layers have the same cost, row and columnsums, and the classical (non-huge) table problem occurs as the special case of t = n and n = · · · = n t = 1. Note that for each k , the set of possible layers of type k is ( z ∈ Z l × m + : X i z i,j = e kj , X j z i,j = f ki ) , and may have cardinality which is exponential in the binary encoding of e k , f k . Soit is not off hand clear how to even write down a single table, let alone optimize.The huge table problem was recently considered in [11], where it was shown,combining results of [2, 8, 10] on Graver bases and results of [5, 6] on integer cones,that it can be solved in polynomial time for fixed t . The complexity of the problemfor variable t was raised as an open problem. Here we solve this problem and showthat the huge table problem can be solved in polynomial time even when t is variable. Theorem 1.1
The huge -way table problem with a variable number t of types can besolved in time which is polynomial in t and in the binary encoding of w k , e k , f k , g, n k . It was moreover shown in [11] that the huge d -table problem over m ×· · · m d − × n tables with m , . . . m d − fixed and n variable can also be solved in polynomial timefor any fixed number t of types. Interestingly, we do not know whether Theorem 1.1could be extended to this more general situation, and the complexity of the huge d -way table problem with variable t remains open, already for 3 × × × n tables.Theorem 1.1 follows from broader results which we proceed to describe. The classof n -fold integer programming problems is defined as follows. The n -fold product ofan s × d matrix A is the following ( d + sn ) × ( dn ) matrix, with I the d × d identity, A [ n ] := I I · · · IA · · · A · · · · · · A . The classical n -fold integer programming problem is then the following:min (cid:8) wx : x ∈ Z dn , A [ n ] x = b , l ≤ x ≤ u (cid:9) , (1)where w ∈ Z dn , b ∈ Z d + sn , and l, u ∈ Z dn ∞ with Z ∞ := Z ⊎ {±∞} . For instance,optimization over multiway tables is an n -fold program, as is explained later on.Our starting point is the following result on classical n -fold integer programming,established in [2, 8], building on results of [1, 9, 12]. See the monograph [10] for adetailed treatment of the theory and applications of n -fold integer programming. Proposition 1.2
For fixed matrix A , the classical n -fold integer programming prob-lem (1) can be solved in time polynomial in n and the binary encoding of w, l, u, b . This result holds more generally if the identity I in the definition of A [ n ] is replacedby another fixed matrix B . Moreover, recently, in [7], it was shown that the problemcan be solved in time which is cubic in n and linear in the binary encoding of w, b, l, u .The vector ingredients of an n -fold integer program are naturally arranged in bricks , where w = ( w , . . . , w n ) with w i ∈ Z d for i = 1 , . . . , n , and likewise for l, u ,and where b = ( b , b , . . . , b n ) with b ∈ Z d and b i ∈ Z s for i = 1 , . . . , n . Call an n -fold integer program huge if n is encoded in binary . More precisely, we are nowgiven t types of bricks, where each type k = 1 , . . . , t has its cost w k ∈ Z d , lower andupper bounds l k , u k ∈ Z d , and right-hand side b k ∈ Z s . Also given are b ∈ Z d andpositive integers n , . . . , n t , n with n + · · · + n t = n , all encoded in binary. A feasiblepoint x = ( x , . . . , x n ) now must have first n bricks of type 1, next n bricks of type2, and so on, with last n t bricks of type t . Classical n -fold integer programmingoccurs as the special case of t = n and n = · · · = n t = 1, and symmetric n -foldinteger programming occurs as the special case of t = 1. We show the following. Theorem 1.3
Let A be a fixed totally unimodular matrix and consider the huge n -fold program over A with a variable number t of types. Then the optimization prob-lem can be solved in time polynomial in t and the binary encoding of w k , l k , u k , b k , n k . The rest of the article is organized as follows. In Section 2 we discuss the fea-sibility problem which is easier than the optimization problem and admits a moreefficient algorithm. In Section 3 we discuss the optimization problem, using theresults on feasibility. We conclude in Section 4 with further discussion of tables.
In this section we consider the feasibility problem for huge n -fold integer programs:is (cid:8) x ∈ Z dn : A [ n ] x = b , l ≤ x ≤ u (cid:9) nonempty ?We begin with the case of symmetric programs, with one type, so that t = 1,over an s × d totally unimodular matrix A . So the data here consists of the topright-hand side a ∈ Z d , and for all bricks the same lower and upper bounds l, u ∈ Z d ∞ and same right-hand side b ∈ Z s . Then the set in question can be written as ( x ∈ Z dn : n X i =1 x i = a , Ax i = b , l ≤ x i ≤ u , i = 1 , . . . , n ) . (2)We have the following lemma. Lemma 2.1
Let A be totally unimodular. Then the set in (2) is nonempty if andonly if Aa = nb and nl ≤ a ≤ nu , and this can be decided in time that is polynomialin the binary encoding of n, l, u, a, b , even when A is a variable part of the input.Proof. Suppose first that the set in (2) contains a feasible point x = ( x , . . . , x n ).Then Aa = A P ni =1 x i = P ni =1 Ax i = nb , and nl ≤ a = P ni =1 x i ≤ nu . For theconverse we use induction on n . Suppose a satisfies the conditions. If n = 1 then x := a is a feasible point in (2). Suppose now n ≥
2. Consider the system l ≤ y ≤ u , Ay = b , ( n − l ≤ a − y ≤ ( n − u in the variable vector y . Then y = n a is a real solution to this system, and therefore,since A is totally unimodular, there is also an integer solution x n to this system. Inparticular, Ax n = b and l ≤ x n ≤ u . Let ¯ a := a − x n . Then A ¯ a = A ( a − x n ) = ( n − b and ( n − l ≤ ¯ a = a − x n ≤ ( n − u . It therefore now follows by induction thatthere is an integer solution ( x , . . . , x n − ) to the ( n − ( x ∈ Z d ( n − : n − X i =1 x i = ¯ a , Ax i = b , l ≤ x i ≤ u , i = 1 , . . . , n − ) . Then P ni =1 x i = ¯ a + x n = a and therefore x := ( x , . . . , x n − , x n ) is a feasible pointin (2). The statement about the computational complexity is obvious.We proceed with the general case of t types. So the data now consists of b ∈ Z d and for k = 1 , . . . , t , lower and upper bounds l k , u k ∈ Z d ∞ , right-hand side b k ∈ Z s ,and positive integer n k , with n + · · · + n t = n . We denote by I ⊎· · ·⊎ I t = { , . . . , n } the natural partition with | I k | = n k . So the set in question can be now written as ( x ∈ Z dn : n X i =1 x i = b , Ax i = b k , l k ≤ x i ≤ u k , k = 1 , . . . , t , i ∈ I k ) . (3)We have the following theorem asserting that when A is totally unimodular thefeasibility problem is decidable in polynomial time even if the number t of typesis variable. The algorithm underlying the proof uses only classical n -fold integerprogramming and avoids the heavy results of [6] on integer cones used in [11]. Theorem 2.2
Let A be a fixed totally unimodular matrix and consider the huge n -fold program over A with variable number t of types. Then it is decidable in timepolynomial in t and the binary encoding of l k , u k , b k , n k , if the set in (3) is nonempty. Proof.
Consider the following set of points of a classical t -fold integer program: ( y ∈ Z dt : t X k =1 y k = b , Ay k = n k b k , n k l k ≤ y k ≤ n k u k , k = 1 , . . . , t ) . (4)We claim that (3) is nonempty if and only if (4) is nonempty, which can be decidedwithin the claimed time complexity by Proposition 1.2 on classical n -fold theory.So it remains to prove the claim. First, suppose x is in (3). Define y by setting y k := P i ∈ I k x i for k = 1 , . . . , t . Then we have P tk =1 y k = P ni =1 x i = b , Ay k = A P i ∈ I k x i = n k b k , and n k l k ≤ y k = P i ∈ I k x i ≤ n k u k , so y is in (4). Conversely,suppose y is in (4). For k = 1 , . . . , t consider the symmetric n k -fold program ( ( x i : i ∈ I k ) ∈ Z dn k : X i ∈ I k x i = y k , Ax i = b k , l k ≤ x i ≤ u k , i ∈ I k ) . Since y is in (4) we have that Ay k = n k b k and n k l k ≤ y k ≤ n k u k . Therefore,by Lemma 2.1, this program is feasible and has a solution ( x i : i ∈ I k ). Let x = ( x , . . . , x n ) be obtained by combining the solutions of these t programs. Thenwe have P ni =1 x i = P tk =1 y k = b and Ax i = b k and l k ≤ x i ≤ u k for k = 1 , . . . , t and i ∈ I k , so x is in (3). This completes the proof of the claim and the theorem. In this section we consider the optimization problem for huge n -fold programs:min ( t X k =1 X i ∈ I k w k x i : x ∈ Z dn , n X i =1 x i = b , Ax i = b k , l k ≤ x i ≤ u k , k = 1 , . . . , t, i ∈ I k ) . The optimization problem is harder than the feasibility problem in that we needto actually produce an optimal solution if one exists. Since the problem is huge,meaning that n is encoded in binary, we cannot explicitly even write down a singlepoint x ∈ Z dn in polynomial time. But it turns out that we can present x compactlyas follows. For k = 1 , . . . , t the set of all possible bricks of type k is the following S k := { z ∈ Z d : Az = b k , l k ≤ z ≤ u k } . We assume for simplicity that S k is finite for all k , which is the case in most ap-plications, such as in multiway table problems. Let λ k := ( λ kz : z ∈ S k ) be anonnegative integer tuple with entries indexed by points of S k . Each feasible point x = ( x , . . . , x n ) gives rise to λ , . . . , λ t satisfying P { λ kz : z ∈ S k } = n k , where λ kz is the number of bricks of x of type k which are equal to z . Let the support of λ k be supp( λ k ) := { z ∈ S k : λ kz = 0 } . Then a compact presentation of x consistsof the restrictions of λ k to supp( λ k ) for all k . While the cardinality of S k may beexponential in the binary encoding of the data b k , l k , u k , it turns out that a compactpresentation of polynomial size always exists. The following theorem was shown in[11] using the recent computationally heavy algorithm of [6] which builds on [5]. Proposition 3.1
For fixed d and t , the huge n -fold integer optimization problemwith t types, over an s × d matrix A which is part of the input, can be solved in poly-nomial time. That is, in time polynomial in the binary encoding of A, l k , u k , b k , n k ,it can either be asserted that the problem is infeasible, or a compact presentation λ , . . . , λ t of an optimal solution with | supp( λ k ) | ≤ d for k = 1 , . . . , t be computed. We now show that for a totally unimodular matrix, we can solve the huge problemeven for variable t , extending both the above result and classical n -fold theory. Theorem 1.3
Let A be a fixed totally unimodular matrix and consider the huge n -fold program over A with a variable number t of types. Then the optimization prob-lem can be solved in time polynomial in t and the binary encoding of w k , l k , u k , b k , n k .Proof. Consider the following classical t -fold integer optimization problem:min ( t X k =1 w k y k : y ∈ Z dt , t X k =1 y k = b , Ay k = n k b k , n k l k ≤ y k ≤ n k u k , k = 1 , . . . , t ) . By Proposition 1.2 on classical n -fold theory we can either assert the problem isinfeasible, or obtain an optimal solution y , within the claimed time complexity. Asshown in the proof of Theorem 2.2, if this problem is infeasible, then so is the originalprogram, and we are done. So assume we have obtained an optimal solution y .For k = 1 , . . . , t consider the symmetric n k -fold programmin (X i ∈ I k w k x i : ( x i : i ∈ I k ) ∈ Z dn k , X i ∈ I k x i = y k , Ax i = b k , l k ≤ x i ≤ u k , i ∈ I k ) . As shown in the proof of Theorem 2.2, this program is feasible. Since this is a hugesymmetric program, that is, with a single type, by Proposition 3.1 we can computein polynomial time a compact presentation λ k with | supp( λ k ) | ≤ d of an optimalsolution ( x i : i ∈ I k ) ∈ Z dn k . (In fact, any point in that program has the sameobjective function value P i ∈ I k w k x i = w k y k and is optimal to that program.) Then λ , . . . , λ t obtained from all these programs provide a compact presentation of apoint x = ( x , . . . , x n ) feasible in the original program. We claim this x is optimal.Suppose indirectly there is a better point ¯ x and define ¯ y by ¯ y k = P i ∈ I k ¯ x i for all k .Then we have t X k =1 w k ¯ y k = t X k =1 X i ∈ I k w k ¯ x i < t X k =1 X i ∈ I k w k x i = t X k =1 w k y k , contradicting the optimality of y in the t -fold program. So indeed λ , . . . , λ t providea compact presentation of an optimal solution of the given huge n -fold program.We make the following remark. The algorithm of Theorem 2.2 for the feasibilityproblem involves only one application of the classical n -fold integer programmingalgorithm of Proposition 1.2. In contrast, the algorithm of Theorem 1.3 is muchheavier, and in addition to one application of classical n -fold integer programming,uses t times the algorithm of Proposition 3.1 for huge n -fold integer programmingwith one type, which in turn uses the heavy algorithm for integer cones of [6]. We now return to tables. Consider first 3-way l × m × n tables. Index each tableas x = ( x , . . . , x n ) with x i = ( x i , , . . . , x il,m ). Then the table problem is the n -foldprogram with matrix A [ n ] l,m with A l,m the vertex-edge incidence matrix of the bipartitegraph K l,m . Indeed, then P ni =1 x i = g provides the vertical line-sum equations, and A l,m x i = b k with b k = ( e k , f k ) provides the column and row sum equations for i ∈ I k .Since A l,m is totally unimodular, Theorem 1.3 implies our following claimed result. Theorem 1.1
The huge -way table problem with a variable number t of types can besolved in time which is polynomial in t and in the binary encoding of w k , e k , f k , g, n k .In particular, deciding if there is a huge table with variable number of types is in P. Let us continue with 4-way k × l × m × n tables. Index each table as x = ( x , . . . , x n ) with each x k an k × l × m layer. Then the table problem is the n -foldprogram with matrix A [ n ] where A = A [ m ] k,l . Now, unfortunately, for k, l, m ≥
3, thematrix A is not totally unimodular. Therefore, the results of the previous sectionsdo not apply, and we remain with the results of [11], which are as follows. Proposition 4.1
The huge -way table problem with fixed number t of types issolvable in time polynomial in the binary encoding of w k , n k and the line sums.Moreover, deciding if there is a huge table with t variable is in NP intersect coNP. The contrast between Theorem 1.1 and Proposition 4.1 motivates the following.
Open problem.
What is the complexity of deciding feasibility of huge 4-way tableswith a variable number of types ? In particular, is it in P for 3 × × × n tables ? Acknowledgments
The research of the first author was partially supported by a VPR Grant at theTechnion and by the Fund for the Promotion of Research at the Technion. Theresearch of the second author was partially supported by a Bourse d’Aide `a laMobilit´e Internationale from Universit´e Paris Est.
References [1] Aoki, S., Takemura, A.: Minimal basis for connected Markov chain over 3 × × K contingency tables with fixed two-dimensional marginals. Australian and NewZealand Journal of Statistics 45:229–249 (2003)[2] De Loera, J., Hemmecke, R., Onn, S., Weismantel, R.: N-fold integer program-ming. Discrete Optimization 5:231–241 (2008)[3] De Loera, J., Onn, S.: The complexity of three-way statistical tables. SIAMJournal on Computing 33:819–836 (2004)[4] De Loera, J., Onn, S.: All linear and integer programs are slim 3-way trans-portation programs. SIAM Journal on Optimization 17:806–821 (2006)[5] Eisenbrand, F., Shmonin, G.: Carath´eodory bounds for integer cones. Opera-tions Research Letters 34:564–568 (2006)[6] Goemans, M.X., Rothvoß, T.: Polynomiality for Bin Packing with a ConstantNumber of Item Types. Symposium on Discrete Algorithms 25:830–839 (2014)[7] Hemmecke, R., Onn, S., Romanchuk, L.: N-fold integer programming in cubictime. Mathematical Programming 137:325–341 (2013)[8] Hemmecke, R., Onn, S., Weismantel, R.: A polynomial oracle-time algorithmfor convex integer minimization. Mathematical Programming 126:97–117 (2011)[9] Ho¸sten, S., Sullivant, S.: Finiteness theorems for Markov bases of hierarchicalmodels. Journal of Combinatorial Theory Series A 114:311–321 (2007)[10] Onn, S.: Nonlinear Discrete Optimization. Zurich Lectures in AdvancedMathematics, European Mathematical Society (2010), available online at: http://ie.technion.ac.il/ ∼ onn/Book/NDO.pdfonn/Book/NDO.pdf