The Assignment Problem and the Hungarian Method



Similar documents
4 UNIT FOUR: Transportation and Assignment problems

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

Lecture Notes 2: Matrices as Systems of Linear Equations

9.2 Summation Notation

Reduced echelon form: Add the following conditions to conditions 1, 2, and 3 above:

8. Linear least-squares

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 2. x n. a 11 a 12 a 1n b 1 a 21 a 22 a 2n b 2 a 31 a 32 a 3n b 3. a m1 a m2 a mn b m

Introduction to Matrix Algebra

Linear Programming Problems

DATA ANALYSIS II. Matrix Algorithms

Abstract: We describe the beautiful LU factorization of a square matrix (or how to write Gaussian elimination in terms of matrix multiplication).

STATISTICS AND DATA ANALYSIS IN GEOLOGY, 3rd ed. Clarificationof zonationprocedure described onpp

Figure 1.1 Vector A and Vector F

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points.

Notes on Determinant

Linear Algebra Notes for Marsden and Tromba Vector Calculus

MEASURES OF VARIATION

Similarity and Diagonalization. Similar Matrices

(Refer Slide Time: 01.26)

Linear Algebra Notes

Section IV.1: Recursive Algorithms and Recursion Trees

Special cases in Transportation Problems

Mathematics Course 111: Algebra I Part IV: Vector Spaces

Linearly Independent Sets and Linearly Dependent Sets

Row Echelon Form and Reduced Row Echelon Form

T ( a i x i ) = a i T (x i ).

Torgerson s Classical MDS derivation: 1: Determining Coordinates from Euclidean Distances

Vector Math Computer Graphics Scott D. Anderson

Adding and Subtracting Positive and Negative Numbers

Lecture 1: Systems of Linear Equations

Systems of Linear Equations

Linear Programming. March 14, 2014

Unit 18 Determinants

5.3 The Cross Product in R 3

A Review And Evaluations Of Shortest Path Algorithms

Direct Methods for Solving Linear Systems. Matrix Factorization

1.2 Solving a System of Linear Equations

Least-Squares Intersection of Lines

2.5 Zeros of a Polynomial Functions

Chapter 6. Linear Programming: The Simplex Method. Introduction to the Big M Method. Section 4 Maximization and Minimization with Problem Constraints

Factoring Algorithms

v w is orthogonal to both v and w. the three vectors v, w and v w form a right-handed set of vectors.

6. LECTURE 6. Objectives

The Determinant: a Means to Calculate Volume

MAT188H1S Lec0101 Burbulla

Here are some examples of combining elements and the operations used:

Risk Management GUIDE GUIDE. for PHYSICIAN. Austin, TX

Manifold Learning Examples PCA, LLE and ISOMAP

6. Cholesky factorization

Lecture 3: Finding integer solutions to systems of linear equations

Chapter 3 RANDOM VARIATE GENERATION

Unit 1. Today I am going to discuss about Transportation problem. First question that comes in our mind is what is a transportation problem?

CURVE FITTING LEAST SQUARES APPROXIMATION

Scheduling Algorithm for Delivery and Collection System

Unit 1 Equations, Inequalities, Functions

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS

Orthogonal Diagonalization of Symmetric Matrices


160 CHAPTER 4. VECTOR SPACES

Question 2: How do you solve a matrix equation using the matrix inverse?

Chapter 19. General Matrices. An n m matrix is an array. a 11 a 12 a 1m a 21 a 22 a 2m A = a n1 a n2 a nm. The matrix A has n row vectors

Solving Systems of Linear Equations

Question: What is the probability that a five-card poker hand contains a flush, that is, five cards of the same suit?

