The Hungarian algorithm for non-square arrays

Slides:



Advertisements
Similar presentations
The Assignment Problem
Advertisements

Gaussian Elimination Matrices Solutions By Dr. Julia Arnold.
Unbalanced Assignment Model
BU BU Decision Models Networks 1 Networks Models Summer 2013.
Operations Research Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD4207 University of Palestine.
Transportation Problem (TP) and Assignment Problem (AP)
Transportation and Assignment Models
Chapter 6 Linear Programming: The Simplex Method
Masalah Penugasan.
Assignment Meeting 15 Course: D Deterministic Optimization Year: 2009.
Transportation and Assignment Solution Procedures
Operations Research Assignment Problem.
Prim’s Algorithm from a matrix A cable TV company is installing a system of cables to connect all the towns in the region. The numbers in the network are.
Quantitative Techniques for Decision Making M.P. Gupta & R.B. Khanna © Prentice Hall India.
Production Scheduling
Allocation problems - The Hungarian Algorithm The Hungarian algorithm Step 1Reduce the array by both row and column subtractions Step 2Cover the zero elements.
Linear Inequalities and Linear Programming Chapter 5
The Transportation and Assignment Problems
To accompany Quantitative Analysis for Management, 8e by Render/Stair/Hanna 10-1 © 2003 by Prentice Hall, Inc. Upper Saddle River, NJ Chapter 10.
Presentation: H. Sarper
Linear Programming Applications
LIAL HORNSBY SCHNEIDER
1 Chapter 2 Matrices Matrices provide an orderly way of arranging values or functions to enhance the analysis of systems in a systematic manner. Their.
1.3 Matrices and Matrix Operations.
LINEAR PROGRAMMING SIMPLEX METHOD.
Hungarian Algorithm Vida Movahedi Elderlab, York University June 2007.
TH EDITION LIAL HORNSBY SCHNEIDER COLLEGE ALGEBRA.
Copyright © 2013, 2009, 2005 Pearson Education, Inc. 1 5 Systems and Matrices Copyright © 2013, 2009, 2005 Pearson Education, Inc.
Copyright © 2013, 2009, 2005 Pearson Education, Inc. 1 5 Systems and Matrices Copyright © 2013, 2009, 2005 Pearson Education, Inc.
Slide 1 of 27 Assignment Problem: Hungarian Algorithm and Linear Programming collected from the Internet and edited by Longin Jan Latecki.
Assignment Model Lecture 21 By Dr Arshad Zaheer. RECAP  Transportation model (Maximization)  Illustration (Demand > Supply)  Optimal Solution  Modi.
Topic III The Simplex Method Setting up the Method Tabular Form Chapter(s): 4.
Chapter 7 Transportation, Assignment & Transshipment Problems
1.3 Matrices and Matrix Operations. Definition A matrix is a rectangular array of numbers. The numbers in the array are called the entries in the matrix.
Assignment Problem. Definition Assignment Problem is a balanced transportation problem in which all supplies and demand are equal to 1.
Assignment Models Dr. Kirti Arekar
The Assignment Algorithm A loading technique for committing two or more jobs to two or more workers or machines in a single work center. With one job assigned.
Chapter 7 Section 7.2 Addition & Subtraction in Different Bases.
1 Network Models Transportation Problem (TP) Distributing any commodity from any group of supply centers, called sources, to any group of receiving.
4.5 Inverse of a Square Matrix
Copyright © 2011 Pearson Education, Inc. Solving Linear Systems Using Matrices Section 6.1 Matrices and Determinants.
Group members: Ibrahim jan Qesar Habib Najeebullah
Network Flow Problems – The Assignment Problem
Matrices Digital Lesson. Copyright © by Houghton Mifflin Company, Inc. All rights reserved. 2 A matrix is a rectangular array of real numbers. Each entry.
TM 631 Optimization Assignment Problems. Prototype Problem K-Corp has 3 parts, each of which can be assigned to 1 of 3 machines. The problem is to assign.
Table of Contents Matrices - Definition and Notation A matrix is a rectangular array of numbers. Consider the following matrix: Matrix B has 3 rows and.
QUANTITATIVE METHODS FOR MANAGERS ASSIGNMENT MODEL.
Learning to Associate: HybridBoosted Multi-Target Tracker for Crowded Scene Present by 陳群元.
Distribution Model Meaning Types Transportation Model Assignment Model.
The Hungarian Algorithm – Maximisation problems The Hungarian algorithm for maximisation problems To solve a maximisation problem using the Hungarian algorithm,
Networks Teacher’s guide. Networks 2 Problem 1 – the Link The EMTV Company needs to install a new cable system that links the six major towns in its.
Assignment Problem: Hungarian Algorithm and Linear Programming collected from the Internet and extended by Longin Jan Latecki.
The Hungarian algorithm for non-square arrays
deterministic operations research
ENGM 535 Optimization Assignment Problems.
HUNGARIAN ALGORITHM.
Assignment Problem: Hungarian Algorithm and Linear Programming collected from the Internet and extended by Longin Jan Latecki.
Matrix Operations.
Assignment Problem A balanced transportation problem in which
Assignment Problem: Hungarian Algorithm and Linear Programming collected from the Internet and extended by Longin Jan Latecki.
Matrices Elements, Adding and Subtracting
Chapter 7 Transportation, Assignment & Transshipment Problems
Applied Combinatorics, 4th Ed. Alan Tucker
Transportation Problems
Minimum Spanning tree Select any vertex
The Hungarian algorithm for non-square arrays
Decision Science Chapter 6 Assignment Models.
Assignment Problem: Hungarian Algorithm and Linear Programming collected from the Internet and extended by Longin Jan Latecki.
Presentation transcript:

