Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

General Guidelines for Programming Homeworks In your programming homeworks, you

ID: 3602173 • Letter: G

Question

General Guidelines for Programming Homeworks

In your programming homeworks, you are asked to code some well-known scheduling algorithms using Java programming language. Provided pseudocodes should guide you in writing the actual code for the algorithms.

Once your code compiles, test it with some examples to make sure that your code actually works. Use more than one example.

Read necessary input data from files that contain only numbers. Different data should be in different files. For example, all processing times should be in one file, weights should be in a different file etc.  

Use NetBeans Integrated Development Environment (IDE) for writing your code.

Code that does not compile without errors will not receive any partial credit.

Extended Pseudocode for Lawler’s Algorithm
1. for i = 1 to n do n(i) = ; //find number of unscheduled, direct successors for job i
2. US = {1,…,n}; p = ; //initial p is the completion time of the last job
3. for k = n to 1 do
BEGIN
4. Find job with n(j) = 0 and minimal fj(p)-value;
5. US = US {j}; //j is scheduled
6. n(j) = ;
7. (k) = j; //kth position is occupied by job j
8. p = p – pj;
9. for i = 1 to n do
if aij = 1 then n(i) = n(i) – 1;
END

Lawler’s Algorithm
Definitions
S := set of already scheduled jobs (initial: S = )
J := set of all jobs for which all successors have been scheduled (initial: all jobs)
p := time where next job will be completed (initial: p = )
Pseudocode
REPEAT
Select j J such that fj(p) = mink J fk(p);
Schedule j such that it completes at p;
Add j to S, delete j from J and update J;
p = p pj ;
UNTIL J = .

I want to be the code of the section mentioned in 9step

Explanation / Answer

Extended Pseudocode for Lawler’s Algorithm
1. for i = 1 to n do n(i) = ; //find number of unscheduled, direct successors for job i
2. US = {1,…,n}; p = ; //initial p is the completion time of the last job
3. for k = n to 1 do
BEGIN
4. Find job with n(j) = 0 and minimal fj(p)-value;
5. US = US {j}; //j is scheduled
6. n(j) = ;
7. (k) = j; //kth position is occupied by job j
8. p = p – pj;
9. for i = 1 to n do
if aij = 1 then n(i) = n(i) – 1;
END

Lawler’s Algorithm
Definitions
S := set of already scheduled jobs (initial: S = )
J := set of all jobs for which all successors have been scheduled (initial: all jobs)
p := time where next job will be completed (initial: p = )
Pseudocode
REPEAT
Select j J such that fj(p) = mink J fk(p);
Schedule j such that it completes at p;
Add j to S, delete j from J and update J;
p = p pj ;
UNTIL J = .