ACTIVITY 1 WACE Exam: Question 3 (calculator-free) - Hungarian algorithm A foreman in a factory has four workers, Adam, Ben, Cate and Demi, and four jobs to complete. The time, in hours each worker can complete a particular job is given in the weighted bipartite graph below. (a) Complete the matrix associated with the bipartite graph above. J1 J2 A B C D (b) 4 3 6 7 J3 J4 7 3 2 6 Using the Hungarian algorithm, determine which job the foreman should assign to each of his workers so that the total time is minimised. J1 J2 A 4 B 2 C 3 D 9 J3 J4 7 7 6 3 4 5 7 4 8 4 2 6 ACTIONS From each number in each row, subtract the smallest number in that row Now within each column subtract the smallest number in the column from every number in the column (only column 2, other minimum numbers are 0) ** Using vertical &/or horizontal lines, cross out rows and columns so that all the zeroes are crossed out using as few lines as possible (can be done with 3 lines) Identify the smallest number that is not crossed out (1) To create the next matrix, take this minimum number away from all the uncovered numbers and add it to the numbers at the intersections of the vertical and horizontal lines. Other covered numbers are unchanged. Repeat ** As 4 lines are needed to cross out all the zeroes and the matrix is a 4 x 4 matrix, then a solution exists To assign people to jobs, start by locating rows or columns with only one zero – these are the only jobs for these people (or people for this job) Note: Row 4, column 3 and column 4, row 3. Assign these and take them out of circulation. Allocate the last jobs. Check the question has been answered. ACTIVITY 2: For beginners Four teachers: Bart, Lisa, Homer and Maggie each do one task - write the test, mark the test, prepare the solutions and write the report. They each take different times for the various tasks and these times are shown in the table provided. How can you assign the tasks to minimise the total time taken? Write test Mark test Prepare solutions Write report Bart 8 5 4 13 Lisa 10 6 7 10 Maggie 8 9 9 11 Homer 11 7 3 6 Write test Mark test Prepare solutions Write report Bart Lisa Maggie Homer From each number in each row, subtract the smallest number in that row Within each column subtract the smallest number in the column from every number in the column Using vertical &/or horizontal lines, cross out rows and columns so that all the zeroes are crossed out using as few lines as possible As 4 lines are needed to cross out all the zeroes and it is a 4 x 4 matrix, then a solution exists To assign people to jobs, start by locating rows or columns with only one zero – these are the only jobs for these people (or people for this job) As tasks are assigned to people, remove them from consideration. Allocate all tasks. Check the question has been answered. ACTIVITY 3: Multiple steps and more than one solution A catering company has four Managers (M1 to M4) based in four different branches. These Managers are to be allocated to four different Events designated as A, B, C and D. The distances in kilometres from each branch to each Event are given in the table. Use the Hungarian algorithm to determine how the Managers should be allocated to these Events so that the total distance travelled by them is minimised. Event A B C D M1 40 25 25 30 M2 10 60 30 40 M3 45 15 10 25 M4 15 80 65 85 Event A B C D Event A B C D Manager Manager M1 M2 M3 M4 Manager M1 M2 M3 M4 ACTIONS FOR ACTIVITY 3 From each number in each row, subtract the smallest number in that row Now within each column subtract the smallest number in the column from every number in the column (only column 4, other minimum numbers are 0) ** Using vertical &/or horizontal lines, cross out rows and columns so that all the zeroes are crossed out using as few lines as possible (can be done with 3 lines) If the number of lines is equal to the dimensions of the matrix the solution exists – Go to the ASSIGNMENT. If the number of lines is less than the dimensions of the matrix the solution is yet to be “found”. Identify the smallest number that is not crossed out Create the next matrix. Take this minimum number away from all the uncovered numbers and add it to the numbers at the intersections of the vertical and horizontal lines. Enter other covered numbers unchanged. Go back to the Step ** ASSIGNMENT - To assign managers to events, start by locating rows or columns with only one zero – these are the only events for these managers (or managers for these events) Note: For this assignment problem, there is more than one solution. o How do you know there is more than one solution? o List all possible solutions. o State the minimum total distance for the Managers to get to the events. o Check the question has been answered. Activity 4: Maximising – Outings for the elderly An optimum solution may involve assignment so that a value is maximised rather than minimised. Start by creating a new matrix in which every number in the original matrix is subtracted from the largest number in that matrix. Then proceed as for a minimum. The local council wants as many elderly people as possible to make use of the services they offer for outings. The outings involve going shopping, taking people out to lunch, taking people bowling and going for a drive to the country. The results of their survey of people’s preferences for the four different activities on the days available are recorded in the table below. To maximise the number of people using their service, on which days should each of the activities be scheduled? Monday Tuesday Wednesday Thursday Shopping 17 24 42 21 Lunch 25 18 19 20 Bowling 29 14 31 22 Driving 11 20 17 14 Monday Tuesday Wednesday Thursday Shopping Lunch Bowling Driving Activity 4: Maximising – An engineering competition An optimum solution may involve assignment so that a value is maximised rather than minimised. Start by creating a new matrix in which every number in the original matrix is subtracted from the largest number in that matrix. Then proceed as for a minimum. Four students are to be chosen for four different tasks in an engineering competition. To select the students for each task, the four applicants were given a sample task which was marked by the teacher. The marks are recorded in the table below. Which is the best allocation of students to tasks so that the team performance is maximised? Build bridge Design tower Plan project Scale model Tim 60 78 67 37 Alf 45 80 70 90 Sara 60 35 70 86 Jess 42 66 54 72 Build bridge Design tower Plan project Scale model Tim Alf Sara Jess ACTIVITY 5: More tasks than people – Cleaning up the Art room There are more people than tasks Number of supply sources exceeds number of demand depots The matrix formed is not square We make it square by adding a row or column By convention the row or column added is filled with the largest number in the matrix In Sadler the extra row or column is filled with 0s Five students have been cleaning up the Art room after class and their times taken to do various tasks have been recorded. How can these five students be allocated to the tasks so that the total time taken to complete this part of the cleanup is minimised? Pack away the paint Gather up paper and card Wipe the benches Sweep the floor Toni 10 19 8 15 Eva 10 18 7 17 Max 13 16 9 14 Carol 12 19 8 18 Ned 14 17 10 19 Pack away the paint Gather up paper and card Wipe the benches Sweep the floor Toni Eva Max Carol Ned ACTIVITY 6: A 5 x 5 matrix Five students form a team which is entered into a problem-solving competition between schools. From the local Algebra School five students have recorded their times to solve the types of problems and puzzles used in the competition. Which is the best allocation of students to the types of problems so as to minimise the total time needed for the team to complete these tasks consecutively? Logic Sudoku Ken-ken Rubics Battleships Nick 1 3 4 5 7 Ava 8 3 12 13 5 Sam 11 12 4 8 5 Lee 6 13 12 5 5 Vo 14 13 16 10 10 Logic Sudoku Ken-ken Rubics Battleships Nick Ava Sam Lee Vo ACTIVITY 7: Investigating the Hungarian Algorithm How can you manipulate the numbers in a matrix to create a new set of numbers to use for the Hungarian Algorithm? Does the new set of numbers give the same assignment solution as the original matrix? Example 1 Teachers can go to one of three locations for an afterschool PD. The table below shows the distance from the PD to their homes. By inspection, minimise the total distance travelled by the three teachers. Justify your choice. Teachers Morley Gwelup Warwick Ali 10 4 9 Joy 8 11 10 Ron 9 8 7 Example 2 Gabriel has three contractors (C1, C2, C3) who work from home. Three jobs (J1, J2 and J3) need to be assigned and the time needed for each contractor to travel to each job is summarised in the table. Determine the optimum assignment to minimise the total travel time. Contractors J1 J2 J3 C1 20 15 30 C2 30 15 20 C3 30 25 40 For each of these matrices determine the effect on the assignment solution for each of the following manipulations. 1. Add the same number to every number in the matrix 2. Add a different number to the elements in each row 3. Multiply all the numbers in the matrix by the same number 4. Multiply every number in each row by a different number for each row. Share your findings.
© Copyright 2026 Paperzz