The Hungarian algorithm for non-square arrays The Hungarian Algorithm – Non-square arrays The Hungarian algorithm for non-square arrays If an array is not square, start by adding a dummy row or column to make the array square. Fill this with the largest number in the existing array. Then apply the standard Hungarian algorithm: Step 1 Reduce the array by both row and column subtractions Step 2 Cover the zero elements with the minimum number of lines. If the number of lines is the same as the size of the array, then go to Step 4. Step 3 Augment the elements. To do this, identify the minimum uncovered element. Subtract this element from all uncovered elements, and add this element to all elements covered by two lines. Then return to step 2. Step 4 Identify the maximal matching which uses only zero elements, and apply this matching to the original array to find the minimum cost.

The Hungarian Algorithm – Non-square arrays Example A company has five representatives availiable on a particular day. Four representatives are needed to attend meetings in different areas. The distance each representative would need to drive from home to attend each of the meetings is shown in the table below.   Use the Hungarian algorithm to find out which representative should visit each area in order to keep the total distance travelled as low as possible. Area 1 Area 2 Area 3 Area 4 Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25

The Hungarian Algorithm – Non-square arrays This array has five rows and four columns, so first you need to add a dummy column to give a square array. The largest element in the array is 35, so each element in the dummy column is set to be 35. Because the problem is a minimisation problem, we have used the largest element so that it does not occur in the solution Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 35 Jane 14 19 26 Kate 21 23 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25

The Hungarian Algorithm – Non-square arrays Step 1: Reduce the array by both row and column subtractions To reduce by row subtractions, subtract the smallest element in each row from each element in the row. The smallest element in Ian’s row is 11, so subtract 11 from each element in the row. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 14 19 26 18 35 Kate 21 23 29 Lucy 32 27 17 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 35 Jane 14 19 26 Kate 21 23 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 35 Jane 14 19 26 Kate 21 23 29 Lucy 32 27 17 Mike 15 28 25

The Hungarian Algorithm – Non-square arrays Step 1: Reduce the array by both row and column subtractions To reduce by row subtractions, subtract the smallest element in each row from each element in the row. The smallest element in Jane’s row is 14, so subtract 14 from each element in the row. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 23 35 29 Lucy 32 27 17 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 14 19 26 18 35 Kate 21 23 29 Lucy 32 27 17 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 14 19 26 18 35 Kate 21 23 29 Lucy 32 27 17 Mike 16 15 28 25

The Hungarian Algorithm – Non-square arrays Step 1: Reduce the array by both row and column subtractions To reduce by row subtractions, subtract the smallest element in each row from each element in the row. The smallest element in Kate’s row is 21, so subtract 21 from each element in this row. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 32 27 17 35 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 23 35 29 Lucy 32 27 17 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 23 35 29 Lucy 32 27 17 Mike 16 15 28 25

