390 likes | 426 Views
Assignment Problem, Dynamic Programming. The Assignment Problem. G = ( V 1 ∪ V 2 , V 1 × V 2 ), n m. An Assignment is given by a one-to-one mapping : V 1 → V 2. c ij. – cost of arc ( i , j ). 5. The assignment problem is to find such that is minimized. 3.
E N D
The Assignment Problem G = (V1∪V2 , V1×V2), n m An Assignment is given by a one-to-one mapping : V1→V2 . cij – cost of arc (i, j) 5 The assignment problem is to find such that is minimized. 3 2 3 |V2 | = m |V1 | = n 4 4
The Assignment Problem G = (V1∪V2 , V1×V2), n m An Assignment is given by a one-to-one mapping : V1→V2 . cij – cost of arc (i, j) 5 The assignment problem is to find such that is minimized. 3 2 3 |V2 | = m |V1 | = n cost = 12 4 cost = 10 4
Reduction the Assignment Problemto the Transshipment Problem lij= 0; uij= 1 5 3 0 0 2 n -n 3 V2 t s |V1| = n O(n2m) steps 4 4
1|ri; pi= 1|Σfi • Given are n jobs J1 ,..., Jnwith unit processing times to be processed on a single machine, release dates ri and monotone (nondecreasing) functions fi of the finish times Ci of jobs i = 1,..., n. • Task: Find a schedule that minimizes the total sum of cost functions.
Jobs and Time Slots • Because the functions fi are monotone nondecreasing, the jobs should be scheduled as early as possible. The n earliest time slots ti for scheduling n jobs may be calculated using the following algorithm, in which we assume that the jobs are enumerated in such a way that r1 r2 ... rn. Algorithm Time Slots • t1:= r1 • FOR i := 2 TO n DO ti:= max { ri , ti–1+1 }
Algorithm Time Slots • r1= r2= 0, r3= 3, r4= 4, r5= 7. 0 1 2 3 4 5 6 7 8
Time slots • Lemma 3.1 There exists an optimal schedule which occupies all of the time slots ti, i = 1,…, n.
Proof • Consider an optimal schedule σ which occupies time slots t1,…, tj where j < n is maximal. • According to the construction of the ti-values, tj+1 is the next time slot in which a job can be scheduled. • If time slot tj+1 in σ is empty, a job scheduled later in σ can be moved to tj+1 without increasing the objective value. • Thus, the new schedule is optimal, too, and we have a contradiction to the maximality of j.
r1= r2= 0, r3= 3, r4= 4 • f1 = t, f2 = 3t – 2, f3 = 2t, f4 = t 1 1 [0,1] 2 3 4 1 4 2 [1,2] 7 10 [3,4] 3 16 32 [4,5] 5 4
Special Assignment Problem • Let V1 = {v1,..., vn} and V2 = {v1,..., vm} and consider the correspondent complete bipartite graph G = (V1∪V2, V1×V2). Then the correspondent assignment problem is completely specified by a n×m array C = (cij). • C is called a Monge array if cik + cjl cil + cjk for all i < j and k < l. (2.11)
Monge arrays cik cil cjk cjl cik + cjl cil + cjk
Monge Array Theorem 3.2
Proof • Let y = (yij) be an optimal solution of the assignment problem with yuu = 1 for u = 1, … , i where i is as large as possible. • Assume that i < n (if i = n we have finished). • Because yi+1, i+1= 0, there exists an index l > i+1 with yi+1, l = 1. • Now we consider two cases.
Monge Array (2) • Corollary 3.3
Monge Array (3) • Corollary 3.4
P||ΣCj • Given are n jobs J1 ,..., Jn to be processed on m identical parallel machines M0,..., Mm-1. • Task: Find a schedule that minimizes the sum of completion times of jobs.
Structure of Schedule • A schedule σis given by a partition of the set of jobs into m disjoints sets I0 ,..., Im-1and for each Ij, a sequence of the jobs in Ij. Assume that Ij contains nj elements and that j(i) (i = 1,..., n) is the job to be scheduled in position nj – i + 1on machine Mj . We assume that the jobs in Ij are scheduled on Mj starting at time zero without idle times. Then the value of the objective function is
Assignment Problem • Now consider the assignment problem with cik= aibkwhere ai = pi for i = 1,..., n and bk = k / m for k = 1,..., n. A schedule σ corresponds with an assignment with the objective value • In this schedulejob i is assigned to the bk -last position on a machine if i is assigned to k.
Optimal Schedule • Now if we assume that p1≥ p2≥ ... ≥ pn then we get an optimal assignment if we assign ai = pi to bi (i = 1,..., n). • This assignment corresponds with a schedule in which job i is scheduled on machine (i– 1)mod(m). Furthermore, on each machine the jobs are scheduled according to nondecreasing processing times.
1||Σwj Uj • Givenn jobs J1 ,..., Jn with processing times pi and due dates di. • Task: Find a sequence these jobs such that the weighted number of late jobs is minimized where wj≥ 0 for i = 1,..., n.
Structure of Optimal Schedule Assume that the jobs are enumerated according to nondecreasing due dates: d1 d2 ... dn. Then the exist an optimal schedule given by a sequence of the form i1,i2, ... ,is, is+1,..., in where jobs with indices i1<i2< ... <is are on-time and jobs with indices is+1,..., in are late. J1 J3 J4 J7 J8 J2 J5 J6 0
Dynamic Programming • To solve the problem, we calculate recursively for t = 0, 1,..., T and j = 1,..., n the minimum criterion value Fj(t) for the first j jobs, subject to the constraint that the total processing time of the on-time jobs is at most t. If 0 t dj and job Jjis on-time in a schedule which corresponds with Fj(t) then Fj(t) = Fj–1(t – pj). Otherwise Fj(t) = Fj–1(t) + wj. If t > dj then Fj(t) = Fj(dj) because all jobs J1 , J2 ,..., Jj finishing later than dj≥ ... ≥d1 are late.
Algorithm 1||Σwj Uj • fort :=–pmaxto –1 do • for j := 0 to n do Fj(t) = ∞; • for t :=0 to Tdo F0(t) = 0; • for j := 1 to n do begin • for t :=0 to djdo • if Fj–1(t) + wj < Fj–1(t – pj) then Fj(t) = Fj–1(t) + wj else Fj(t) = Fj–1(t – pj); • fort :=dj + 1 to Tdo Fj(t) = Fj(dj) end
Algorithm Backward Calculation • t :=dn ; L := • for j := n down to 1 do begin t := min{t, di}; if Fj(t) = Fj–1(t) + wj then L := L∪{Jj} else t := t – pi end
P||Σwj Cj • Given:n jobs J1 ,..., Jn are to be processed on m identical parallel machines. Each job Ji has processing time pi and weight wi. • Task: Find a sequence these jobs such that the sum of the weighted completion times is minimized. All wj≥ 0 are assumed to be positive.
Optimal Solution of 1||Σwj Cj An optimal solution of this one machine problem is obtained if we sequence the jobs according nondecreasing ratios pi/wi .
Interchange Argument Let j be a job which is scheduled immediately before job i. If we interchange i and j, the objective function changed by wipi+ wj(pi+ pj) – wjpj – wi(pi+ pj) = wjpi – wi pj which is nonpositive if and only ifpi/wipj/wj. Thus, the objective function does not increase if i and j are interchanged.
Structure of Optimal Schedule of P||Σwj Cj • A consequence of this result is that in an optimal solution of problem P||Σwj Cj , jobs to be processed on the same machine must be processed in order of nondecreasing ratios pi/wi. • Therefore we assume that all jobs are indexed such that p1/w1p2/w2 ... pn/wn.
Exercises • Prove Corollary 3.2 and Corollary 3.3. • Suppose f is strictly increasing, positive function. That is, f(x) > 0 for all x > 0 and f(x) > f(y) whenever x > y. Show that SPT (short processing time first) gives an optimal schedule for the problem 1||ΣCj2.
Exercise 2.1 • Find an optimal schedule for the following instance of O|pmtn|Cmax problem.
Exercise 2.2 • Find an optimal schedule for the following instance of 1|ri; pi= 1|Σfiproblem.
Exercise 2.3 • Find an optimal schedule for the following instance of P3||ΣCiproblem.