Chapter 7. Matrices. Definition. An m n matrix is an array of numbers set out in m rows and n columns. Examples. (

Solution to Homework 2

A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form

Section 9.1 Vectors in Two Dimensions

Lecture 2 Matrix Operations

APPLICATIONS AND MODELING WITH QUADRATIC EQUATIONS

MA106 Linear Algebra lecture notes

1 Determinants and the Solvability of Linear Systems

Some Lecture Notes and In-Class Examples for Pre-Calculus:

17 Greatest Common Factors and Least Common Multiples

Introduction to Matrices for Engineers

Overview of Violations of the Basic Assumptions in the Classical Normal Linear Regression Model

Pigeonhole Principle Solutions

Ron Shaham. Expert Witness in Islamic Courts : Medicine and Crafts in the Service of Law. : University of Chicago Press,. p 38

. Perspectives on the Economics of Aging. : University of Chicago Press,. p 3 Copyright University of

May not be reproduced in any form without permission from the publisher, except fair uses permitted under U.S. or applicable copyright law.

1 Solving LPs: The Simplex Algorithm of George Dantzig

Approximation Algorithms

MATH 304 Linear Algebra Lecture 18: Rank and nullity of a matrix.

2.4 Real Zeros of Polynomial Functions

How To Understand And Solve Algebraic Equations

Chapter 6. Orthogonality

Elementary Matrices and The LU Factorization

CREATING A 12 TONE MATRIX: "My music is not modern, it is merely badly played." A. Schoenberg

Lecture 11: Sponsored search

Just the Factors, Ma am

Solution of Linear Systems

Arithmetic and Algebra of Matrices

Integer Programming Formulation

α = u v. In other words, Orthogonal Projection

NOTES ON LINEAR TRANSFORMATIONS

28 CHAPTER 1. VECTORS AND THE GEOMETRY OF SPACE. v x. u y v z u z v y u y u z. v y v z

Fractions to decimals

Matrix Algebra. Some Basic Matrix Laws. Before reading the text or the following notes glance at the following list of basic matrix algebra laws.

Chapter 2 Determinants, and Linear Independence

3. INNER PRODUCT SPACES

Transcription:

The Assignment Problem and the Hungarian Method 1

Example 1: You work as a sales manager for a toy manufacturer, and you currently have three salespeople on the road meeting buyers. Your salespeople are in Austin, TX; Boston, MA; and Chicago, IL. You want them to fly to three other cities: Denver, CO; Edmonton, Alberta; and Fargo, ND. The table below shows the cost of airplane tickets in dollars between these cities. From \ To Denver Edmonton Fargo Austin 250 400 350 Boston 400 600 350 Chicago 200 400 250 Where should you send each of your salespeople in order to minimize airfare? 2

We can represent the table above as a cost matrix. 250 400 350 400 600 350 200 400 250 3

Let s look at one possible assignment. 250 400 350 400 600 350 200 400 250 The total cost of this assignment is $250 + $600 + $250 = $1100. 4

Here s another possible assignment. 250 400 350 400 600 350 200 400 250 The total cost of this assignment is $250 + $350 + $400 = $1000. 5

After checking all six possible assignments we can determine that the optimal one is the following. 250 400 350 400 600 350 200 400 250 The total cost of this assignment is $400 + $350 + $200 = $950. Thus your salespeople should travel from Austin to Edmonton, Boston to Fargo, and Chicago to Denver. 6

Trial and error works well enough for this problem, but suppose you had ten salespeople flying to ten cities? How many trials would this take? There are n! ways of assigning n resources to n tasks. That means that as n gets large, we have too many trials to consider. 7

7 6 5 4 3 2 1 n 2 3 4 5 6 7 8

40 30 20 10 n 2 n 1 2 3 4 5 6 7 9

1000 800 600 400 200 e n n 2 n 1 2 3 4 5 6 7 10

5000 4000 3000 2000 1000 n e n n 2 n 1 2 3 4 5 6 7 11

Theorem: If a number is added to or subtracted from all of the entries of any one row or column of a cost matrix, then on optimal assignment for the resulting cost matrix is also an optimal assignment for the original cost matrix. 12

The Hungarian Method: The following algorithm applies the above theorem to a given n n cost matrix to find an optimal assignment. Step 1. Subtract the smallest entry in each row from all the entries of its row. Step 2. Subtract the smallest entry in each column from all the entries of its column. Step 3. Draw lines through appropriate rows and columns so that all the zero entries of the cost matrix are covered and the minimum number of such lines is used. Step 4. Test for Optimality: (i) If the minimum number of covering lines is n, an optimal assignment of zeros is possible and we are finished. (ii) If the minimum number of covering lines is less than n, an optimal assignment of zeros is not yet possible. In that case, proceed to Step 5. Step 5. Determine the smallest entry not covered by any line. Subtract this entry from each uncovered row, and then add it to each covered column. Return to Step 3. 13

Example 1: You work as a sales manager for a toy manufacturer, and you currently have three salespeople on the road meeting buyers. Your salespeople are in Austin, TX; Boston, MA; and Chicago, IL. You want them to fly to three other cities: Denver, CO; Edmonton, Alberta; and Fargo, ND. The table below shows the cost of airplane tickets in dollars between these cities. From \ To Denver Edmonton Fargo Austin 250 400 350 Boston 400 600 350 Chicago 200 400 250 Where should you send each of your salespeople in order to minimize airfare? 14

Step 1. Subtract 250 from Row 1, 350 from Row 2, and 200 from Row 3. 250 400 350 0 150 100 400 600 350 50 250 0 200 400 250 0 200 50 Step 2. Subtract 0 from Column 1, 150 from Column 2, and 0 from Column 3. 0 150 100 0 0 100 50 250 0 50 100 0 0 200 50 0 50 50 15

Step 3. Cover all the zeros of the matrix with the minimum number of horizontal or vertical lines. Step 4. Since the minimal number of lines is 3, an optimal assignment of zeros is possible and we are finished. 16

Since the total cost for this assignment is 0, it must be an optimal assignment. 0 0 100 50 100 0 0 50 50 Here is the same assignment made to the original cost matrix. 250 400 350 400 600 350 200 400 250 17

Example 2: A construction company has four large bulldozers located at four different garages. The bulldozers are to be moved to four different construction sites. The distances in miles between the bulldozers and the construction sites are given below. Bulldozer \ Site A B C D 1 90 75 75 80 2 35 85 55 65 3 125 95 90 105 4 45 110 95 115 How should the bulldozers be moved to the construction sites in order to minimize the total distance traveled? 18

Step 1. Subtract 75 from Row 1, 35 from Row 2, 90 from Row 3, and 45 from Row 4. 90 75 75 80 15 0 0 5 35 85 55 65 0 50 20 30 125 95 90 105 35 5 0 15 45 110 95 115 0 65 50 70 Step 2. Subtract 0 from Column 1, 0 from Colum 2, 0 19

from Column 3, and 5 from Column 4. 15 0 0 5 15 0 0 0 0 50 20 30 0 50 20 25 35 5 0 15 35 5 0 10 0 65 50 70 0 65 50 65 20

Step 3. Cover all the zeros of the matrix with the minimum number of horizontal or vertical lines. Step 4. Since the minimal number of lines is less than 4, we have to proceed to Step 5. 21

Step 5. Note that 5 is the smallest entry not covered by any line. Subtract 5 from each uncovered row. 15 0 0 0 15 0 0 0 0 50 20 25 5 45 15 20 35 5 0 10 30 0 5 5 0 65 50 65 5 60 45 60 Now add 5 to each covered column. 15 0 0 0 20 0 5 0 5 45 15 20 0 45 20 20 30 0 5 5 35 0 0 5 5 60 45 60 0 60 50 60 22

Now return to Step 3. Step 3. Cover all the zeros of the matrix with the minimum number of horizontal or vertical lines. Step 4. Since the minimal number of lines is less than 4, we have to return to Step 5. 23

Step 5. Note that 20 is the smallest entry not covered by a line. Subtract 20 from each uncovered row. 20 0 5 0 20 0 5 0 0 45 20 20 20 25 0 0 35 0 0 5 35 0 0 5 0 60 50 60 20 40 30 40 Then add 20 to each covered column. 20 0 5 0 40 0 5 0 20 25 0 0 0 25 0 0 35 0 0 5 55 0 0 5 20 40 30 40 0 40 30 40 24

Now return to Step 3. Step 3. Cover all the zeros of the matrix with the minimum number of horizontal or vertical lines. Step 4. Since the minimal number of lines is 4, an optimal assignment of zeros is possible and we are finished. 25

40 0 5 0 0 25 0 0 55 0 0 5 0 40 30 40 Since the total cost for this assignment is 0, it must be an optimal assignment. Here is the same assignment made to the original cost matrix. 26

90 75 75 80 35 85 55 65 125 95 90 105 45 110 95 115 So we should send Bulldozer 1 to Site D, Bulldozer 2 to Site C, Bulldozer 3 to Site B, and Bulldozer 4 to Site A. 27

Summary 28

The Assignment Problem: Suppose we have n resources to which we want to assign to n tasks on a one-to-one basis. Suppose also that we know the cost of assigning a given resource to a given task. We wish to find an optimal assignment one which minimizes total cost. 29

The Mathematical Model: Let c i,j be the cost of assigning the ith resource to the jth task. We define the cost matrix to be the n n matrix c 1,1 c 1,2 c 1,n c 2,1 c 2,2 c 2,n C =.... c n,1 c n,2 c n,n An assignment is a set of n entry positions in the cost matrix, no two of which lie in the same row or column. The sum of the n entries of an assignment is its cost. An assignment with the smallest possible cost is called an optimal assignment. 30

The Hungarian Method: The Hungarian method (see above) is an algorithm which finds an optimal assignment for a given cost matrix. 31