Top Banner
Minimizing Average Flow- Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha ,V Muralidha
58

Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Mar 29, 2015

Download

Documents

Emilia Wickers
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Minimizing Average Flow-Time

Naveen Garg

IIT Delhi

Joint work with Amit Kumar, Jivi Chadha ,V Muralidhara, S. Anand

Page 2: 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

pij

r j

r j

Page 3: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Problem Definition Conditions :

r j

r j Pre-emption allowed

Migration not allowed

Page 4: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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

Page 5: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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

pij=p j

pij=p j /s i

pij p j

All of these are NP-hard.

Page 6: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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 (log P) on competitive ratio

Page 7: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Preemptive, unweighted Flow time

Online OfflineParallel machines

O(log P), (log P) [LR97]

(log1-ε P) [GK07]

Related machines

O(log P) [GK06]

Subset parallel

Unbounded [GK07]

O(log P) (log P/loglogP) [GK07]

Unrelated machines

O(k) [S09]

Page 8: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Fractional flow-time

O(1=²O(1))

pj(t) = remaining processing of job j at time t remaining fraction at time t =

ab

time processing total

(t)pj

Fractional flow-time of j = t≥rj pj(t)/pj

Recall, flow-time of j =

j

j

C

rt

1

Page 9: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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))

20

Page 10: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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 ≥ rj (t-rj) x(i,j,t)/pij

Page 11: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

LP Relaxation

0t)j,x(i,

ti,allfor1t)j,x(i,

jallfor1p

t)j,x(i,

)r(tp

t)j,x(i,Min

j

ti, ij

jtj,i, ij

One Caveat …

Page 12: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Fractional flow-time

A job can be done simultaneously on many machines : flow-time is almost 0

Page 13: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

LP Relaxation

0t)j,x(i,

ti,allfor1t)j,x(i,

jallfor1p

t)j,x(i,

t)j,x(i,)r(tp

t)j,x(i,Min

j

ti, ij

tj,i,j

tj,i, ij

Add a term for processing time

Page 14: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Class of a job

p j : The processing time of j rounded up to nearest power of 2

p j 2 kIf , we say k is the class of job j

Number of different classes = O(log P)

Page 15: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Modified Linear Program

0t)j,x(i,

ti,allfor1t)j,x(i,

jallfor1p

t)j,x(i,

t)j,x(i,)r(tp

t)j,x(i,Min

j

ti, ij

tj,i,j

tj,i, ij

Page 16: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Modified LP

LP value changes by a constant factor only.

But : rearranging jobs of the same class does not change objective value.

Page 17: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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/c’s.

• We now show how to get a feasible, non-migratory schedule.

Page 18: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Rounding the LP solution

• Consider jobs of one class, say blue.

• Find the optimum solution to the LP.

Page 19: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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

Page 20: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Preemptive, unweighted Flow time

Online OfflineParallel machines

O(log P), (log P) (log1-ε P)

Related machines

O(log P)

Subset parallel Unbounded O(log P)(log P/loglogP)

Unrelated machines

O(k)

Page 21: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Assignment as flowFix a class k : arrange the jobs in ascending order of release dates.

r10

iv(i,k,j)

z i , jtx i , j , t

p j

s

Flow = ?

r7r6r5r4r3r2

Page 22: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Unsplittable Flow Problem

s

d1 d2

d3

Page 23: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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]

Page 24: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Back to scheduling...Fix a class k : find unsplittable flow

10 2 3 4 5 6 7

iv(i,j,k) p j

s

Gives assignment of jobs to machines

Page 25: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Back to scheduling...J(i,k) : jobs assigned to machine i

10 2 3 4 5 6 7

iv(i,j,k) p j

s

Can we complete J(i,k) on class k slots in I ?

Page 26: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Building the Schedule

Flow increases by at most max processing time = 2k

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

Page 27: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Increase in Flow-timeHow well does

capture the flow-time of j ?

Charge to the processing time of other classes

1

ij

j

