Improved Algorithms for Linear Inequalities with Two Variables per

0 downloads 0 Views 1MB Size Report
Figure 1: An example of a system of inequalities and the associated graph push phase on G is the step of ... uniquely defined we choose arbitrarily among the quali- .... [ai, b,] be the set of values which are not contradi~~ed by any simple cycle.
Improved

Algorithms

with

Two

for

Variables

Linear per

Edith Cohen

Inequalities

Inequality

Nimrod Megiddot

(Extended Abstract)

Abstract. We show that a system of m linear inequalities wit h n variables, where each inequality involves at most two variables, can be solved det erministically in O(mn log m + mnz log2 n) time. A randomized O(n3 log n + mn log3 n log m + mn log5 n) time algorithm is given for the case where in every inequality the two nonzero coefficients have opposite signs (monotone systems). This algorithm improves the known time bounds for the incapacitated generalized transshipment problem, with many sources and no sinks. We also present a new algorithm that solves the capacitated generalized flow problem by iteratively solving monotone systems. Combined with the improved bound, it yields the fastest known algorithm for the problem which does not rely on the theoretically fast matrix multiplication algorithms. This approach also yields the first strongly polynomial time bound for approximating the maximum generalized flow within any constant factor.

1.

Introduction

In this paper we consider a system of m linear inequalities wit h n variables, where each inequality has at most two nonzero coefficients. We give algorithm that either find a point which satisfies all the inequalities, or conclude that no such point exists. In addition, the algorithms can be adapted to find the solution which minimizes or maximizes a specific variable. The system of inequalities is called monotone if in each inequality the two nonzero coefficients have opposite signs. For instance, the dual of *Department of Computer Science, Stanford University, Stanford, CA 94305, and IBM Almaden Research Center. Research partially supported by ONF1-NOOO14-91-C-0026 and by NSF PYI and DEC. Grant CCR-8858097, matching funds from AT&T tIBM Almaden Research Center, San Jo~e, CA 95120.6099, and School Israel.

of Mathematical Research

partially

Sciences, supported

Tel

Aviv

University,

Tel

Aviv,

by ONR-NOOO14-91-C-0026.

Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direet 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, requiresa feesod/orspecificpermission.

@ 1991 ACM 089791-397-3/9110004/0145

the incapacitated monotone [1].

generalized transshipment

problem is

Shostak [13] characterized the set of solutions of systems with at most two variables per inequality, and gave an algorithm which was exponential in the worst case. Nelson [12] gave an n“i]”gmj algorithm. Aspvall and Shiloach [3] and Aspvall [2] proposed algorithms which performed 0(rnn31) and 0(mn21) arithmetic operations, respectively, where 1 is the size of the binary encoding of the problem. Megiddo [11] proposed the first strongly polynomial time algorithm for the problem, which performed 0(rmz3 log m) operations. The algorithms presented in this paper have improved time complexities. We give a deterministic algorithm which performs O(mn log m+mnz log2 n) operations, and an 0(n3 log n+rian log5 n+mn log mlog3 n) time randomized algorithm for monotone systems. The effort involved in translating these algorithms into actual programs is about the same as in the previously known algorithms, and the constants in the time complexities are still reasonable. In a Generalized network fiow problem (also known as flow with gains and losses), each edge (z, j) has a positive gain factor aal associated with it so that if a flow Zij enters the edge at i then a flow of aijxa~ exits the edge at j. Adler and Cosares [1] reduced the incapacitated generalized transshipment problem, where only demand nodes are present, to a single solution of a monotone system. Therefore, the improved bounds for the latter problem result in a faster algorithm for the former. The best known time bound for the capacitated generalized flow problem is due to Vaidya [15]. However, Vaidya’s bound relies on the theoretically fast, but complicated, matrix multiplication algorithms. We present a new algorithm that solves the capacitated generalized flow problem by iteratively solving monotone systems. The resulting algorithm is comparable to Vaidya’s algorithm, where each is faster on a different range of problems. In adchtion, our algorithm is much simpler. Our algorithm is faster than all previous algorithms which do not rely on the theoretically fast matrix multiplication

$1.50

145

(see Goldberg, Plotkin, and Tardos [7], and Kapoor and Vaidya [8]). This approach also yields the first strongly polynomial algorithm for approximating the maximum generalized flow within any constant factor. Section 2 gives the preliminaries. In Section 3 we introduce the basic deterministic algorithm and analyze its running time. In section 4 we give a randomized algorithm for the monotone case. In Section 5 we discuss applications to generalized network flows. Most proofs were omitted in this abstract.

2.

