A Polynomial Algorithm for the Two-Variable Integer Programming ...

0 downloads 0 Views 231KB Size Report
subject to pxl + a2x~' ~ b' - (k) a2, x~, x~' ~ 0, integers,. We now have a problem of the same form as (3), and it is clear that using (11) we can convert an optimal ...
A Polynomial Algorithm for the Two-Variable Integer Programming Problem RAVINDRAN KANNAN Cornell University, Ithaca, N e w Y o r k

ABSTRACT A polynomial time algorithm is presented for solving the following two-variable integer programming problem maximize ClXl + c2x2 subject to a, lxl + a,2x2 =< b,, I = 1, 2, and x~, x2 => O, integers,

, n,

where a,j, cj, and b, are assumed to be nonnegattve integers This generahzes a result of Htrschberg and Wong, who developed a polynomial algorithm for the same problem with only one constraint (l e, where n = 1) However, the techniques used here are quite different KEY WORDS AND PHRASES integer programming, knapsack problem, polynomial algorithm, coefficient size, feasible region decomposition CR CATEGORIES 3 15, 5 25, 5 30, 5 40

Introduction

We consider the following integer programming problem: (1)

maximize subject to and

clxa + czx2 a a x l + a,2xz ~ b,,

xl, x2 => 0,

a= 1,2 ....

n,

integers,

where au, G, and b, are assumed to be nonnegative integers. We first show that the solution to (1) can be obtained easily from the solutions to at most n problems, each of which is of the form (2)

maximize subject to

c l x l + c2x2 a l x i + a2x2 =< b,

f ~ xl =< g, and xl, x2 => 0, integers,

(2a) (2b)

(2c)

where all constants involved are positive integers; further they can all be computed in time no greater than a fixed polynomial of the size of the input which is assumed to be represented in binary encoding. It is also assumed that g _-< [ b / a i J . If not, we can replace g by [ b / a i J . (Using different techniques, Hirschberg and Wong [l] have developed a polynomial algorithm to solve (2) where constraint (2b) is deleted.) Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery To copy otherwise, or to republish, requires a fee and/or specific permission This research was supported by Sonderforschungsberelch 21 (DFG), Institut fur Okonometne und Operations Research, OniversttM Bonn, Bonn, West Germany, and the National Science Foundation under Grant ENG 7609936 to Cornell University, Ithaca, New York Author's present address Department of Electrical Engmeenng and Computer Science, Division of Computer Science, University of California at Berkeley, Berkeley, CA 94720 © 1980 ACM 0004-5411/80/0100--0118 $00 75 Journalofthe AsSoclaUonforComputingMachinery,Vol 27,No I, January 1980,p 118-122

A Polynomtal Algorithm f o r the Two. Variable Integer Programming Problem

119

1. Decomposition THEOREM 1

(DECOMPOSITIONTHEOREM). The set S defined as S = {(x~, x2)]a, lxl +

a,2x2 ~ b,, i = 1. . . . .

n; Xl, x2 ~ 0} where a u and b, are positive integers can be expressed as UP-iS,, where m = ~ - x~

- x~ k

~

(in the context of (9a) and (9b))

(again in the same context).

Therefore, the set of optimal solution to (9) is the same as that of (10) below: (10)

maximize s u b j e c t to

and

c~x~ + c2x~

a~x~ + a2xi ~ b',

(10a)

x~, x~ ~ O, integers,

(10b)

x2' = >

(10c)

-x

k.

Replacing x[ ~ 0 by x~ ~ [b'/aaJ (in the context of (10c)) and substituting (11)

x~' = x l -

- x~ k

into (10), we get (12)

maximize

(cl -c2(k))x~ + c2x~' + c2(k)

subject to p x l + a2x~' ~ b' - (k) x~, x~' ~ 0,

Lb,]

a2,

integers,

We now have a problem of the same form as (3), and it is clear that using (11) we can convert an optimal solution of (12) into one o f (9). If now (12) satisfies (5), (6), or (7), we are done. Otherwise, we iterate the same process on (12). Note that to obtain (12) from (3), we need to perform a constant number of multiplications and divisions each o f which takes at most O(d log d log log d) time [2], where d is the length of the input. Further, we claim that after two iterations the size of the lesser coefficient in the knapsack constraint is cut down by a factor of at least 2. This is because in (9) either p = (al - [alia2] a2) =< a2/2, in which case already in (12) the lesser coefficient is at most ½ of that in (3), o r p > a2/2. But m this latter case a further iteration on (12) yields a problem with coefficients p and a2 - [a2/p] p = a2 - p < a2/2. Thus at most 2 log as iterations are required before condition (6) is satisfied. Thus, the problem is solved in O(d 2 log d log log d) time. To summarize the above discussion we present the algorithm to solve a problem of the form (3). The procedure below assumes that the input sausfies (4). We will also assume that either the problem given is infeasible (in which case by convention we set the value of the optimal solution to -oo) or it has a finite optimal solution value, The procedure tells which of the two cases holds and in the latter case gives an optimal solution (xa, x2) as a vector. procedure KP(cl, c2, al, a2, b, L, U ) begin if (5), (6), or (7) holds t h e n r e t u r n the solutton after a tnvtal calculation, if ( U ~ oo) t h e n U ~-- ram(U, lb/alJ, C o m m e n t W e n o w r e d u c e (3) to (9), if (L ~ 0 or U ~ oo) t h e n r e t u r n the better o f the two solutwns (U, l(b - azU)/a2J) and (KP(cl, c2, al, a2, b - [(b - alU)/a2] a~ - alL, O, ~ ) + (L, [(b - alU)/a2])),

122

RAVINDRANKANNAN

CommentNow L = 0 and U = oo. After ensuringthat a~ ~ a2, we recurstvelysolve(12), 0 I 0);

if(a'