I am reading topic on scheduling algorithm analysis:
suppose we have the four jobs and associated running times shown
below. One possible schedule j1, j2, j3, and j4 Because j1 finishes
in 15 (time units), j2 in 23, j3 in 26, and j4 in 36, the average
completion time is 25. A better schedule, which yields a mean
completion time of 17.75, is j3, j2, j4 and j1.Job Time
j1 15
j2 8
j3 3
j4 10
My question how author calculated average completion time i.e., how we got 25 and 17.75 in above text?
Thanks!
The jobs run serially (one at a time).
Hence with order
j1-j2-j3-j4,j1finishes at15,j2finishes at15+8=23,j3finishes at15+8+3=26andj4finishes at15+8+3+10=36. They then average15,23,26and36to get25using your standardsum/countformula:In other words, the completion time they’re talking about is not how long a job took from when it started but how long it took from the start of the first job (ie, a point in time rather than a duration). I’m not sure how useful such a metric is, but that’s what they’re doing, based on the figures.
With order
j3-j2-j4-j1,j3finishes at3,j2finishes at3+8=11,j4finishes at3+8+10=21andj1finishes at3+8+10+15=36. The average of that (3,11,21and36) is17.75.The optimum (lowest) solution for the average finishing time is to do the jobs in order of increasing duration.
That’s because the last job in a set of four will always finish at the same time, regardless of order (
36in this case).So, in order to reduce the average finishing point, the finishing points of the other three jobs should be as low as possible.
And, the same rule that applies to four jobs also applies to three jobs (once the longest-running
j1is taken out of the mix). Then two jobs, once you’ve removedj4.Once you’ve removed three jobs, the only one standing is the one you should choose (of course).