Вы находитесь на странице: 1из 58

Minimizing Average Flow-Time

Naveen Garg

IIT Delhi
Joint work with Amit Kumar, Jivi Chadha ,V Muralidhara, S. Anand
Problem Definition
Given : A set of M machines
A set of jobs
A matrix of processing times of
job i on machine j.
Each job specifies a release date
p
ij
r
j
r
j
Problem Definition
Conditions :
r
j
r
j
Pre-emption allowed
Migration not allowed
Problem Definition

r
j
C
j
Flow-time of j,

Goal : Find a schedule which minimizes the average flow-time
F
j
= C
j
r
j
Special Cases

Parallel : all machines identical

Related : machines have different speeds

Subset Parallel : parallel except that a job can
only go on a subset of machines

Subset Related
p
i j
= p
j
p
ij
= p
j
/s
i
p
ij
p
j
All of these are NP-hard.
Previous work
The problem is well studied when the
machines are identical.
For a single machine the Shortest-
remaining-processing-time (SRPT) rule is
optimum.
[Leonardi-Raz 97] argued that for parallel
machines SRPT is O(min (log n/m, log P))
competitive, where P is max/min
processing time. They also show a lower
bound of O(log P) on competitive ratio
Preemptive, unweighted Flow
time
Online Offline
Parallel
machines
O(log P),
O(log P) [LR97]
O(log
1-
P)
[GK07]
Related
machines
O(log P) [GK06]
Subset
parallel
Unbounded
[GK07]
O(log P)
O(log P/loglogP)
[GK07]
Unrelated
machines
O(k) [S09]

Fractional flow-time
O(1=
O( 1)
)
p
j
(t) = remaining processing of job j at time t

remaining fraction at time t =


a
b
time processing total
(t) p
j
Fractional flow-time of j =
tr
j
p
j
(t)/p
j
Recall, flow-time of j =

=
j
j
C
r t
1
Fractional flow-time
O(1=
O( 1)
)
1 5 12
Fractional flow-time = 1*2 + 2/3*3 + 1/3*7

Fractional flow-time can be much smaller than
(integral) flow-time
O(1=
O( 1)
)
2 0
Integer Program
Define 0-1 variables :

x(i,j,t) : 1 iff job j processed on i during [t,t+1]


