Tải bản đầy đủ (.pdf) (33 trang)

Giao trinh bai tap chuong 1 congtac kysu hdxb

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (114.06 KB, 33 trang )

ECE 307 - Techniques for Engineering
Decisions
Hungarian Method
George Gross
Department of Electrical and Computer Engineering
University of Illinois at Urbana-Champaign

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

1


ASSIGNMENT PROBLEM
‰ We are given
n machines

M1 , M2 , … , Mn

↔ i

n jobs

J1 , J2 , … , Jn

↔ j

cost of doing job j on machine i

c ij =



Q

if job j cannot be done on machine i

‰ Each machine can only do one job and each job
requires one machine
ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

2


ASSIGNMENT PROBLEM
‰ We wish to determine the optimal match, i.e., the
assignment with the lowest total costs of doing
the jobs on the n machines
‰ The brute force approach is simply enumeration:
consider n = 10 and there are 3,628,800 possible
choices!
ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

3


SOLUTION APPROACH
‰ We can, however, introduce categorical decision

variables

x ij

⎧⎪ 1
= ⎨
⎪⎩0

job j is assigned to machine i
otherwise

‰ And the constraints can be stated as
n


j =1
n


i =1

x ij = 1

∀ i each machine does exactly 1 job

x ij = 1

∀ j each job is assigned
to only 1 machine


ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

4


SOLUTION APPROACH
‰ The assignment problem, then, is formulated as
n

n

min Z = ∑ ∑ c ij x ij
i =1 j =1

s.t .
n


j =1
n


i =1

x ij = 1

∀i


x ij = 1

∀j

x ij ∈ { 0 , 1 }

∀i, j

‰ Thus, the assignment problem can be viewed as
a special case of transportation problem
ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

5


COST MATRIX
job j
mach i

M1

J1

J2



x 11


x 12



x 21

M2

x 22
c 22

c 21





x n1

x n2

c n1

demands
ECE 307

1

x 1n


c n2

1

1

c 1n






x 2n

1

c 2n


x nn




Mn

Jn


c 12

c 11

supplies

1

c nn

1

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

6


SIMPLIFIED COST MATRIX
‰ Since demands and supplies are 1 for all assignment problems, we represent the assignment
problem by the cost matrix below
job j

J1

J2



Jn


M1

c 11

c 12



c 1n

M2

c 21

c 22



c 2n












Mn

c n1

c n2



c n1

mach i

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

7


HISTORY OF HUNGARIAN METHOD
‰ First published by Harold Kuhn in 1955

‰ Based on earlier works of two Hungarian

mathematicians, Dénes König and Jenő Egerváry
ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

8



FACT
n

n

n

n

min Z = ∑∑ c ij x ij − k

min Z = ∑∑ c ij x ij

i =1 j =1

i =1 j =1

s.t .

s.t .
n


j =1
n


i =1


x ij = 1 ∀ i
x ij = 1 ∀ j

x ij ∈ { 0 , 1 } ∀ i , j

n

(i)


j =1
n


i =1

x ij = 1 ∀ i

(ii)

x ij = 1 ∀ j

x ij ∈ { 0 , 1 } ∀ i , j

‰ If x *ij ≤ 1 for i , j ≤ n optimizes problem (i ), then
x *ij ≤ 1 for i , j ≤ n also optimizes problem (ii )
ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.


9


BASIC IDEA
‰ The optimal assignment is not affected by a
constant added or subtracted from any row of the
original assignment cost matrix by the fact in the
previous slide and

Z =

∑(c
n

j =1

=

n

qj

n

)

− k x qj +

n


n

c ij x ij
∑∑
i =1 j =1
i ≠q
n

c ij x ij − k ∑ xq j
∑∑
i =1 j =1
j =1

=Z −k

‰ A similar statement holds with respect to the
column of the cost matrix
ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

10


BASIC IDEA
‰ If all elements of the cost matrix are nonnegative,
then the objective is nonnegative
‰ If the objective is nonnegative, and there exists a
feasible solution such that the total cost is zero,

then the feasible solution is the optimal solution
ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

11


THE HUNGARIAN METHOD
‰ For each i , we consider the elements i and
compute

(

c i = min c ij , 1 ≤ j ≤ n

)

and subtract c i from each element in row i to get

c ij = c ij − c i , 1 ≤ j ≤ n
‰ Then, we do the same procedure to each column
‰ We try to assign jobs only using the machines
with zero costs since such an assignment, if
found, is optimal
ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

12



EXAMPLE 1
job j

J1

J2

J3

J4

M1

10

9

8

7

M2

3

4

5


6

M3

2

1

1

2

M4

4

3

5

6

mach i

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

13



EXAMPLE 1
job j

J1

J2

J3

J4

M1

3

2

1

0

M2

3

4

5


6

M3

2

1

1

2

M4

4

3

5

6

mach i

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

14



EXAMPLE 1
job j

J1

J2

J3

J4

M1

3

2

1

0

M2

0

1

2


3

M3

1

0

0

1

M4

1

0

2

3

mach i

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

15



EXAMPLE 1
job j

J1

J2

J3

J4

M1

3

2

1

0

M2

0

1

2


3

M3

1

0

0

1

M4

1

0

2

3

mach i

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

16



HUNGARIAN METHOD
‰ In general, feasible assignment only using cells
with zero costs may not exist after single row and
column subtraction
‰ In such cases, we need to draw a minimum
number of lines through certain rows and
columns to cover all the cells with zero cost
‰ The minimum number of lines needed is the
maximum number of jobs that can be assigned to
the zero cells subject to all the constraints, a
result that was proved by König
ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

17


HUNGARIAN METHOD
‰ Then we look up the submatrix that is not covered
by the lines to identify the smallest element
‰ Subtract from each element of the submatrix the
value of the smallest element and add the value to
all elements at the intersection of two lines
ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.


18


HUNGARIAN METHOD
‰ The rationale for this operation is that we subtract
the smallest value from each element in a row
including any element that is covered by a line; to
compensate we also need to add an equal value to
the element which is covered by the intersection
of two lines and therefore the operation keeps the
value of the elements not at an intersection
unchanged
ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

19


EXAMPLE 2
job j

J1

J2

J3

J4


M1

10

9

7

8

M2

5

8

7

8

M3

5

4

6

5


M4

2

3

4

5

mach i

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

20


EXAMPLE 2
job j

J1

J2

J3

J4


M1

10

9

7

8

M2

5

8

7

8

M3

5

4

6

5


M4

2

3

4

5

mach i

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

21


EXAMPLE 2
job j

J1

J2

J3

J4


M1

3

2

0

1

M2

0

3

2

3

M3

1

0

2

1


M4

0

1

2

3

mach i

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

22


EXAMPLE 2
job j

J1

J2

J3

J4


M1

3

2

0

1

M2

0

3

2

3

M3

1

0

2

1


M4

0

1

2

3

mach i

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

23


EXAMPLE 2
job j

J1

J2

J3

J4


M1

3

2

0

0

M2

0

3

2

2

M3

1

0

2

0


M4

0

1

2

2

mach i

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

24


EXAMPLE 2
job j

J1

J2

J3

J4


M1

3

2

0

0

M2

0

3

2

2

M3

1

0

2

0


M4

0

1

2

2

mach i

ECE 307

© 2008-2009 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.

25


×