On the Complexity of Integer Programming
CHRISTOS H. PAPADIMITRIOU
Massachusetts Institute of Technology, Cambridge, Massachusetts,
and National Technical Umverstty, Athens, Greece
ABSTRACT. A simple proof that integer programming ts in X~ ~s given. The proof also estabhshes that
there ~s a pseudopolynomial-tune algorithm for integer programmmg with any (fixed) number of
constraints.
KEYWORDSANDPHRASES: integerlinear programming, ~, ~ , pseudopolynomlal algonthms
CR CATEGORIES' 5
25, 5.3, 5.4
1. Introduction
The k n a p s a c k p r o b l e m is the following one-line integer programming problem: Is
there a 0-1 n-vector x such that
a l x l + a ~ 2 + • • • + anXn
=
b,
where b, al . . . . . an are given positive integers?
The knapsack problem is NP-complete [5, 7]. However, it is well known that it can
be solved by a p s e u d o p o l y n o m i a l algorithm [4], that is, an algorithm with running
time bounded by a polynomial in n a n d a = max{a1 . . . . . an, b}. Indeed, one can
show quite easily that there is a pseudopolynomial-time algorithm for any one o f the
following extensions of the knapsack problem:
(a) The x, are not restricted to be 0-1.
(b) Some of the a, are negative.
(c) There are m > 1 equations to be satisfied (m fixed).
In fact, with a little care, pseudopolynomial algorithms can be developed for the
combination of a n y two o f these extensions. In this note we show that there is a
pseudopolynomial algorithm for the problem that results by extending the knapsack
problem in all three directions above.
Our p r o o f settles another interesting question. It has been shown by m a n y people
(including [1, 2, 6]) that integer p r o g r a m m i n g (i.e., the problem of deciding whether,
for given m x n integer matrix A and m-vector b, the conditions
A x = b,
x _> O,
integer,
are satisfied by some x ~ INn) is in ~A:~. The proofs usually amount to showing
Permission to copy without fee all or part of this material is granted provided that the copies are not made
or dlstnbuted for direct commercial advantage, the ACM copyrtght notice and the utle of the pubhcatlon
and tts date appear, and notice Is given that copying is by permlsston of the Association for Computing
Machinery. To copy otherwise, or to repubhsh, reqmres a fee and/or specific permission.
Author's address Laboratory for Computer Science, Massachusetts Institute of Technology, 545 Technology Square, Cambndge, MA 02139.
© 1981 ACM 0004-5411/81/1000-0765 $00.75
Journal of the Assoclauonfor CompuungMachinery,Vol 28, No 4, October 1981,pp 765-768
766
C H R I S T O S H. P A P A D I M I T R I O U
Figure 1
\\
X
(a)
(b)
that if the problem has a solution x E l',l n, then it has another solution
Xo E {0, 1. . . . . aP~'°} n, w h e r e p is a polynomial and a = max,j{[a,ll, IbjI}. We give
here a considerably simpler proof of this fact. Furthermore, our bound is of the form
(an) 9~=). Since it is natural to assume that m _< n, this is a significant improvement.
In our proof we use several times the following simple lemma, easily proved from
Cramer's rule.
LEMMA 1. L e t A be a nonsingular m x m integer matrix. Then the components o f
the solution o f A x = b are all rationals with numerator and denominator bounded by
(ma) m, where a = m a x , j {[a,~ ], Ib~l}.
Our second lemma is a multidimensional, f'mite precision generalization of the
following intuitive fact: If three directions on the plane cannot be left on the same
side of any line through the origin (Figure 1), then they can be the directions of three
balanced forces. It is a version of Farkas' Lemma.
LEMMA 2. L e t vl . . . . . vk be k > 0 vectors in {0, +-1, +_2.
M -- (ma) m+l. Then the following are equivalent:
+_a}m,
. . . .
and let
(a) There exist k reals cq . . . . . c~k -> O, not all zero, such t h a t ~ . l ajvj = O.
(b) There exist k integers ~1. . . . . olk, 0 _< ¢X~_< M f o r j ---- 1. . . . . k, not all zero, such
that ~ - 1 ajv: -- O.
(c) There is no vector h E IR m such that pj = h Tvj > Of o r j ffi 1. . . . . k.
(d) There is no vector h E {0, +-1. . . . . +_M} m such that hTvj _> l f o r j = 1. . . . . k.
PROOF
(a) ~* (b).
(b) ==~ (c).
absurd.
(c) =~ (d).
Follows from Lemma 1.
Suppose that such an h exists. Then 0 •h T ~ - ~ ajv~ = ~ - ~ ol~p~ > 0,
Trivial.
(d) =* (a). Using Lemma 1, it is easy to see that (d) is equivalent to saying that
the linear program
minimize hT.0
subject to
hTvj = 1, j = 1. . . . .
k,
is infeasible. Consequently, the dual linear program (see [3, 8])
k
maximize
~ 09
jwl
k
subject to
~ o~jvj=0
J--1
and
o~>_0, j =
l . . . . . k,
767
Complexity o f Integer Programming
is unbounded (because it ts feasible, with a~ = 0, all j ) and therefore has a strictly
positive solution. (a) follows. []
We are now ready to prove our main result.
THEOREM. Let A be an m × n integer matrix and b an m-vector, both with entrtes
f r o m {0, +1 . . . . . +a}. Then t f A x = b has a solution x ~ IN n, tt also has one in
(0, 1. . . . . n(ma)2'n+l} n.
PROOF. Let M = (ma) m, and consider the smallest (say, w.r.t, sum o f components)
integer solution x to A x = b. I f all components of x are smaller than M, we are done.
Otherwise assume, without loss of generality, that xj _> M f o r j -- 1 , . . . , k. Consider
the first k columns of A, namely, vl . . . . . Vk.
Case 1. There exist integers al . . . . . ah between 0 and M, not all zero, such that
~ - 1 ajvl = 0. It follows that the vector x ' = (Xl - o L 1 . . . . , xk - ak, xk+l . . . . . xn) is
also a solution to A x = b, thus contradicting the minimality of x.
Case 2. Not so. By L e m m a 2 there is a vector h E {0, +_l . . . . , +_M} m such that
hTvj >_ l for j = l . . . . . k. Let us premultiply the equation A x = b by h T. We obtain
2kj=l hTvjxj = hTb - ~3=k+l hTvjxj, and therefore 2kj=l Xj ~ n 2 m a M 2 = n(ma) 2m+1. The
theorem follows. []
COROLLARY 1. There is a pseudopolynomial algorithm f o r solving m × n integer
programs, with f i x e d m.
PROOf. We can solve the m × n integer program A x = b by dynamic programming, proceeding in stages. At t h e j t h stage we compute the set Sj of all vectors v that
can be written as v = ~/=1 v,x,, with v, the ith column of A and with the x, in the
range 0 _< x, _< B, where B = n(ma) 2m+1. Since the S~ cannot become larger than
(nB) m, the whole algorithm can be carried out in time O ( ( n B ) re+l) =
O(n2m+2(ma)(m+l)~Zm+l)), a polynomial in n and a if m is fixed. []
We can extend Corollary 1 to the opnmizatwn version of integer programming,
that is, the problem of finding the x which
minimizes c ' x
subject to A x = b,
(1)
x _> O,
integer.
We first need the following lemma.
LEMMA 3.
Consider (1) and the following linear programming relaxation:
minimize
subject to
c' x
A x = b,
(2)
x >_ O.
I f ( l ) is feasible and (2) is unbounded, then (1) is also unbounded.
PROOF. I f (2) is unbounded, then it has a feaszble direction y such that (a) the
components o f y are rationals, (b) c'y < 0, and (c) if x is feasible then x + ?,y is
feasible for every ~ _> 0. For every feasible solution x ~ INn of (1), therefore, there is
a set of other integer solutions of the form xj = x + jPy, where j E IN and P is the
product of the denominators o f y . This set is of unbounded cost. []
LEMMA 4. Suppose that (1) ls feaszble and bounded, and let z be its optimal cost.
Then lz[_< (~=1 I cj [).M, where M = n2(ma2) 2m+3.
PROOf. That z _< (~3_1 [ c j l ) . M follows from the theorem. For a lower bound it
is obvious that zz _< z, where z2 is the o p t i m u m cost of (2); notice that by L e m m a 3,
768
CHRISTOS H. PAPADIMITRIOU
(2) is bounded, gwen that (1) is. It is immediate, however, that Iz2l _<(~'~=1 I cj I)" M,
because z2 is attained at a basic feasible solution of (1). []
We therefore have
COROLLARY 2. There is a pseudopolynomial algorithm for finding the optimum m
any m x n optimization integer program (1),for m fixed.
PROOF. We may simply solve one feasibihty integer program,
CrX = Z,
A x = b,
x > O, integer,
for each value of z in the range
-
Ic, I . M J=l
1 _< z _< ~ Ic~l . M ,
Jft
using the pseudopolynomial algorithm of Corollary 1. Binary search would yield a
better bound. []
Notice that no pseudopolynomial algorithm is hkely to exist for the general (not
fixed m) integer programming problem, since this problem is strongly NP-complete
(see [4]).
Note added in proof. Recently H. W. Lenstra discovered a remarkable polynomialtime algorithm for testing whether a system of linear inequalities in n variables has an
integer feasible point, where n is fixed. Our result (Corollary 1), however, is
independent of Lenstra's, since it is concerned with a fixed number of equalities. This
problem is a generalization of the knapsack problem, and thus it is very unlikely that
it can be solved by a polynomial-time algorithm.
REFERENCES
1 BOROSH,I , AND TREYBIG, L B. Bounds on posmve integral solutions to hnear Dtophantine equauons.
Proc Amer Math Soc 55 (1976), 299-304
2 COOK,S A Private commumcatlon, 1978
3 DANTZIG, G B Linear Programmmg and Extensions Pnnceton Umvers~ty Press, Princeton, N J ,
1962
4 GAREY, M.R, AND JOHNSON, D S "Strong" NP-completencss results mouvatlon, examples, and
implications J. A C M 25, 3 (July 1978), 499-508.
5 GAREY, M.R, AND JOHNSON, D S Computers and Intractabthty A Guide to the Theory of NPcompleteness Freeman, San Francisco, 1979
6 KANNAN,R , ANDMONMA,C.L. On the computational complexity of integer programming problems
In Lecture Notes in Economws and Mathematical Systems, Vol 157, Sprmger-Verlag, 1978,
pp 161-172
7. KARP,R M. Reducibthty among combmatorial problems In Complemty of Computer Computations,
R E. Miller and J W Thatcher, Eds, Plenum, New York, 1972, pp 85-103.
8. PAPADIMITRIOU,C H , AND STEIGLITZ, K Combinatorial Optimization Algorithms and Complemty
Prentice-Hall, Englewood Cliffs, N J , 1981
RECEIVED JANUARY 1980; REVISED JUNE 1980, ACCEPTED JUNE 1980
Journalof the AssoclaUonfor ComputmgMachinery.Vol 28. No 4, October1981
© Copyright 2026 Paperzz