Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assignment Problem, Dynamic Programming

Similar presentations


Presentation on theme: "Assignment Problem, Dynamic Programming"— Presentation transcript:

1 Assignment Problem, Dynamic Programming

2 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 Consider the complete bipartite graph Assume w.l.o.g that n \leq m. ((V_1=v_1,…,v_n; V_2=w_1,…,w_m)) |V1 | = n 4 4

3 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 Consider the complete bipartite graph Assume w.l.o.g that n \leq m. ((V_1=v_1,…,v_n; V_2=w_1,…,w_m)) |V1 | = n cost = 12 4 cost = 10 4

4 LP formulation of the Assignment Problem
We may represent the assignment problem by the matrix C=(c_ij) and formulate it as a linear program with 0-1-variabbles x_ij Here x_ij = 1 if and only if v_i is assigned to w_j Due to 2.8 and 2.9 each v_i is assigned to a unique element in V_2, and each w_j is involved in at the most one assignment.

5 Reduction the Assignment Problem to the Transshipment Problem
lij = 0; uij = 1 5 3 2 n -n 3 V2 t s |V1| = n The assignment problem may be reduced to the transshipment problem by adding a source vertex s with arcs (s, v_i) and a sink t with arcs (w_j, t) to the bipartite graph. All costs of the new arcs are defined as zero, and the lower and upper capacities are zero and one, respectively. Finally, we let s be the only supply node, and t the only demand node. Both supply and demand are equal to n. O(n2m) steps 4 4

6 1|ri; pi = 1|Σfi Given are n jobs J1 ,..., Jn with 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. Let us consider the single machine problem with unit processing times that can be reduced to assignment problem.

7 Jobs and Time Slots t1 := r1 FOR i := 2 TO n DO
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 }

8 Algorithm Time Slots r1= r2= 0, r3= 3, r4= 4, r5= 7. 1 2 3 4 5 6 7 8

9 Time slots Lemma 3.1 There exists an optimal schedule which occupies all of the time slots ti, i = 1,…, n.

10 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.

11 1|ri; pi = 1|Σfi to Assignment Problem

12 r1= r2= 0, r3= 3, r4= 4 f1 = t, f2 = 3t – 2, f3 = 2t, f4 = t 1 [0,1] 2
[1,2] 7 10 3 [3,4] 16 32 [4,5] 5 4

13 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)

14 Monge arrays cik cil cjk cjl cik + cjl  cil + cjk

15 Monge Array Theorem 3.2

16 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.

17 Proof (Case 1)

18 Proof (Case 2)

19 Monge Array (2) Corollary 3.3

20 Monge Array (3) Corollary 3.4

21 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.

22 Structure of Schedule A schedule σ is given by a partition of the set of jobs into m disjoints sets I0 ,..., Im-1 and 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

23 Assignment Problem Now consider the assignment problem with cik = aibk where 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 schedule job i is assigned to the bk -last position on a machine if i is assigned to k.

24 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.

25 1||Σwj Uj Given n 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.

26 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

27 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 Jj is 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.

28 Recursion

29 Algorithm 1||Σwj Uj for t := –pmax to –1 do
for j := 0 to n do Fj(t) = ∞; for t := 0 to T do F0(t) = 0; for j := 1 to n do begin for t := 0 to dj do if Fj–1(t) + wj < Fj–1(t – pj) then Fj(t) = Fj–1(t) + wj else Fj(t) = Fj–1(t – pj); for t := dj + 1 to T do Fj(t) = Fj(dj) end

30 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

31 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.

32 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 .

33 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 if pi/wi  pj/wj. Thus, the objective function does not increase if i and j are interchanged.

34 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/w1  p2/w2  ...  pn/wn.

35 Recursion

36 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.

37 Exercise 2.1 Find an optimal schedule for the following instance of O|pmtn|Cmax problem. M1 M2 M3 J1 3 5 7 J2 4 2 J3 6 1 J4

38 Exercise 2.2 Find an optimal schedule for the following instance of 1|ri; pi = 1|Σfi problem. J1 J2 J3 J4 J5 J6 rj 1 5 fj x x+3 2x x2–x 20x x2

39 Exercise 2.3 Find an optimal schedule for the following instance of P3||ΣCi problem. J1 J2 J3 J4 J5 J6 J7 J8 J9 J10 pj 1 3 7 5 2 4 9 6


Download ppt "Assignment Problem, Dynamic Programming"

Similar presentations


Ads by Google