(ii) If a 0 and ~ = –1, we have an edge e = (Bj,~) labeled f.(z) = –crc – P and an edge e-l = (D,, yj) labeled fc-, (z) = –$z

– ~.

See Figure 1 for an example of such a system and the associated graph. For any one-to-one function f let f – 1 denote the inverse function. In particular, if f(z) = az + ~ and a # O, then f-l(z) = ~Z – ~. Note that for all e E E, f,--, = fe-l.

Preliminaries

In this section we introduce some terminology, notation, and discuss the special properties of systems of inequalities which involve at most two variables per inequality. We define some basic constructs and operations. We also present an algorithm, a variant of which was used by Aspvall and Shiloach [3], that locates a value of a variable with respect to the projection of the feasible region. This algorithm is used in the following sections as a subroutine.

Our algorithm maintains numerical values associated with the vertices of G; the value associated with Di (resp., qi ) is denoted by Zi (resp., ~i ). Intuitively, ~a and Zi give the current upper and lower bounds, respectively, on the value of the variable x%. We introduce an operation which considers an edge (u, v) and updates the bound associated with v, as implied by the inequality associated with (u, v) and the bound associated with u.

2.1

Definition 2.2. A push through the following operation:

The

associated

graph

With every system of inequalities, where each inequality involves at most two variables, we associate a graph and a set of intervals as described in the following definition. We assume throughout the paper that a system is given by the associated graph and set of intervals. Definition 2.1. Suppose we are given a system of m linear inequalities in n variables i-cl, . . . . z~ such that each inequality involves at most two variables. Without loss of generality, assume that the inequalities with only one variable are summarized in the form of intervals Si = [a,,llZ] (–~ < a~ ~ b~ < 02, i= 1,..., n), We consider a directed graph G = (V, E) as follows. For each variable xi, there are two vertices in G associated with z,, namely, V=~U~where~={~il i= 1,. ... n} and y={~\i= l,... ,n}. For u c V, we define u-l ~ V as follows. If u = ~i c ~, then u-l = Vi, and if u = tia ~ ~, then u-1 = y,. The edges of G are associated with the inequalities that involve exact ly two variables as follows. Each such inequality is represented by two edges and also each edge e is labeled with a certain linear function f~. The edges corresponding to an inequality of the form ‘y% 5 azj + o are as follows: (i) If a > 0 and ~ = 1, we have an edge e = (Dj, i7i) labeled f.(z) = QZ + ~ and an edge e-l = (Yi, Ij) labeled fe., (z) = AZ – ~.

146

an edge e is defined as

(i) If e = (tij, Oi), E, ~ min{E,, f.(Ej)}. (ii) If e = (uj, u), ~i +max{g,f~(~j)}. (iii)

If e = (mI, u), & -

(iv) If e = (Ki, fi.),

~i

+-

max{%,f~(~j)}. min{zt,

~e(&,)}.

A push is said to be essential value of ~i or Zi. Proposition initialized Z=(zl, ities

and

conditions

2.3. to

any

Suppose values

. . . , Xn)T which (ii) ~ < x% < X

is in~arzant

if it actually

~i

and (t)

Ei

and let X

E% (i = be the

modifies the

1, . . . . n) set

are

of vectors

satisfy all the given inequal(i = 1, . . . . n). Under these

under

pushes.

It is easy to see that a vector z solves the given system if and only if (i) z, E Si (i = 1, . . . . n) and (ii) the set of values Ei = ~i = ~i (i = 1, . . . . n) is invariant under pushes. The push operation (see Definition 2.2) is used as a subroutine in the algorithms presented here. We define a new operation which amounts to pushing through all the edges simultaneously. We then give some definitions applicable to repetitive executions of this new operation. Definition 2.4. Consider the graph G with some initial values at the vertices, q = z~, ZI = @ (i = 1,. ... n), A

x+2 (1.)

(l.)

y




z

(3.)

y

>

-z

(4.)

y


” ‘,’’.. /:: :,. , .; .. >..\ #.,;:”>.,..,. :: , . .Ce:: ,, fl:,~::’::’.-.:::’: :..’,;:‘.: :..’x ‘ , \,..,, ~...”... :.7 7 ....::,... .(..:: / \“. < ::’.:,,’ .,..’., .. ;:’.,.../’ \“,,,...,;..,,.. :: :: :s::1.,;:;/ . . .. b (resp. , q < a). Note that if a value lies inside an interval [a, b], it is neither inconsistent nor consistent with the interval. [a, b]

The following observation, due to Shostak, is crucial for the correctness of all known algorithms for linear systems with at most two variables per inequality: Proposition ble, then

