Sunday, March 16, 2014

We look at a job scheduling problem on a single machine  however, We look at jobs to be done on a single machine. Job i takes unit time.
Each job has to be finished by a deadline di
and each job has a profit pi
we get the profit only if i i completed before di.
The machine can only do one job at a time. For each job, machine can only do one job at a time.
Select a feasible subset of jobs to maximize the profit.
A feasible set is a subset that can be finished within the deadline.
If we take an example Jobs as follows:
Job        1                2                 3               4
Profit    100              10              15             27
Deadline 2                 1               2                1
When we enumerate the possible solutions, we see that the candidates {1,4 ] with order of processing 4, 1 and value 127 is the best solution.
The greedy strategy is the order by decreasing profit ie 1,4,3,2
The algorithm is as follows
Job GreedyJob(d, J, n)
{
J = {1};
for i = 2 to n do
{
 if all deadlines in J u {i} are feasible then
    J = J U {i}
}
return J;
}

J already has a job that can be scheduled and then we collect jobs in J.
In the algorithm the theorem we use is as follows:
If J = {1,2,..k} with increasing deadlines d1 <= d2 <= .... dk
then J is feasible iff 1,2, ... k is a feasible order.
and we use this fact: To check J is feasible sort it by deadlines and check that di >= i which is the time for every i.
We extend this J to J U {i}
J is the current solution. j1, j2, ... jk
d1 <= d2 <= ... dk
When we insert i we check if i is feasible with di > insert position.
also the jobs after the insert position were feasible for their positions but now that they are disturbed they need to be checked again.

Here we looked at single machine. The comparision between single and multi machines is that the former uses durations while the latter uses start, end pair. The former uses 0/1 profit and the latter uses penalty for delays. In general, job scheduling is not necessarily only greedy. It can be dynamic programming as well. Depending on the parameters of the scheduling problem, different algorithms may be required. If we use a greedy solution, we must show a proof of optimality.

No comments:

Post a Comment