I am trying to understand how Greedy Algorithm scheduling problem works.
So I've been reading and googling for a while since I could not understand Greedy algorithm scheduling problem.
We have n jobs to schedule on a single resource. The job (i) has a requested start time s(i) and finish time f(i).
There are some greedy ideas which we select...
- Accept in increasing order of s ("earliest start time")
- Accept in increasing order of f - s ("shortest job time")
- Accept in increasing order of number of conflicts ("fewest conflicts")
- Accept in increasing order of f ("earliest finish time")
And the book says the last one, accept in increasing order of f will always gives an optimal solution.
However it did not mention why it always gives optimal solution and why other 3 will not give optimal solution.
They provided the figure that says why other three will not provide optimal solution but I could not understand what it means.
Since I have low reputation, I can not post any image so I will try to draw it.
|---| |---| |---|
|-------------------------|
increasing order of s
underestimated solution
|-----------| |-----------|
|-----|
increasing order of f-s
underestimated solution
|----| |----| |----| |----|
|-----| |-----| |-----|
|-----| |-----|
|-----| |-----|
increasing order of number of conflicts. underestimated solution
This is what it looks like and I don't see why this is a counterexample of each scenario.
If anyone can explain why each greedy idea does/ does not work, it will be very helpful.
Thank you.