+ All Categories
Home > Documents > Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Date post: 17-Dec-2015
Category:
Upload: beryl-foster
View: 224 times
Download: 7 times
Share this document with a friend
Popular Tags:
32
Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay
Transcript
Page 1: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Precedence Constrained Scheduling

Precedence Constrained Scheduling

Abhiram Ranade

Dept. of CSE

IIT Bombay

Page 2: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

InputInput

• Directed Acyclic Graph G, #processors p

A

B

C

D

E

F

G

H

, 3

Vertex = unit time taskedge (u,v) : Time(u) < Time(v)

Page 3: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Output: ScheduleOutput: Schedule

Time 1 2 3 4

Processor 1 A D E G

Processor 2 B F H

Processor 3 C

Schedule Length, to be minimized

Page 4: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

ApplicationsApplications

• Project management. Vertex = lay foundation, build walls. Edges: what happens first to what happens later.

• Processors : Number of workmen.

• MS Project, others.

• Our problem: Simplified version.

• Other applications: Parallel computing.

Page 5: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Summary of resultsSummary of results

• Polytime algorithm when p=2. [Fuiji.. 69]

• NP-hard for variable p. [LenKan 78]

• NP-hardness not known for fixed p > 2.

• Polytime algorithm for trees. [Hu 61]

Page 6: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Summary of results - 2Summary of results - 2

• Any greedy algorithm gives 2 - 1/p approximation. i.e. Schedule of length at most (2 - 1/p) times Optimal length.

• [Coffman-Graham 72, Lam-Sethi 77] give 2 - 2/p approximation algorithm.

• [Gangal-Ranade 08] give 2 – 7/(3p+1) approximation for p > 3.

Page 7: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

OutlineOutline

• Elementary Lower Bound ideas

• Elementary algorithm and analysis

• Deadline Constraints [GarJoh 76] More complex problem, but generates new ideas. 2 processor optimality, also without deadlines Essentially gives 2 - 2/p approximation

• Ideas behind 2 - 7/(3p+1) approximation algorithm

Page 8: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Elementary Lower BoundsElementary Lower Bounds

• To prove optimality of any algorithm, need to show why it cannot be improved, i.e. lower bound on schedule length.

• OPT H = Length of longest path in G.• OPT [ N / p ], N = #nodes [ x ] = ceiling(x), smallest integer x. Example: H = 3, [N/p] =[8/3] = 3

Page 9: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Generic AlgorithmGeneric Algorithm

1. Assign suitable “priority” to each vertex.2. Of all “ready” vertices pick one with least

priority value, and schedule it at earliest possible time slot.

3. Repeat until done.

ready = no predecessors yet unscheduled.earliest possible = after predecessors.

Page 10: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Priority ExamplePriority Example

• Priority(v) = length of longest path from v.

• Intuition: If many nodes depend upon me, then I should go first.

Page 11: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Proof of 2 approximationProof of 2 approximation

• Full (time-) slot: All processors busy• Number of “full” slots N/p• Number of partial slots H. Why?

Partial slot: Some processor did not get work. All maximally long paths must shrink. This can happen only H times.

• Time N/P + H OPT + OPT = 2 OPT• Improve to 2 - 1/p. Priority?

Page 12: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Deadline Constraints [GarJoh 76]

Deadline Constraints [GarJoh 76]

• Additional Input: Deadline D(v) : time by which v must be processed.

• Need a schedule with p processors in which precedence constraints and deadlines are respected.

Page 13: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Deadline PropagationDeadline Propagation

• v has N(d) descendants with deadline d v must itself finish by d - [N(d)/p].

new deadline: d(v) = min( D(v), mind d -[N(d)/p] )

• In what order to calculate?

• (u,v) edge d(u) < d(v)

• GJ Algo: priority = deadline. Optimal for p=2!

Page 14: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

ExampleExample

AB

E

D

C

4

4

4

.

.

.

.

d(A) = 4 - [7/5] = 2d(B) = min(4-[8/5], 2-[1/5]) = 1d(C) = …. = 3d(D) = = 2d(E) = . . . = 0

Page 15: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

GJ Deadline PropertiesGJ Deadline Properties

• Deadline < 1 : schedule not possible.• Optimal Schedule length Max deadline - Min deadline + 1. Example: 4 - 0 + 1 = 5• Load bound : [N/p] = [17/5] = 4• Longest path: H = 4• Is this the best lower bound?

Page 16: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

GJ Longest Path BoundGJ Longest Path Bound

• (u,v) is edge d(u) < d(v)

• Path u to v of length H d(u) < d(v) - H

• H < Max Deadline – Min Deadline