ti, p

)r(tt)j,x(i,

Page 28: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Finally...Since there are only log P classes…

Can get OPT + O(log P).processing time flow-time for subset parallel case.

Page 29: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Preemptive, unweighted Flow time

Online OfflineParallel machines

O(log P), (log P) (log1-ε P)

Related machines

O(log P)

Subset parallel Unbounded O(log P)(log P/loglogP)

Unrelated machines

O(k)

Page 30: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Integrality Gap for our LP(identical m/c)

0 mk-1 2mk-1 mk +mk-1

mk

mk-1

m

T

1

Phase 0 1 k-1 k

Page 31: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Integrality Gap for our LP(identical m/c)

• For sufficiently large T, flow time ≥ mT(1+k/2)

0 mk-1 2mk-1 mk +mk-1

T

Phase 0 1 k-1 k

Blue jobs can be scheduled only in this area of volume (mk+mk-1)m/2

At least m/2 blue jobs left At least mk/2 jobs left

Page 32: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Integrality Gap for our LP(identical m/c)

• Optimum fractional solution is roughly mT

0 mk-1 2mk-1 mk +mk-1

mk

mk-1

m

T

1

Phase 0 1 k-1 k

Page 33: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Integrality gap• Optimum flow time is at least mT(1+k/2)• Optimum LP solution has value roughly mT• So integrality gap is (k).• Largest job has size P = mk.• For k = mc, c>1, we get an integrality gap of (log P/loglogP)

Page 34: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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.

Page 35: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Preemptive, unweighted Flow time

Online OfflineParallel machines

O(log P), (log P) (log1-ε P)

Related machines

O(log P)

Subset parallel Unbounded O(log P)(log P/loglogP)

Unrelated machines

O(k)

Page 36: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

A bad example

0 T

B x

A x

A+B=TA> T/2

T+L

A x

Flow time is at least AxL > T L/2OPT flow time is O(T2+L) Ω(T) lower bound on any online algorithm

Page 37: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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

Page 38: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Resource Augmentation

• For a single machine, many natural scheduling algorithms are O(1/eO(1))-competitive with respect to any Lp norm [Bansal Pruhs ‘03]

• Parallel machines : randomly assign each job to a machine – O(1/eO(1)) competitive

[Chekuri, Goel, Khanna, Kumar ’04]

• Unrelated Machines : O(1/e2)-competitive, even for weighted case. [Chadha, Garg, Kumar, Muralidhara ‘09]

O(1=²O(1))

Page 39: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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

Page 40: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

pj1(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.

j1

j2

jr

jr+1

js

j arrives at time t : pij1(t) ≤ pij2

(t) ≤ …

pijr(t) < pij < pijr+1

(t)

j

Increase in flow-time = pj1

(t) + … + pjr(t) + pij+ pij(s-r)

Page 41: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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.

Page 42: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Analyzing our algorithm

Primal LPDual LP

LP opt. valueAlgorithm’s value

Construct a dualsolution

Show that the dual solution value and algorithm’s flow-time are close to each other.

Page 43: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Dual LP

0t)j,x(i,

ti,allfor1t)j,x(i,

jallfor1p

t)j,x(i,

t)j,x(i,)r(tp

t)j,x(i,Min

j

ti, ij

tj,i,j

tj,i, ij

αj

βit

Page 44: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Dual LP

0,

rtt,j,i,allfor1p

rt

p

Max

itj

jij

jit

ij

j

ti,it

jj

βα

βα

βα

Page 45: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

pj1(t)

αj = pj1

(t) + … + pjr(t) + pij + pij(s-r)

Setting the Dual Values

When a job j arrives, set αj to the increase in flow-time when j is dispatched greedily.

j1

j2

jr

jr+1

js

j arrives at time t : pij1(t) ≤ pij2

(t) ≤ …

pijr(t) < pij < pijr+1

(t)

Thus j αj is equal to the total flow-time.

Page 46: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

βit = s

Setting the Dual Values

j1

j2

jr

jr+1

js

pj1(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.

Page 47: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Need to verify

Dual Feasibility

j1

j2

jl

jl+1

js

pj1(t)

)( ls ji'ji'jjj pp(t)p...(t)pl1

Fix a machine i’, a job j and time t’.

1p

tt'p ji'

t'i'ji'

j

βα

Suppose pi’jl(t) < pi’j < pi’jl+1

(t)

Page 48: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Dual Feasibility

j1

j2

jl

jl+1

js

pj1(t)

ls ji'ji'jjj pp(t)p...(t)pl1

11p

(t)p...(t)p

p ti'ji'

jj

ji'

j l1

βslsα

1

What happens when t’ = t ?

Page 49: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Dual Feasibility

j1

j2

jl

jl+1

js

t'i'ji'ji'

ji'

jj

ji'

jjjj

ji'

j

1p

t)(t'1)k-(s 1

pt)(t'

1p

(t)p...(t)pt)(t'

1p

(t)p...(t)p(t)p...(t)p

p

lk

lk1-k1

β

ls

lsα

δ

What happens when t’ = t + δ? Suppose at time t’ job jk is being processed

Case 1: k ≤ l

Page 50: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Dual Feasibility

j2

jr

jr+1

js

t'i'ji'ji'

ji'

jjjj

ji'

ji'ji'jj

ji'

j

1p

t)(t'1)k-(s 1

pt)(t'

1p

(t)p...(t)p(t)p...(t)p

p

pp(t)p...(t)p

p

1-k1lr1

l1

β

ks

lsα

1

Case 2: k > l ¢

Page 51: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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

1p

t)(t'p ji'

t'i'ji'

j

βα

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

0,

, ti

tij

j

Page 52: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Incorporating machine speed-up

So the values αj, βit/(1+ε) are dual feasible for an instance with processing times larger by a factor (1+ε)

1pt)(t'

p ji'

t'i'

ji'

j

111

βα

For any machine i’, time t’ and job j

Equivalently, schedule given instance on machines ofspeed (1+ε) to determine αj, βit. The values αj, βit/(1+ε) are dual feasible.

Page 53: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Dual Objective Value

The dual value is less than the optimum fractional flow time.

jj

ti

ti

jj

11,

,

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.

Page 54: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Extensions

• Can extend this analysis to the Lp-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.

Page 55: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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]

Page 56: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Open Problems

Parallel machines :

Constant factor approximation algorithm if we allow migration of a job from one machine to another.

The (log1-ε P) hardness is for non-migratory schedules

Page 57: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

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.

Page 58: Minimizing Average Flow-Time Naveen Garg IIT Delhi Joint work with Amit Kumar, Jivi Chadha,V Muralidhara, S. Anand.

Thank You