41
Scheduling Jobs On Identical Parallel Machines Greedy Algorithm & Local Search Prepared By Mir Md. Asif Hossain Student Id : 0805070

Scheduling jobs on identical parallel machines

Embed Size (px)

DESCRIPTION

This presentation was made as an assignment in my University. Here I have tried to explain one of the oldest approximation algorithm The List Scheduling Algorithm. The idea is to schedule some jobs in some identical parallel machaine.

Citation preview

Page 1: Scheduling jobs on identical parallel machines

Scheduling Jobs On Identical Parallel Machines

Greedy Algorithm & Local Search

Prepared ByMir Md. Asif HossainStudent Id : 0805070

Page 2: Scheduling jobs on identical parallel machines

Problem Overview‘n’ Different Jobs

‘j’=1 to nWith processing time Pj =1 to ‘n’

JOB 1

JOB 2

JOB 3

JOB ‘N’

All Jobs Are Present At Time 0

Page 3: Scheduling jobs on identical parallel machines

Problem Overview

‘m’ Identical Parallel Machine‘i’=1 to m

M1

M2

M4

Mm

Page 4: Scheduling jobs on identical parallel machines

Problem Overview

Aim is to complete all jobs as soon as possible

JOB 1

JOB 2

JOB 3

JOB 4

JOB 5

JOB 6 NP HARD

JOB 1

JOB 3

JOB 2

JOB 6 JOB 4

JOB 5

Schedule

Page 5: Scheduling jobs on identical parallel machines

Problem Overview

Goal

If job ‘J’ completes at a time Cj

then minimize Cmax = max(j=1,...,n Cj)

Cj is often called the makespan or length of the schedule

Page 6: Scheduling jobs on identical parallel machines

Local Search Algorithm For Scheduling Jobs At Identical Parallel Machine

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat step until no other Job left to reassigned.

Page 7: Scheduling jobs on identical parallel machines

Example Consider a scenario with 7 jobs and 4 parallel machine

JOB 1

JOB 2

JOB 3

JOB 4

JOB 5

JOB 6

JOBS Machines

JOB 7

Page 8: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat step until no other Job left to reassigned.

Page 9: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3 JOB 4JOB 5

JOB 6

JOB 7

Page 10: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat steps until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3 JOB 4JOB 5

JOB 6

JOB 7

Page 11: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat steps until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3 JOB 4JOB 5

JOB 6

JOB 7

Page 12: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat step 3 until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3 JOB 4JOB 5

JOB 6

JOB 7

Page 13: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat step 3 until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3 JOB 4JOB 5

JOB 6

JOB 7

Page 14: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat step 3 until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3 JOB 4JOB 5

JOB 6

JOB 7

Page 15: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat step 3 until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3 JOB 4JOB 5

JOB 6

JOB 7

Page 16: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat step 3 until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3 JOB 4JOB 5

JOB 6

JOB 7

Page 17: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat steps until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3

JOB 4

JOB 5

JOB 6

JOB 7

Page 18: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat steps until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3

JOB 4

JOB 5

JOB 6

JOB 7

Page 19: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat steps until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3

JOB 4

JOB 5

JOB 6

JOB 7

Page 20: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat steps until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3

JOB 4

JOB 5

JOB 6

JOB 7

Page 21: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat step 3 until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3

JOB 4

JOB 5

JOB 6

JOB 7

Page 22: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat steps until no other Job left to reassigned.

JOB 1

JOB 2

JOB 3

JOB 4

JOB 5

JOB 6

JOB 7

Page 23: Scheduling jobs on identical parallel machines

Example

1.Start with any schedule2. Consider job ‘l’ that finishes last3. If there is any machine to which it can be reassigned such that this

job finishes earlier . Reassigned the Job.

4. Repeat steps until no other Job left to reassigned.

JOB 1 JOB 2

JOB 3

JOB 4

JOB 5

JOB 6

JOB 7

Page 24: Scheduling jobs on identical parallel machines

Algorithm Analysis

We first provide some natural lower bounds on the length of an optimal schedule Cmax

Total work done

Average work in each machine is P/m

So

Page 25: Scheduling jobs on identical parallel machines

Algorithm AnalysisConsider solution of local search algorithm. Let ℓ be a job that completeslast in this final schedule; the completion time of job ℓ, Cℓ

Partition Total Time into two parts

Sℓ = Cℓ − pℓ pℓ

Page 26: Scheduling jobs on identical parallel machines

Algorithm Analysis

Total work done in 1st part m*Sℓ <= total work

So

From 2.4

Hence

Page 27: Scheduling jobs on identical parallel machines

Theorem 2.5: The local search procedure for scheduling jobs on identical parallel machines is

a 2-approximation algorithm