Page 17: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

GJ Load BoundGJ Load Bound

• Add a universal parent z

• d(z) Max deadline – [Number of descendants with Max deadline/p]

• = Max – [N/p]

• Min deadline Max – [N/p]

Page 18: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Scheduling without external deadlines

Scheduling without external deadlines

• Set d(terminal vertices) = k, some number.

• Propagate deadlines. m = least deadline.

• Schedule from time m using deadlines.

Theorem: Algorithm is optimal for p=2.

Page 19: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

2 Processor Optimality2 Processor Optimality

• v : earliest scheduled vertex not meeting deadline

• w : latest scheduled vertex before v scheduled alone. Always exists?

Nodes in region must be Descendants of w.

Region has 2(t-t’)-1nodes with

Deadline t-1.

d(w) t-1 - (2(t-t’)-1)/2 = t’-1 Contradiction

Time: 1 2 3 t’ t

Proc 1: w v

Proc 2: -

• d(w) t’, d(v) t-1

Page 20: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

RemarksRemarks

• Why does this not work for p > 2?

• Algorithm gives 2 - 2/p approximation for even p. More complex proof.

Page 21: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Improvements to GJ [GR 09]Improvements to GJ [GR 09]

• Node v has N(d,L) descendants at distance at least L+1 having deadline at least d

• Then d(v) mind,L d - L - [N(d,L)/p]

Page 22: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

ExampleExample

AB

E

D

C

4

4

4

.

.

.

.

d(A) = 4 - [7/5] = 2d(B) = min(4-[8/5], 2-[1/5]) = 1d(C) = …. = 3d(D) = = 2d(E) = . . . = 0

d(E) 4 – 2 – [12/5] = -1Max - min + 1 = 6. Optimal!

Page 23: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Algorithm [GR 08]Algorithm [GR 08]

• Set d(terminal vertices) = 0

• Propagate deadlines. New rule.

• For each v in non-decreasing deadline order: (Rearrange ancestors of v if possible). Schedule v in earliest possible slot, and

smallest numbered processor.

Page 24: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Rearrange ancestors of vRearrange ancestors of v

• Suppose t = last slot with ancestors of v.

• Suppose vertices in slots t-1,t have same deadline.

• Suppose v has < p ancestors in t-1,t.

• Then move ancestors of v to slot t-1, move other vertices to slot t.

• If slot t is not full, v can be scheduled in t.

Page 25: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Analysis OutlineAnalysis Outline

• Key part of proof: If algorithm constructs a long schedule, then deadline must drop a lot moving from last column to first.

• Max deadline - min deadline + 1 optimal schedule length.

• Optimal schedule must also be long, so good approximation factor.

Page 26: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

How deadline varies in the schedule

How deadline varies in the schedule

123..p

Time> 1 2 3 ….

u vw

Deadline can only increase in first row: d(u) d(v)

Deadline can only increase in any column: d(u) d(w)

Page 27: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Partial slot rule 1Partial slot rule 1

123..p

1 2 3 ….increasing time.

u vwxy--

Deadline must increase in first row after a partial slot:

d(u) < d(v) … why was not v scheduled earlier?

Page 28: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Partial slot rule 2Partial slot rule 2

123..p

1 2 3 ….increasing time.

u1 vu2

…uk

--

Let M denote the number of nodes scheduled after

u1..uk. Then d(u1) d(v) - [[M/k]/p]

Page 29: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Analysis DetailsAnalysis Details

• Count number of 1-slots, 2-slots, full slots present in schedule.

• Relate counts to deadline drop, using rules discussed.

• Find patterns of slot occupancies.

• Special rules for specific patterns.

• Combine estimates and take best.

Page 30: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Intuition: Easy schedulesIntuition: Easy schedules

• Suppose all slots are partial: drop per slot.• Thus total deadline drop = length of

schedule.• Optimal!• Suppose all slots are either 1 slots or full

slots.• Partial slot rule 2 gives optimality.

Page 31: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Intuition: Difficult SchedulesIntuition: Difficult Schedules

• Schedules with mixture of 2-slots and full slots.

• Extreme case 1: 2-slots at the beginning, full slots at the end.

• Extreme case 2: 2 slots and full slots alternate.

• Omitted. See paper.

Page 32: Precedence Constrained Scheduling Abhiram Ranade Dept. of CSE IIT Bombay.

Concluding RemarksConcluding Remarks

• Analysis is complicated, but not much more than 2-2/p analysis of Lam-Sethi.

• Algorithm is simpler than Coffman-Graham.

• Technique will not work beyond 2 - 3/p. Even getting there is hard.


Recommended