3

Well, we have the greedy algorithm for the job scheduling (scheduling the maximum number of jobs). we can use different techniques

  1. Shortest job first
  2. Earliest start time first
  3. Job with minimal conflicts first
  4. Earliest end time first

I have the counter example of first three strategies but I couldn't find the counter example for the fourth one.

here are the counter examples for first three methods

Shortest Job First :

Here we can schedule 2 jobs instead of one shorter. enter image description here

Earliest start time first :

Here we can schedule 6 smaller job that starts later instead on one that start earlier enter image description here

Job with minimal conflicts first :

Here we can schedule 4 jobs with conflicts 3,4,4,3 instead of 3 with minimal conflicts, that's 2,3,3

enter image description here

So, what would be the counter example of the last one Earliest end time first I couldn't find the counter example for this. So, it always gives an optimum solution for each set of data?

UPDATE 1 :

I have one executor to execute the job and I want to execute the maximum number of jobs.

Community
  • 1
  • 1
Muaaz Khalid
  • 2,199
  • 2
  • 28
  • 51
  • 2
    It is not clear what you are optimizing for. Are you optimizing for execution of maximum number of jobs? If that is the case then it is optimal. You can actually prove it :) – ElKamina Aug 31 '16 at 04:17
  • I have to schedule the maximum number of jobs. Sorry I didn't mention. – Muaaz Khalid Aug 31 '16 at 04:20
  • 2
    Maybe there's no counterexample and this is indeed an optimal strategy. Try to prove iit. – n. m. could be an AI Aug 31 '16 at 04:46
  • 1
    I think ElKamina is correct, and a fairly standard method of proof works here. Consider a schedule that is not earliest end time first. Find the first choice it makes which is not earliest end time first. Show that you can replace this choice to make it earliest end time first without upsetting anything else and still keeping the schedule as good as it was. Therefore any schedule not earliest end time first can be replaced by one that is and still work and still be at least as good. – mcdowella Aug 31 '16 at 04:52

1 Answers1

6

Earliest End time First is the greedy algorithm which gives optimal algorithm for above mentioned problem. (Actually the problem you have mentioned is called Interval Scheduling problem)

The proof can be done using charging argument. You compare the output of greedy algorithm to optimal solution and argue that you solution is not worse than optimal.

Rishit Sanmukhani
  • 2,159
  • 16
  • 26