From inequality 2.5 we can write thatProof

hence the total length of the schedule produced is at most

By applying lower bounds 2.3 and 2.4 we get that schedule length is at most 1/m is significant only when m is small.

Page 28: Scheduling jobs on identical parallel machines

Greedy Algorithm For Scheduling Jobs At Identical Parallel Machine

Whenever a machine is Idle If there is at least a job in the list then

One of the remaining jobs is assigned to start processing on that machine

Often Called As List Scheduling Algorithm

Page 29: Scheduling jobs on identical parallel machines

Example Consider a scenario with 7 jobs and 4 parallel machine

JOB 1,3

JOB 2,2

JOB 3,5

JOB 4,2

JOB 5,3

JOB 6,2

JOBS Machines

JOB 7,4

Page 30: Scheduling jobs on identical parallel machines

Example Consider a scenario with 7 jobs and 4 parallel machine

JOB 1,3

JOB 2,2

JOB 3,5

JOB 4,2

JOB 5,3

JOB 6,2

JOBS Machines

JOB 7,4

JOB 1,3

Page 31: Scheduling jobs on identical parallel machines

Example Consider a scenario with 7 jobs and 4 parallel machine

JOB 2,2

JOB 3,5

JOB 4,2

JOB 5,3

JOB 6,2

JOBS Machines

JOB 7,4

JOB 1,3

JOB 2,2

Page 32: Scheduling jobs on identical parallel machines

Example Consider a scenario with 7 jobs and 4 parallel machine

JOB 3,5

JOB 4,2

JOB 5,3

JOB 6,2

JOBS Machines

JOB 7,4

JOB 1,3

JOB 2,2

JOB 3,5

Page 33: Scheduling jobs on identical parallel machines

Example Consider a scenario with 7 jobs and 4 parallel machine

JOB 4,2

JOB 5,3

JOB 6,2

JOBS Machines

JOB 7,4

JOB 1,3

JOB 2,2

JOB 3,5

JOB 4,2

Page 34: Scheduling jobs on identical parallel machines

Example Consider a scenario with 7 jobs and 4 parallel machine

JOB 5,3

JOB 6,2

JOBS Machines

JOB 7,4

JOB 1,3

JOB 2,2

JOB 3,5

JOB 4,2

JOB 5,3

Page 35: Scheduling jobs on identical parallel machines

Example Consider a scenario with 7 jobs and 4 parallel machine

JOB 6,2

JOBS Machines

JOB 7,4

JOB 1,3

JOB 2,2

JOB 3,5

JOB 4,2

JOB 5,3

JOB 6,2

Page 36: Scheduling jobs on identical parallel machines

Example Consider a scenario with 7 jobs and 4 parallel machine

JOBS Machines

JOB 7,4

JOB 1,3

JOB 2,2

JOB 3,5

JOB 4,2

JOB 5,3

JOB 6,2

JOB 7,4Cmax = 3+4 = 7

Page 37: Scheduling jobs on identical parallel machines

Theorem 2.6: The list scheduling algorithm for the problem of minimizing the makespan on

m identical parallel machines is a 2-approximation algorithm.

Proof

It can be proofed that list scheduling can be reduced to local search algorithm. To see this, If we uses this schedule as the starting point for the local search procedure, that algorithm would immediately declare that the solution cannot be improved.

Page 38: Scheduling jobs on identical parallel machines

Improving Our Greedy Approach

Different lists yield different results

Add additional greedy rule to sort the jobs in the list in non decreasing order

This greedy algorithmis called the longest processing time rule, or LPT.

Page 39: Scheduling jobs on identical parallel machines

Example Consider a scenario with 7 jobs and 4 parallel machine

JOB 1,3

JOB 2,2

JOB 3,5

JOB 4,2

JOB 5,3

JOB 6,2

JOBS Machines

JOB 7,4

Page 40: Scheduling jobs on identical parallel machines

Example Consider a scenario with 7 jobs and 4 parallel machine

JOB 1,3

JOB 2,2

JOB 3,5

JOB 4,2

JOB 5,3

JOB 6,2

JOBSMachines

JOB 7,4 JOB 3,5

JOB 7,4

JOB 5,3 JOB 2,2

JOB 6,2

JOB 1,3

JOB 4,2

Page 41: Scheduling jobs on identical parallel machines

Theorem 2.7: The longest processing time rule is a 4/3-approximation algorithm for schedulingjobs to minimize the makespan on identical

parallel machines.

Any counterexample for which the last job ℓ to complete is not the smallest canyield a smaller counterexample, simply by omitting all of the jobs ℓ +1, . . . , n; the length of the schedule produced is the same, and the optimal value of the reduced input can be no larger. Hence the reduced input is also a counterexample.