1.56k likes | 1.8k Views
AMA522 SCHEDULING. Set # 2 Dr. LEE Heung Wing Joseph Email : majlee@polyu.edu.hk Phone: 2766 6951 Office : HJ639. Complexity Theory. Classic scheduling theory draws heavily on complexity theory
E N D
AMA522 SCHEDULING Set # 2 Dr. LEE Heung Wing Joseph Email : majlee@polyu.edu.hk Phone: 2766 6951 Office : HJ639
Complexity Theory • Classic scheduling theory draws heavily on complexity theory • The complexity of an algorithm is its running time in terms of the input parameters (e.g., number of jobs and number of machines) • Big-Oh notation, e.g., O(n2m)
P and NP problems • The efficiency of an algorithm for a given problem is measured by the maximum (worst-case) number of computational steps needed to obtain an optimal solution as a function of the size of the instance. • Problems which have a known polynomial algorithm are said to be in class P. These are problems for which an algorithm is known to exist and it will stop on the correct output while effort is bounded by a polynomial function of the size of the problem. • For NP (non-deterministic polynomial problems) no simple algorithm yields optimal solutions in a limited amount of computer time.
Scheduling in Practice • Practical scheduling problems cannot be solved this easily! • Need: • Heuristic algorithms • Knowledge-based systems • Integration with other enterprise functions • However, classic scheduling results are useful as a building block
General Purpose Scheduling Procedures • Some scheduling problems are easy • Simple priority rules • Complexity: polynomial time • However, most scheduling problems are hard • Complexity: NP-hard, strongly NP-hard • Finding an optimal solution is infeasible in practice heuristic methods
Types of Heuristics • Simple Dispatching Rules • Composite Dispatching Rules • Branch and Bound • Beam Search • Simulated Annealing • Tabu Search • Genetic Algorithms Construction Methods Improvement Methods
Single Machine Deterministic Models • Jobs: J1, J2, ..., Jn • Assumptions: • The machine is always available throughout the scheduling period. • The machine cannot process more than one job at a time. • Each job must spend on the machine a prescribed length of time.
S(t) 3 2 1 t J2 J3 J1 ...
Requirements that may restrict the feasibility of schedules: • precedence constraints • no preemptions • release dates • deadlines • Whether some feasible schedule exist? NP hard Objective function f is used to compare schedules. f(S) < f(S') whenever schedule S is considered to be better than S' problem of minimising f(S) over the set of feasible schedules.
1. Completion Time Models Due date related objectives: 2. Lateness Models 3. Tardiness Models 4. Sequence-Dependent Setup Problems
Completion Time Models Contents 1. An algorithm which gives an optimal schedule with the minimum total weighted completion time 1 || wjCj 2. An algorithm which gives an optimal schedule with the minimum total weighted completion time when the jobs are subject to precedence relationship that take the form of chains 1 | chain | wjCj
1 || wjCj Theorem (3.1.1).The weighted shortest processing time first rule (WSPT) is optimal for 1 || wjCj WSPT: jobs are ordered in decreasing order of wj/pj The next follows trivially: The problem 1 || Cj is solved by a sequence S with jobs arranged innondecreasing order of processing times.
which implies that wj pk < wk pj Proof. By contradiction. S is a schedule, not WSPT, that is optimal. j and k are two adjacent jobs such that S: ... ... k j t + pj + pk t ... ... S’ k j t + pj + pk t S: (t+pj) wj + (t+pj+pk) wk = t wj + pj wj + t wk + pj wk + pk wk S’: (t+pk) wk + (t+pk+pj) wj = t wk + pk wk + t wj + pk wj + pj wj the completion time for S’ < completion time for Scontradiction!
1 | chain | wjCj chain 1: 1 2 ... k chain 2: k+1 k+2 ... n Lemma 3.1.2. If the chain of jobs 1,...,k precedes the chain of jobs k+1,...,n.
Proof: Under the sequence 1,…,k, k+1, …, n, say S, the total weighted completion time of S is given by ………(*)
Under the sequence k+1, …, n,1,…,k,, say S’, the total weighted completion time is given by ………(**)
By comparing the total weighted completion time S and S’, We have (*) < (**) only if
Let l* satisfy factor of chain 1,...,k l* is the job that determines the factor of the chain Note that for
Note also that for ………(***) The reason is not hard to see. Suppose a,b,c,d > 0, and Then, by cross multiplication, we have which is Thus, we have
Lemma 3.1.3. If job l* determines (1,...,k) , then there exists an optimal sequence that processes jobs 1,...,l* one after another without interruption by jobs from other chains. Proof: By Contradiction. Suppose the optimal sequence is 1,…,u, v, u+1, …, l*, say S. Let S’ bethe sequence v,1,…,u, u+1, …, l*, and let S’’ be the sequence 1,…,u, u+1, …, l*,v.
The total weighted completion time of S is less than S’ , then by Lemma 3.1.2, we have The total weighted completion time of S is less than S’’ , then by Lemma 3.1.2, we have
Job l*is the job that determines the factor of the chain (1,...,k) then by (***), we have If S is better than S’’, then Therefore, S’ is better than S !!!
Similarly, if S is better than S’, then Therefore, S’’ is better than S !!! Algorithm Whenever the machine is free, select among the remaining chainsthe one with the highest factor. Process this chain up to and includingthe job l* that determines its factor.
Example chain 1: 1 2 3 4 chain 2: 5 6 7 factor of chain 1 is determined by job 2: (6+18)/(3+6)=2.67 factor of chain 2 is determined by job 6: (8+17)/(4+8)=2.08 chain 1 is selected: jobs 1, 2 factor of the remaining part of chain 1 is determined by job 3:12/6=2 factor of chain 2 is determined by job 6: 2.08 chain 2 is selected: jobs 5, 6
factor of the remaining part of chain 1 is determined by job 3: 2 factor of the remaining part of chain 2 is determined by job 7:18/10=1.8 chain 1 is selected: job 3 factor of the remaining part of chain 1 is determined by job 4: 8/5=1.6 factor of the remaining part of chain 2 is determined by job 7: 1.8 chain 2 is selected: job 7 job 4 is scheduled last the final schedule: 1, 2, 5, 6, 3, 7, 4
1 | prec | wjCj • Polynomial time algorithms for the more complex precedence constraints than the simple chains are developed. • The problems with arbitrary precedence relation are NP hard. • 1 | rj, prmp | wjCj Try the preemptive version of the WSPT rule: At any point in time, the available job with the highest ratio of weight to remaining processing time is selected for processing. The priority level of job increases while being processed, and therefore not be preempted by another job already available at the start of its processing. The preemtive version of the WSPT rule does not always lead to an optimal solution, and the problem is NP hard.
1 | rj, prmp | Cj preemptive version of the SPT rule is optimal • 1 | rj | Cj is NP hard
Summary • 1 || wjCj WSPT rule • 1 | chain | wjCj a polynomial time algorithm is given • 1 | prec | wjCj with arbitrary precedence relation is NP hard • 1 | rj, prmp | wjCj the problem is NP hard • 1 | rj, prmp | Cj preemptive version of the SPT rule is optimal • 1 | rj | Cj is NP hard
Consider 1 | | wj(1-e-rCj) where r is the discount rate Scheduled in the decreasing order of This rule is referred to as the Weighted Discounted Shortest Processing Time first (WDSPT) rule.
Theorem.The WDSPT is optimal for 1 | | wj(1-e-rCj). Proof. By contradiction. S is a schedule, not WDSPT, is optimal. Jobs j and k are two adjacent jobs such that S: ... k j t + pj + pk t ... ... S’ k j t + pj + pk t The Cost for S :
The Cost for S’ : , so But Rearrange it, we have Thus Hence
By adding wj+wk to both sides of the inequality, we have Factorizing wjand wk , we then have Therefore, cost for S’ is less than that of S !!!
Ex3.11Consider 1 | | wj(1-e-rCj). Assume that not equal to for all j and k. Show that for r sufficiently close to zero, the optimal sequence is WSPT.
Lawler’s Algorithm • Backward algorithm which gives an optimal schedule for • 1 | prec | hmaxhmax= max ( h1(C1), ... ,hn(Cn) ) • hjare nondecreasing cost functions • Notation • makespan Cmax = pj completion of the last job • Let J be theset of jobs already scheduled • they have to be processed during the time interval • JC = complement ofset J, set of jobs still to be scheduled • J' JC set of jobs that can be scheduled immediately before set J (schedulable jobs)
Lawler’s Algorithm for 1 | | hmax Step 1. J = JC = {1,...,n} k = n Step 2. Let j* be such that Place j* in J in the k-th order position Delete j* from JC Step 3. If JC = then Stop else k = k - 1 go to Step 2
... 3 5 10 Example 3.2.3 (no precedence relationships between jobs) J = JC={1, 2, 3} jobs still to be scheduled p1+p2+p3=10 h1(10) = 11 h2(10) =12 h3(10) =10 Job 3 is scheduled last and has to be processed in [5, 10].
1 2 3 5 10 2 1 3 5 10 J = {3} JC={1, 2} jobs still to be scheduled p1+p2= 5 h1(5) = 6 h2(5) = 6 Either job 1 or job 2 may be processed before job 3. or Two schedules are optimal: 1, 2, 3 and 2, 1, 3
Lawler’sAlgorithm (3.2.1) for 1 | prec | hmax Step 1. J = , JC = {1,...,n} J' the set of all jobs with no successors k = n Step 2. Let j* be such that Place j* in J in the k-th order position Delete j* from JC Modify J' to represent the set of jobs which can be scheduledimmediately before set J. Step 3. If JC = then Stop else k = k - 1 go to Step 2
... 3 5 10 2 3 2 5 10 1 2 3 5 10 Example. What will happen in the previous example if theprecedence 1 2 has to be taken into account? J = JC={1, 2, 3} still to be scheduled J'={2, 3} have no successors p1+p2+p3= 10 h2(10) = 12 h3(10) = 10 J = {3} JC={1, 2} still to be scheduled J'={2} can be scheduled immediately before J p1+p2= 5 h2(5) = 6 J = {3, 2} JC={1} J'={1} h1(2) = 3 Optimal schedule: 1, 2, 3. hmax= 10 2