the

set Of solutions

2.9. interval

[Shostak [13]] If the problem [z~in,

z~ax]

on the xi-axis.

is the projection

is ~easiof tie

at the vertices

respective

2.11. =

intervals

2.9.

of

push

are initially

[xyi”,

any numbe?’

afteT

(j=l

Consider a vertex

L& (resp.,

,....k path

(~, Ui)).

(j=l

with

[ !)

Z:)

pai?s 2.~)

zil ,...,

x?=],

then

of push

opera-

(resp.,

=

v,)

~.

Xi

and

Let

the with

be the

to VI, . . . . vk.

a

(~~, vi)

comprising

associated

~i~

?’espective~y,

which

g

fo?’ some

be the

[z~in,

[z~in,

=

Definition Let

with

, . . . . k)

tent


f)

i.e.,

of ?&).

~%)

sequence Then

OT, ?’esp., ( > x~=) OT (ii)

and

~),

at Ga (Tesp.,

~ is consistent

of

eitheT and (~ >

OT, TeSp., ( < X~in).

The essence of the following Aspvall and Shiloach [2, 3].

proposition

is proved by

Proposition

2.13. Given a variable xi and a value (i, it in O(mn) operations whetheT (i) ~i < x~in, (ii) x~ax, or (iii) & C [x~in, z~a].

can

be decided

Definition 2.14. (i) We refer to the decision made in Proposition 2.13 as deciding the value &. (ii) The system of inequalities found by the algorithm (see below), which determines (i < z~in or (i > of [i. x ~=, is the certi$cate

148

These decisions are made using the following algorithm. The algorithm considers a value Z,m=. The algorithm applies push phases iteratively. It stops when it finds a subsystem that implies fi > z~= (the case (, < z~in is similar). If it is of size -t, it is The subsystem found is minimal. If after 2n iterations such a found after O(l) iterations. subsystem

is not

detected,

the algorithm

determines

that

(~ < X?=.

3.

The

inequality.

spond

to

(w, Vj),

(ii) Repeat Steps (iii) -(vi) for k = 1,..., the system rithm did not terminate, Perform

a push after

Denote

phase.

the

kth

push

is feasible.

the

phase

If the algo-

2n.

values

by

~~,

at Z;

the (k

one

of the

for

xi

Keep track of all essential push operations. At iterapushes k, the total size of the forest of essential

tion

2kn.

be updated essential once. Step (i

At

in

O(m)

paths

such

The

If there

~ x?=,

each

iteration,

operations. that

algorithm

(vi)).

may

and

can

maintain

vertex

discard

forest

only

appears

some

are no remaining

only

paths

(see

essential

paths,

stop.

If for

conclude

associated initial

the We

each

(iv) If k # 23 for any integer j, to Step (iii) (next iteration). as follows.

some

j

as follows. with

vertex

Otherwise,

these

is not

corresponds

Otherwise,

value

contradicts

F;

Consider

the essential

values.

v, let

If for

> Z;

then

both

system

pV be the update

associated Check (.

If there

paths

When

and

only z,




If in matrix entry

then

the

set

semilattice tle

and

A there per row

where

aj

of ~j

#

the

(j

i),

relative

The

to the

vto

~).

does

graph

not

have

for

of monotone

systems

a system ~

ables. a

Note

that

then

signs

(see

It

follows exists (or

in the associated The

pacitated

system

(both

In this

section

found

using

that

graph

if all

–AT

are

0(rz3

for

the

variables all

of a monotone the

problem

feasible

AT

is pre- Leontief.

inca-

locating its

it with

position

same nent

~ with

containing

set gi nates

=

~, and

after

~ > z~= ~.

reversed to the

at and

certificate in

E’ We

where

2.15

to

J

C vari-

this

step

set

is ~

of

=

(%

gl

edges

the

(rather

value

than

to z~ax.

The

only

=

bf (j

#

i).

n iterations, certificate

always

consists

(which

E’

or

to

between

set of inequalities

it

vertices as the

point

(e.g.,

to hold

is at least

outcome

of comparing

vertices

the

values

means

for

The

(i.e.,

select

It suffices

equivalently,

~)

however, the

to

since

the

to the

outcome

Problem

3.2.

from

In

the

previous

of the

used here, and

variables

Probfrom

of one variable

only

variable.

In the approach

typically

regard

infers

as well.

solved

with

This

results

is faster

implementation

following

together for

we infer

same

to

in

an al-

by a factor

of n,

of Algorithm

in this

A

Algo-

we use a randomized

3.2 which

difficulty the

grouping

section

values

better

by using

algorithm

to other

Problem

for

steps

the value

to a faster

main

of solving in O(mrz)

about

even

hence,

solution

all resolved

point

on z ‘=).

to a query

of other

gorithm

(or

values. in

implementation

(

this

pl, pz is identical

query

regard does

at

to the

the objective

the maximum),

complexity

3.2 outlined

that

amounts

restricted

When

is

on part

-1 p; 1, pz .

discuss

with

pair

a comparison is then

as tight

in ~

“com-

one which

of the

holds.

need

onlY

the answer

point

section

3.3.

is an efficient

problem:

the Problem

to

4.3.

[Decide

a pool

& for the corresponding these

termi-

values,

i.e.,

of values]

variable

determine

z, (i=

Given 1,...,

if & > z~=

are values n).

(i =

Decide

1, . . . . n).

determines that

a cycle,

set

a specific

consider

lem

compo-

Note

and

the

comparison

We benefit,

it suffices

when

this

which

of decid-

algorithm

is found.

of a path refer

pass

The

where

performs

member

search

solu-

a tightest-path

and chooses

Resolving The

2.15.

ap-

yields

step

region.

a value.

independent

locates

connected

feasible

other

rithm

system

algorithm

to the

as the

maximum

algorithm

of paths

can be decided

determining

the algorithm

as tight

3.3 to a monotone the

maintains

The

pairs

the path

and

Assume

of vertices.

between

value

matrix

the

the algorithm

We

as well).

interchangeably

corresponding

the

notion

In the initialization

most the

is to find

algorithm

of finding

single

us to

also

2.15 in case the underlying

applied

~.

goal

to Z?=

respect

when

bounds when

deciding

is monotone.

result

J}

corresponding

of Algorithm

be

are

allow

solution the

to z~in

Algorithm

of inequalities a value

respect

time

the

the

can

variables

that

on a simpler

section,

relative

Consider

These

When

this

which

pair

of comparing

that

point

dependencies

3.2 can rely In

minimum)

determines

a maximum

Problem values.

the

solutions.

to computing

ing

the

initialization

objective

path-comparisons

(see Section

We show

each

is to find

implementation

systems.

that

interval

system

of the

Recall

to deciding

sets of vertices

dual

of

the

of the

the

simultaneously.

a randomized

supplies

ply

a!‘=,

the

an application

at least

log n + mn log m log3 n + mn logs n) op-

algorithm

and

compute

but

. For ail choices with the same

Zi = b; (i $? J).

with

parisons”

to the

where

the two

transshipment

equivalently,

The

unbounded

E

for

of Algorithm

where

Framework

tion.

of solutions

relative

a solution

between

we present

(or,

erat ions.

{~%Ii

of values

application

and

system

non-zero

and set

minimized)

hm 3.3 for monotone

maximum

for [,

from

5) is monotone.

of Algorit

Suppose

is a run

4.2

Defini-

(resp.,

two

AT The

underlying

generalized

the

a lattice

there

are no edges passing ~.

algorithm is Z% =

(j # i) terminates

algorithm

is a set

An

values (i E J),

(see Cot-

to ~

inequality

monotone.

are maximized

and

such

constitutes

operations.

A

bounded,

variables

~

operation

edges from

opposite

) is called

there

of

every

pre-Leontief and

A)

contain

where

coefficients

V

neg-

matrix)

constitutes

V (resp.,

< h~ < xjrn=

4.2.

, n}

{l,...

Consider

A system

are

a system

of the

initialization

[5]).

associated

2.1)

(resp.,

is a pre-Leontief

of such

a mm

the

certificate.

Y71})T

one positive

is, AT

of solutions

Veinott

tion

is at most

(that

when

g3 = iij,

Definition

ative)

Consider

x?=

We review

the

section

both

here.

E’– 1 of the in

~),

and

certificate.

151

3.1,

the algorithm and

We give

contrast

a set-up

tion

to a polylogarithmic

such

stage

involves

for it

which

solving

Problem

with

breaks

number Problem

3.2 given

a new down

of stages, 4.4.

in Sub-

approach the

used

computawhere

each

In the solution considered ing

values

values

of others.

a single step.

requires

step,

Since

different

phase

step

all into

solving

Problem

regarding

then

values each

Z’nax,

decisions

regarding

into

O(logm)

O(logn)

stages.

n values

one

each

!-big

value

such

stage

cate.

Hence,

variables,

i.e.,

and

phases

consists

We

update

discuss

tialization

the

and

involves total

number

O(log

m)

operation

tightest

path

in O(log

n) stages,

for

4.3 and

It O(log lem

The

rest

O(m

0(rn/2t each

in

where

stage

the

section

This

with

each.

in

an in-

time.

involves

t consists

a

is done

) additional

The

finding

This

a

is done

of solving

Prob-

time.

complexity

applications

ini-

is

dominated

of an algorithm additional

is concerned

by

for

Prob-

time. with

Theorem

4.4.

~. 3 can log3 n)

be resolved

in

4.3.

It

follows

that

monotone

number 0(n3

set,

an

ex-

operations.

systems

can

procedure

values

of other

garding

other

we

present

for

purposes according

of analysis,

let

us classify

sizes of their

values

certificate

which

are

to a set of k un-

value

which

values

in O(mn)

steps.

can

belongs are

small.

The

variables. values

This

have

the

any

of them,

(1, 2.!]-big

algo-

“check”

and

4.5.

values

procedure on feasible

to decisions

O(ml)

time

values

l/(6n)

re-

“check”

In Subsection

4.6 we

in the

a “check”

least

decides

(unknown)

“reveal”

rise

The

O(rnl)

pool

is applied of the

other

pool.

algorithm

the

An

in

‘(check”

(t?, 21]-big

at

value.

bounds

gives

When

decides

in the

following n be

of the

property. it

values

The

upper

in the pool.

half

following

of an l-big be computed

2.15.

to compute

in Subsection

a pool

number

procedures for

the

of

of n values. big

are used

constants

Let

values.

The

as subroutines.

Cl,

Cz,

and

C are

later.

4.6. Loop

Apply

Prob-

the

of vari-

es.

(ii)

[Decide Steps

such This “reveal”

rthat

a pool

of values]

(i)-(ix)

‘(reveal”

procedure

are no big

estimate

values,

to the

stop.

of the

number

1/2

r“ /r

~

estimate

~

is achieved

procedure

Set ti

set of all values.

Otherwise, of big 2 with by

compute

values

in

the

probability

~

applications

of

= O (a counter

of the

of operations).

Set tb = O (the current

152

A: the

number

to the

value

at least

pool algorithm

many

G’.

these

is a “check”

is given

values an

all

that

4.4.

For ables

Subsection

that

show

1/2.

this

a big

algorithm

an

In

is applied

Algorithm

certificate

If there

lem

cer-

decide

procedures

finds

be performed

using

uses the

(; of

either

of an Z-big

Algorithm

a pool

a procedure

is omitted.

log n + mn log5 n + mn log m log3 n)

Deciding

val-

property

in an

of

operations.

4.4

l-big

an associated

intersect

two

any

the certifi-

second

on average

certificates

The

for

decides

we give

on

These later.

to find

with

can

concludes

can

Appropriate be solved

is based

certificates;

The

[ along

“reveal”

it

or

operations,


Ej,

Definition

finite,

as follows.

If in

a value

When

the final

values

are big.

conclude

4.9.

that

4.6

Si.

If for

that

Step

some

q is a big

(iv)

value

value

of Algorithm

~ is big,

we say that

of

“check”

q we

of Zj.

4.8 we de-

~% 2k -decides

q.

Properties

runs

found

runs,

apply

a “check”

values

found,

increment

the

procedure

Set

{1, . . . . k}

to the are

phases.

. . ..n)

2.15 ap-

as follows:

K

2k push

(j=l,

This

subsection

Theorem (push

1.

the

I =

4.2)

(iv)

duce

}.

of Algorithm

number).

of the

tb accordingly,

S1, . . . . Sk

[n/2~-l

Perform of Ej

the

(viii)-(ix)

1 +

c

in

to the set of values

iteration

Z &

K’

(i).

samples

k runs

of “active”

K.

(ix)

random

(set

another

go to Step

of size min{n/4,

1 =

Apply

(viii;

log nl

i according

C: Steps

or

discarded

Sk (See Definition

copy

Loop

values

B).

“concurrently”

to S1, ...,

Initialize

(vii)

of big

each

is successful),

failed),

of Loop [Cl

pool,

estimate

n (estimate

iteration

from

(the

O (number

current

(iii)

(iii)-(ix)

(i) tb z ~’ /4

in

for

a

b and

Consider

a collection

applied

to a Tandomly

decides

with

The

following

4.10. A

probability

following

among

the

“check”

values.

opera-

establishes

at least

proposition

values

theorem: of b (2k - 1, 2k]-big chosen

~, i_l(b2k /n)

analyzes

of different

big value,

values.

the

dependencies

variables.

set K = K \ K’.

n or

b ~

[C#/(nlog

n)~”l

then

tt

=

Proposition

of

xj,

4.11.

Let

Suggest Documents