The Hungarian Algorithm – Non-square arrays Step 1: Reduce the array by both row and column subtractions To reduce by row subtractions, subtract the smallest element in each row from each element in the row. The smallest element in Lucy’s row is 17, so subtract 17 from each element in this row. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 16 28 25 35 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 32 27 17 35 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 32 27 17 35 Mike 16 15 28 25

The Hungarian Algorithm – Non-square arrays Step 1: Reduce the array by both row and column subtractions To reduce by row subtractions, subtract the smallest element in each row from each element in the row. The smallest element in Mike’s row is 15, so subtract 15 from each element in this row. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 16 28 25 35 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 16 28 25 35

Allocation problems - The Hungarian Algorithm Step 1: Reduce the array by both row and column subtractions The minimum number of lines needed to cover all the zeros is 3, so the solution is not optimal. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20 Now reduce the array by subtracting the minimum entry in each column from all the entries in the column.

The Hungarian Algorithm – Non-square arrays Step 1: Reduce the array by both row and column subtractions To reduce by column subtractions, subtract the smallest element in each column from each element in the column. Columns 1, 2 and 4 already contain zeros, so cannot be reduced. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20

The Hungarian Algorithm – Non-square arrays Step 1: Reduce the array by both row and column subtractions To reduce by column subtractions, subtract the smallest element in each column from each element in the column. The smallest number in column 3 is 4, so subtract 4 from each element in this column. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 24 Jane 5 8 4 21 Kate 2 10 14 Lucy 15 18 Mike 20 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20

The Hungarian Algorithm – Non-square arrays Step 1: Reduce the array by both row and column subtractions To reduce by column subtractions, subtract the smallest element in each column from each element in the column. The smallest number in column 5 is 14, so subtract 14 from each element in this column. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 10 Jane 5 8 4 Kate 2 Lucy 15 Mike 6 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 24 Jane 5 8 4 21 Kate 2 10 14 Lucy 15 18 Mike 20 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 24 Jane 5 8 4 21 Kate 2 10 14 Lucy 15 18 Mike 20

The Hungarian Algorithm – Non-square arrays Step 2: Cover the zero elements with the minimum number of lines Look for rows and columns containing more than one zero. In this case, Kate’s row, Lucy’s row and column 2 all contain two zeros, so cover these with lines. The remaining zero can be covered by either a vertical or horizontal line. The choice of line will not affect the final result. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 10 Jane 5 8 4 Kate 2 Lucy 15 Mike 6 Four lines have been used for this 5 by 5 array, so this array does not give the optimal allocation.

The Hungarian Algorithm – Non-square arrays Step 3: Augment the elements The smallest uncovered element is 1. Subtract 1 from all uncovered elements and add 1 to all elements covered by two lines Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 5 4 7 Kate 2 10 Lucy 15 Mike Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 10 Jane 5 8 4 Kate 2 Lucy 15 Mike 6

The Hungarian Algorithm – Non-square arrays Step 3: Augment the elements The smallest uncovered element is 1. Subtract 1 from all uncovered elements and add 1 to all elements covered by two lines Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 5 4 7 Kate 2 10 Lucy 15 Mike Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 10 Jane 5 8 4 Kate 2 Lucy 15 Mike 6 Now return to Step 2.

The Hungarian Algorithm – Non-square arrays Step 2: Cover the zero elements with the minimum number of lines. In this case, it is not possible to cover the zero elements with less than five lines. There are several different ways of covering them with five lines. Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Since five lines are required for this 5 by 5 array, the optimal allocation can now be found from this array. Now go to Step 4.

The Hungarian Algorithm – Non-square arrays Step 4: Identify the maximal matching using zero elements. Look for rows and columns containing just one zero. There is just one zero in Jane’s row, and there is just one zero in column 4 and in the dummy column. This means that Mike must be matched with Area 2, and Ian with Area 3. Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5

The Hungarian Algorithm – Non-square arrays Step 4: Identify the maximal matching using zero elements. From the array, Ian is allocated Area 3, Jane is allocated Area 1, Lucy is allocated Area 4 and Mike is allocated Area 2. Kate is not required. Going back to the original array gives the distances for each person. Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 35 Jane 14 19 26 Kate 21 23 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Total distance to be travelled = 16 + 14 + 17 + 15 = 62.