Garg Slides

download Garg Slides

of 58

Transcript of Garg Slides

  • 7/30/2019 Garg Slides

    1/58

    Minimizing Average Flow-Time

    Naveen Garg

    IIT Delhi

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

  • 7/30/2019 Garg Slides

    2/58

    Problem Definition

    Given : A set of M machinesA set of jobs

    A matrix of processing times of

    job ion machine j.Each job specifies a release date

    pij

    rj

    rj

  • 7/30/2019 Garg Slides

    3/58

    Problem Definition

    Conditions :

    rj

    rj Pre-emption allowed

    Migration not allowed

  • 7/30/2019 Garg Slides

    4/58

    Problem Definition

    rj Cj

    Flow-time of j,

    Goal : Find a schedule which minimizes the average flow-time

    Fj= Cj rj

  • 7/30/2019 Garg Slides

    5/58

    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 i j= p j/si

    pij pj

    All of these are NP-hard.

  • 7/30/2019 Garg Slides

    6/58

    Previous work

    The problem is well studied when themachines are identical.

    For a single machine the Shortest-

    remaining-processing-time (SRPT) rule isoptimum.

    [Leonardi-Raz 97] argued that for parallel

    machines SRPT is O(min (log n/m, log P))competitive, where P is max/minprocessing time. They also show a lowerbound of(log P) on competitive ratio

  • 7/30/2019 Garg Slides

    7/58

    Preemptive, unweighted Flow

    time

    Online Offline

    Parallel

    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]

  • 7/30/2019 Garg Slides

    8/58

    Fractional flow-time

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

    remaining fraction at time t =

    timeprocessingtotal

    (t)pj

    Fractional flow-time of j = trj

    pj(t)/pj

    Recall, flow-time of j =

    j

    j

    C

    rt

    1

  • 7/30/2019 Garg Slides

    9/58

    Fractional flow-time

    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

    20

  • 7/30/2019 Garg Slides

    10/58

    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

  • 7/30/2019 Garg Slides

    11/58

    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

  • 7/30/2019 Garg Slides

    12/58

    Fractional flow-time

    A job can be done simultaneously on many

    machines : flow-time is almost 0

  • 7/30/2019 Garg Slides

    13/58

    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

  • 7/30/2019 Garg Slides

    14/58

    Class of a job

    pj

    : The processing time of j rounded up

    to nearest power of 2

    pj

    2k

    If , we say k is the class of job j

    Number of different classes = O(log P)

  • 7/30/2019 Garg Slides

    15/58

    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

  • 7/30/2019 Garg Slides

    16/58

    ModifiedLP

    LP value changes by a constant factor only.

    But : rearranging jobs of the same class does

    not change objective value.

  • 7/30/2019 Garg Slides

    17/58

    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.

  • 7/30/2019 Garg Slides

    18/58

    Rounding the LP solution

    Consider jobs of one class, say blue.

    Find the optimum solution to the LP.

  • 7/30/2019 Garg Slides

    19/58

    Rounding the LP solution

    (contd.)

    Rearrange blue jobs in the space occupied

    by the blue jobs so that each job isscheduled on only one m/c.

    If additional space is needed it is createdat the end of the schedule

    Additional

    space

  • 7/30/2019 Garg Slides

    20/58

    Preemptive, unweighted Flow

    time

    Online Offline

    Parallel

    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)

  • 7/30/2019 Garg Slides

    21/58

    Assignment as flow

    Fix a class k : arrange the jobs in ascending order ofrelease dates.

    r10

    iv(i,k,j)

    z i , j t

    x i , j , t

    p j

    s

    Flow = ?

    r7

    r6r5r4r3r2

  • 7/30/2019 Garg Slides

    22/58

    Unsplittable Flow Problem

    s

    d1 d2

    d3

  • 7/30/2019 Garg Slides

    23/58

    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]

  • 7/30/2019 Garg Slides

    24/58

    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

  • 7/30/2019 Garg Slides

    25/58

    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 ?

  • 7/30/2019 Garg Slides

    26/58

    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 packedinto these slots

    Extra slots are created at the end to accommodate

    this spillover

  • 7/30/2019 Garg Slides

    27/58

    Increase in Flow-time

    How well does

    capture the flow-time of j ?

    Charge to the processing time of other classes

    1ijj

    ti, p)r(tt)j,x(i,

  • 7/30/2019 Garg Slides

    28/58

    Finally...

    Since there are only log P classes

    Can get OPT + O(log P).processing time

    flow-time for subset parallel case.

  • 7/30/2019 Garg Slides

    29/58

    Preemptive, unweighted Flow

    time

    Online Offline

    Parallel

    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)

  • 7/30/2019 Garg Slides

    30/58

    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

  • 7/30/2019 Garg Slides

    31/58

    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-1T

    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

  • 7/30/2019 Garg Slides

    32/58

    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

  • 7/30/2019 Garg Slides

    33/58

    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)

  • 7/30/2019 Garg Slides

    34/58

    Hardness results

    We use the reduction from 3-dimensionalmatching to makespan minimization onunrelated machines [lenstra,shmoys,tardos]to create a hard instance for subset-parallel.

    Each phase of the integrality gap examplewould have an instance created by theabove reduction.

    To create a hard instance for parallelmachines we do a reduction from 3-partition.

  • 7/30/2019 Garg Slides

    35/58

    Preemptive, unweighted Flow

    time

    Online Offline

    Parallel

    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)

  • 7/30/2019 Garg Slides

    36/58

    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(T2+L)

    (T) lower bound on any online

    algorithm

  • 7/30/2019 Garg Slides

    37/58

    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

  • 7/30/2019 Garg Slides

    38/58

    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, evenfor weighted case. [Chadha, Garg, Kumar, Muralidhara 09]

  • 7/30/2019 Garg Slides

    39/58

    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

  • 7/30/2019 Garg Slides

    40/58

    pj1(t)

    The dispatch policy

    When a job j arrives, compute for each machine ithe increasein 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)

  • 7/30/2019 Garg Slides

    41/58

    Our Algorithm

    When a job j arrives, compute for each machine ithe increasein flow-time if we dispatch j to i.

    Dispatch j to the machine for which

    increase in fractional flow-time is minimum.

  • 7/30/2019 Garg Slides

    42/58

    Analyzing our algorithm

    Primal LPDual LP

    LP opt. valueAlgorithms value

    Construct a dual

    solution

    Show that the dual solution value and algorithms

    flow-time are close to each other.

  • 7/30/2019 Garg Slides

    43/58

    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

  • 7/30/2019 Garg Slides

    44/58

    Dual LP

    0,

    rtt,j,i,allfor1prt

    p

    Max

    itj

    jij

    jit

    ij

    j

    ti,it

    jj

  • 7/30/2019 Garg Slides

    45/58

    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 jj is equal to the total flow-

    time.

  • 7/30/2019 Garg Slides

    46/58

    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,tit is equal to the total flow-time.

  • 7/30/2019 Garg Slides

    47/58

    Need to verify

    Dual Feasibility

    j1

    j2

    jl

    jl+1

    js

    pj1(t)

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

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

    1p tt'p ji't'i'

    ji'

    j

    Suppose pijl(t) < pij < pijl+1(t)

  • 7/30/2019 Garg Slides

    48/58

    Dual Feasibility

    j1

    j2

    jl

    jl+1

    js

    pj1(t) lsji'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 ?

  • 7/30/2019 Garg Slides

    49/58

    Dual Feasibility

    j1

    j2

    jl

    jl+1

    js

    t'i'ji'ji'

    ji'

    jj

    ji'

    jjjj

    ji'

    j

    1p

    t)(t'1)k-(s1

    p

    t)(t'

    1

    p

    (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

  • 7/30/2019 Garg Slides

    50/58

    Dual Feasibility

    j2

    jr

    jr+1

    js

    t'i'ji'ji'

    ji'

    jjjj

    ji'

    ji'ji'jj

    ji'

    j

    1p

    t)(t'1)k-(s1

    p

    t)(t'

    1

    p

    (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

  • 7/30/2019 Garg Slides

    51/58

    Dual Feasibility

    So, j, it are dual feasible

    But i,tit and jj 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

    ti

    j

    j

  • 7/30/2019 Garg Slides

    52/58

    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 ji'

    t'i'

    ji'

    j

    eee 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.

  • 7/30/2019 Garg Slides

    53/58

    Dual Objective Value

    The dual value is less than the optimum fractional

    flow time.

    j

    j

    ti

    ti

    j

    j e

    e

    e

    11,

    ,

    Since i,tit = jj the value of the dual is

    Hence, the flow time of our solution, jj, is at most(1+1/) times the optimum fractional flow time.

  • 7/30/2019 Garg Slides

    54/58

    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 onunrelated machines.

  • 7/30/2019 Garg Slides

    55/58

    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]

  • 7/30/2019 Garg Slides

    56/58

    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

  • 7/30/2019 Garg Slides

    57/58

    Open Problems

    Unrelated Machines :

    poly-log approximation algorithm

    (LP integrality gap ?)

    O(k) approximation [Sitters 08] is known,

    where k is the number of differentprocessing times.

  • 7/30/2019 Garg Slides

    58/58

    Thank You