Write constraints and objective in terms of these variables.
Fractional flow-time of j =
t r
j
(t-r
j
) x(i,j,t)/p
ij
LP Relaxation
0 t) j, x(i,
t i, all for 1 t) j, x(i,
j all for 1
p
t) j, x(i,
) r (t
p
t) j, x(i,
Min
j
t i,
ij
j
t j, i,
ij
>
s
=

One Caveat
Fractional flow-time
A job can be done simultaneously on many
machines : flow-time is almost 0
LP Relaxation
0 t) j, x(i,
t i, all for 1 t) j, x(i,
j all for 1
p
t) j, x(i,
t) j, x(i, ) r (t
p
t) j, x(i,
Min
j
t i,
ij
t j, i,
j
t j, i,
ij
>
s
=
+


Add a term for processing time
Class of a job
p
j
: The processing time of j rounded up
to nearest power of 2
p
j
2
k
If , we say k is the class of job j


Number of different classes = O(log P)
Modified Linear Program
(
0 t) j, x(i,
t i, all for 1 t) j, x(i,
j all for 1
p
t) j, x(i,
t) j, x(i, ) r (t
p
t) j, x(i,
Min
j
t i,
ij
t j, i,
j
t j, i,
ij
>
s
=
+


Modified LP
LP value changes by a constant factor only.

But : rearranging jobs of the same class does
not change objective value.
From fractional to integral

The solution to the LP is not feasible for
our (integral) problem since it schedules
the same job on multiple m/cs.
We now show how to get a feasible, non-
migratory schedule.
Rounding the LP solution
Consider jobs of one class, say blue.
Find the optimum solution to the LP.
Rounding the LP solution
(contd.)
Rearrange blue jobs in the space occupied
by the blue jobs so that each job is
scheduled on only one m/c.
If additional space is needed it is created
at the end of the schedule
Additional
space
Preemptive, unweighted Flow
time
Online Offline
Parallel
machines
O(log P),
O(log P)

O(log
1-
P)
Related
machines
O(log P)
Subset parallel Unbounded O(log P)
O(log P/loglogP)
Unrelated
machines
O(k)

Assignment as flow
Fix a class k : arrange the jobs in ascending order of
release dates.
r
1
0 0
i
v(i,k,j)
z i , j
t
x i , j , t
p
j
s
Flow = ?
r
7
r
6
r
5
r
4
r
3
r
2
Unsplittable Flow Problem
s
d1
d2
d3
Unsplittable Flow Problem
s
d1
d2
d3
Flow can be converted to an unsplittable flow such that excess
flow on any edge is at most the max demand [Dinitz,Garg, Goemans]
Back to scheduling...
Fix a class k : find unsplittable flow
1 0 2 3 4 5 6 7
i
v(i,j,k)
p
j
s
Gives assignment of jobs to machines
Back to scheduling...
J(i,k) : jobs assigned to machine i
1 0 2 3 4 5 6 7
i
v(i,j,k)
p
j
s
Can we complete J(i,k) on class k slots in I ?
Building the Schedule
Flow increases by at most
max processing time = 2
k

So all but at most 2 jobs in J(i,k) can be packed
into these slots
Extra slots are created at the end to accommodate
this spillover

Increase in Flow-time
How well does

capture the flow-time of j ?
Charge to the processing time of other classes
(
|
|
.
|

\
|
+

1
ij
j
t i,
p
) r (t
t) j, x(i,
Finally...
Since there are only log P classes

Can get OPT + O(log P).processing time
flow-time for subset parallel case.
Preemptive, unweighted Flow
time
Online Offline
Parallel
machines
O(log P),
O(log P)

O(log
1-
P)
Related
machines
O(log P)
Subset parallel Unbounded O(log P)
O(log P/loglogP)
Unrelated
machines
O(k)

Integrality Gap for our
LP(identical m/c)
0
m
k-1
2m
k-1
m
k
+m
k-1
m
k
m
k-1
m

T
1
Phase 0
1 k-1 k
Integrality Gap for our
LP(identical m/c)
For sufficiently large T, flow time mT(1+k/2)
0
m
k-1
2m
k-1
m
k
+m
k-1
T
Phase 0
1 k-1 k
Blue jobs can be scheduled only in this area of volume (m
k
+m
k-1
)m/2
At least m/2 blue jobs left At least mk/2 jobs left
Integrality Gap for our
LP(identical m/c)
Optimum fractional solution is roughly mT
0
m
k-1
2m
k-1
m
k
+m
k-1
m
k
m
k-1
m

T
1
Phase 0
1 k-1 k
Integrality gap
Optimum flow time is at least mT(1+k/2)
Optimum LP solution has value roughly mT
So integrality gap is O(k).
Largest job has size P = m
k
.
For k = m
c
, c>1, we get an integrality gap of
O(log P/loglogP)
Hardness results
We use the reduction from 3-dimensional
matching to makespan minimization on
unrelated machines [lenstra,shmoys,tardos]
to create a hard instance for subset-parallel.
Each phase of the integrality gap example
would have an instance created by the
above reduction.
To create a hard instance for parallel
machines we do a reduction from 3-
partition.
Preemptive, unweighted Flow
time
Online Offline
Parallel
machines
O(log P),
O(log P)

O(log
1-
P)
Related
machines
O(log P)
Subset parallel Unbounded O(log P)
O(log P/loglogP)
Unrelated
machines
O(k)

A bad example
0
T
B x
A x
A+B=T
A> T/2
T+L
A x
Flow time is at least AxL > T L/2
OPT flow time is O(T
2
+L)
(T) lower bound on any online
algorithm
Other Models
What if we allow the algorithm extra
resources ?
In particular, suppose the algorithm can
process (1+) units in 1 time-unit. [first
proposed by Kalyanasundaram,Pruhs95]
Resource Augmentation Model
Resource Augmentation
For a single machine, many natural
scheduling algorithms are O(1/c
O(1)
)-
competitive with respect to any L
p
norm
[Bansal Pruhs 03]
Parallel machines : randomly assign each
job to a machine O(1/c
O(1)
) competitive
[Chekuri, Goel, Khanna, Kumar 04]

Unrelated Machines : O(1/c
2
)-competitive, even
for weighted case. [Chadha, Garg, Kumar, Muralidhara 09]
O(1=
O( 1)
)
Our Algorithm
When a job arrives, we dispatch it to one of the
machines.

Each machine just follows the optimal policy :
Shortest Remaining Processing Time (SRPT)
What is the dispatch policy ?
GREEDY
p
j
1
(t)
The dispatch policy
When a job j arrives, compute for each machine i
the increase in flow-time if we dispatch j to i.
j
1
j
2
j
r
j
r+1
j
s
j arrives at time t : p
ij
1
(t) p
ij
2
(t)
p
ij
r
(t) < p
ij
< p
ij
r+1
(t)

j
Increase in flow-time =
p
j
1
(t) + + p
j
r
(t) + p
ij
+ p
ij
(s-r)

Our Algorithm
When a job j arrives, compute for each machine i
the increase in flow-time if we dispatch j to i.
Dispatch j to the machine for which
increase in fractional flow-time is minimum.
Analyzing our algorithm
Primal LP Dual LP
LP opt. value
Algorithms value
Construct a dual
solution
Show that the dual solution value and algorithms
flow-time are close to each other.
Dual LP
0 t) j, x(i,
t i, all for 1 t) j, x(i,
j all for 1
p
t) j, x(i,
t) j, x(i, ) r (t
p
t) j, x(i,
Min
j
t i,
ij
t j, i,
j
t j, i,
ij
>
s
=
+

it
Dual LP
0 ,
r t t, j, i, all for 1
p
r t
p
Max
it j
j
ij
j
it
ij
j
t i,
it
j
j
>
> +


p
j
1
(t)

j
= p
j
1
(t) + + p
j
r
(t) + p
ij
+ p
ij
(s-r)

Setting the Dual Values
When a job j arrives, set
j
to the increase in flow-
time when j is dispatched greedily.
j
1
j
2
j
r
j
r+1
j
s
j arrives at time t : p
ij
1
(t) p
ij
2
(t)
p
ij
r
(t) < p
ij
< p
ij
r+1
(t)

Thus
j

j
is equal to the total flow-
time.

it
= s
Setting the Dual Values
j
1
j
2
j
r
j
r+1
j
s
p
j
1
(t)
Set
it
to be the number of jobs waiting at time t for
machine i.
Thus
i,t

it
is equal to the total flow-
time.

Need to verify
Dual Feasibility
j
1
j
2
j
l
j
l+1
j
s
p
j
1
(t)
) ( l s + + + + s
j i' j i' j j j
p p (t) p ... (t) p
l 1
o
Fix a machine i, a job j and time t.
1
p
t t'
p
j i'
t' i'
j i'
j
+

+ s

Suppose p
ij
l
(t) < p
ij
< p
ij
l+1
(t)



Dual Feasibility
j
1
j
2
j
l
j
l+1
j
s
p
j
1
(t)
( ) l s + + + + s
j i' j i' j j j
p p (t) p ... (t) p
l 1
o
( ) 1 1
p
(t) p ... (t) p
p
t i'
j i'
j j
j i'
j
l 1
+ = + s + +
+ +
s s l s

1
What happens when t = t ?
Dual Feasibility
j
1
j
2
j
l
j
l+1
j
s
( )
( )
t' i'
j i' j i'
j i'
j j
j i'
j j j j
j i'
j
1
p
t) (t'
1) k - (s 1
p
t) (t'
1
p
(t) p ... (t) p t) (t'
1
p
(t) p ... (t) p (t) p ... (t) p
p
l k
l k 1 - k 1

l s
l s

+ +

= + + +

s
+ +
+ + +
s
+ +
+ + + + +
s

What happens when t = t + ?
Suppose at time t job j
k
is being processed
Case 1: k l
Dual Feasibility
j
2
j
r
j
r+1
j
s
( )
( )
t' i'
j i' j i'
j i'
j j j j
j i'
j i' j i' j j
j i'
j
1
p
t) (t'
1) k - (s 1
p
t) (t'
1
p
(t) p ... (t) p (t) p ... (t) p
p
p p (t) p ... (t) p
p
1 - k 1 l r 1
l 1

k s
l s
+ +

= + + +

s
+ + +
+ + + + +
s
+ + + +
s
+
1
Case 2: k > l

Dual Feasibility
So,
j
,
it
are dual feasible
But
i,t

it
and
j

j
both equal the total flow time
and hence the dual objective value is
1
p
t) (t'
p
j i'
t' i'
j i'
j
+

+ s

Hence, for any machine i, time t and job j


0
,
,
=

t i
t i
j
j
| o
Incorporating machine speed-up
So the values
j
,
it
/(1+) are dual feasible for an
instance with processing times larger by a factor (1+)
( ) ( )
1
p
t) (t'
p
j i'
t' i'
j i'
j
+
+

+
+
s
+ c c c 1 1 1

For any machine i, time t and job j


Equivalently, schedule given instance on machines of
speed (1+) to determine
j
,
it
. The values
j
,
it
/(1+)
are dual feasible.
Dual Objective Value
The dual value is less than the optimum fractional
flow time.

+
=
+

j
j
t i
t i
j
j
o
c
c
c
|
o
1 1
,
,
Since
i,t

it
=
j

j
the value of the dual is


Hence, the flow time of our solution,
j

j
, is at most
(1+1/) times the optimum fractional flow time.
Extensions
Can extend this analysis to the L
p
-norm of
the flow time to get a similar result.
Analysis also extends to the case of
minimizing sum of flow time and energy on
unrelated machines.

Open Problems
Single Machine :

Constant factor approximation algorithm for
weighted flow-time.
loglog n approx [Bansal Pruhs 10]
2+ quasi polynomial time algorithm [Chekuri Khanna
Zhu 01]
Open Problems
Parallel machines :

Constant factor approximation algorithm if
we allow migration of a job from one
machine to another.
The O(log
1-
P) hardness is for non-
migratory schedules

Open Problems
Unrelated Machines :

poly-log approximation algorithm
(LP integrality gap ?)
O(k) approximation [Sitters 08] is known,
where k is the number of different
processing times.

Вам также может понравиться