Hungarian Method

The Hungarian method is a computational optimization technique that addresses the assignment problem in polynomial time and foreshadows following primal-dual alternatives. In 1955, Harold Kuhn used the term “Hungarian method” to honour two Hungarian mathematicians, Dénes Kőnig and Jenő Egerváry. Let’s go through the steps of the Hungarian method with the help of a solved example.

Hungarian Method to Solve Assignment Problems

The Hungarian method is a simple way to solve assignment problems. Let us first discuss the assignment problems before moving on to learning the Hungarian method.

What is an Assignment Problem?

A transportation problem is a type of assignment problem. The goal is to allocate an equal amount of resources to the same number of activities. As a result, the overall cost of allocation is minimised or the total profit is maximised.

Because available resources such as workers, machines, and other resources have varying degrees of efficiency for executing different activities, and hence the cost, profit, or loss of conducting such activities varies.

Assume we have ‘n’ jobs to do on ‘m’ machines (i.e., one job to one machine). Our goal is to assign jobs to machines for the least amount of money possible (or maximum profit). Based on the notion that each machine can accomplish each task, but at variable levels of efficiency.

Hungarian Method Steps

Check to see if the number of rows and columns are equal; if they are, the assignment problem is considered to be balanced. Then go to step 1. If it is not balanced, it should be balanced before the algorithm is applied.

Step 1 – In the given cost matrix, subtract the least cost element of each row from all the entries in that row. Make sure that each row has at least one zero.

Step 2 – In the resultant cost matrix produced in step 1, subtract the least cost element in each column from all the components in that column, ensuring that each column contains at least one zero.

Step 3 – Assign zeros

  • Analyse the rows one by one until you find a row with precisely one unmarked zero. Encircle this lonely unmarked zero and assign it a task. All other zeros in the column of this circular zero should be crossed out because they will not be used in any future assignments. Continue in this manner until you’ve gone through all of the rows.
  • Examine the columns one by one until you find one with precisely one unmarked zero. Encircle this single unmarked zero and cross any other zero in its row to make an assignment to it. Continue until you’ve gone through all of the columns.

Step 4 – Perform the Optimal Test

  • The present assignment is optimal if each row and column has exactly one encircled zero.
  • The present assignment is not optimal if at least one row or column is missing an assignment (i.e., if at least one row or column is missing one encircled zero). Continue to step 5. Subtract the least cost element from all the entries in each column of the final cost matrix created in step 1 and ensure that each column has at least one zero.

Step 5 – Draw the least number of straight lines to cover all of the zeros as follows:

(a) Highlight the rows that aren’t assigned.

(b) Label the columns with zeros in marked rows (if they haven’t already been marked).

(c) Highlight the rows that have assignments in indicated columns (if they haven’t previously been marked).

(d) Continue with (b) and (c) until no further marking is needed.

(f) Simply draw the lines through all rows and columns that are not marked. If the number of these lines equals the order of the matrix, then the solution is optimal; otherwise, it is not.

Step 6 – Find the lowest cost factor that is not covered by the straight lines. Subtract this least-cost component from all the uncovered elements and add it to all the elements that are at the intersection of these straight lines, but leave the rest of the elements alone.

Step 7 – Continue with steps 1 – 6 until you’ve found the highest suitable assignment.

Hungarian Method Example

Use the Hungarian method to solve the given assignment problem stated in the table. The entries in the matrix represent each man’s processing time in hours.

\(\begin{array}{l}\begin{bmatrix} & I & II & III & IV & V \\1 & 20 & 15 & 18 & 20 & 25 \\2 & 18 & 20 & 12 & 14 & 15 \\3 & 21 & 23 & 25 & 27 & 25 \\4 & 17 & 18 & 21 & 23 & 20 \\5 & 18 & 18 & 16 & 19 & 20 \\\end{bmatrix}\end{array} \)

With 5 jobs and 5 men, the stated problem is balanced.

\(\begin{array}{l}A = \begin{bmatrix}20 & 15 & 18 & 20 & 25 \\18 & 20 & 12 & 14 & 15 \\21 & 23 & 25 & 27 & 25 \\17 & 18 & 21 & 23 & 20 \\18 & 18 & 16 & 19 & 20 \\\end{bmatrix}\end{array} \)

Subtract the lowest cost element in each row from all of the elements in the given cost matrix’s row. Make sure that each row has at least one zero.

\(\begin{array}{l}A = \begin{bmatrix}5 & 0 & 3 & 5 & 10 \\6 & 8 & 0 & 2 & 3 \\0 & 2 & 4 & 6 & 4 \\0 & 1 & 4 & 6 & 3 \\2 & 2 & 0 & 3 & 4 \\\end{bmatrix}\end{array} \)

Subtract the least cost element in each Column from all of the components in the given cost matrix’s Column. Check to see if each column has at least one zero.

\(\begin{array}{l}A = \begin{bmatrix}5 & 0 & 3 & 3 & 7 \\6 & 8 & 0 & 0 & 0 \\0 & 2 & 4 & 4 & 1 \\0 & 1 & 4 & 4 & 0 \\2 & 2 & 0 & 1 & 1 \\\end{bmatrix}\end{array} \)

When the zeros are assigned, we get the following:

Hungarian Method

The present assignment is optimal because each row and column contain precisely one encircled zero.

Where 1 to II, 2 to IV, 3 to I, 4 to V, and 5 to III are the best assignments.

Hence, z = 15 + 14 + 21 + 20 + 16 = 86 hours is the optimal time.

Practice Question on Hungarian Method

Use the Hungarian method to solve the following assignment problem shown in table. The matrix entries represent the time it takes for each job to be processed by each machine in hours.

\(\begin{array}{l}\begin{bmatrix}J/M & I & II & III & IV & V \\1 & 9 & 22 & 58 & 11 & 19 \\2 & 43 & 78 & 72 & 50 & 63 \\3 & 41 & 28 & 91 & 37 & 45 \\4 & 74 & 42 & 27 & 49 & 39 \\5 & 36 & 11 & 57 & 22 & 25 \\\end{bmatrix}\end{array} \)

Stay tuned to BYJU’S – The Learning App and download the app to explore all Maths-related topics.

Frequently Asked Questions on Hungarian Method

What is hungarian method.

The Hungarian method is defined as a combinatorial optimization technique that solves the assignment problems in polynomial time and foreshadowed subsequent primal–dual approaches.

What are the steps involved in Hungarian method?

The following is a quick overview of the Hungarian method: Step 1: Subtract the row minima. Step 2: Subtract the column minimums. Step 3: Use a limited number of lines to cover all zeros. Step 4: Add some more zeros to the equation.

What is the purpose of the Hungarian method?

When workers are assigned to certain activities based on cost, the Hungarian method is beneficial for identifying minimum costs.

Leave a Comment Cancel reply

Your Mobile number and Email id will not be published. Required fields are marked *

Request OTP on Voice Call

Post My Comment

the hungarian method for solving an assignment problem can also be used to solve mcq

  • Share Share

Register with BYJU'S & Download Free PDFs

Register with byju's & watch live videos.

close

  • Data Structures
  • Linked List
  • Binary Tree
  • Binary Search Tree
  • Segment Tree
  • Disjoint Set Union
  • Fenwick Tree
  • Red-Black Tree
  • Advanced Data Structures

Hungarian Algorithm for Assignment Problem | Set 2 (Implementation)

  • Hungarian Algorithm for Assignment Problem | Set 1 (Introduction)
  • Implementation of Exact Cover Problem and Algorithm X using DLX
  • Implementation of Exhaustive Search Algorithm for Set Packing
  • Greedy Approximate Algorithm for Set Cover Problem
  • Introduction to Exact Cover Problem and Algorithm X
  • Job Assignment Problem using Branch And Bound
  • Prim's Algorithm (Simple Implementation for Adjacency Matrix Representation)
  • Introduction to Disjoint Set (Union-Find Algorithm)
  • Channel Assignment Problem
  • Java Program for Counting sets of 1s and 0s in a binary matrix
  • Top 20 Greedy Algorithms Interview Questions
  • C++ Program for Counting sets of 1s and 0s in a binary matrix
  • Best meeting point in 2D binary array
  • Minimum Cost Maximum Flow from a Graph using Bellman Ford Algorithm
  • Print equal sum sets of array (Partition problem) | Set 1
  • C# Program for Dijkstra's shortest path algorithm | Greedy Algo-7
  • Java Program for Dijkstra's shortest path algorithm | Greedy Algo-7
  • C / C++ Program for Dijkstra's shortest path algorithm | Greedy Algo-7
  • Self assignment check in assignment operator
  • Python Program for Dijkstra's shortest path algorithm | Greedy Algo-7
  • Algorithms | Dynamic Programming | Question 7
  • Assignment Operators in C
  • Assignment Operators in Programming
  • Data Structures and Algorithms | Set 21
  • Different Forms of Assignment Statements in Python
  • Algorithms Quiz | Sudo Placement [1.7] | Question 5
  • Flipkart On-campus Placement Process 2020 Graduate
  • When should we write our own assignment operator in C++?
  • Java Program to Implement Heuristic Approach to Solve Set Packing

Given a 2D array , arr of size N*N where arr[i][j] denotes the cost to complete the j th job by the i th worker. Any worker can be assigned to perform any job. The task is to assign the jobs such that exactly one worker can perform exactly one job in such a way that the total cost of the assignment is minimized.

Input: arr[][] = {{3, 5}, {10, 1}} Output: 4 Explanation: The optimal assignment is to assign job 1 to the 1st worker, job 2 to the 2nd worker. Hence, the optimal cost is 3 + 1 = 4. Input: arr[][] = {{2500, 4000, 3500}, {4000, 6000, 3500}, {2000, 4000, 2500}} Output: 4 Explanation: The optimal assignment is to assign job 2 to the 1st worker, job 3 to the 2nd worker and job 1 to the 3rd worker. Hence, the optimal cost is 4000 + 3500 + 2000 = 9500.

Different approaches to solve this problem are discussed in this article .

Approach: The idea is to use the Hungarian Algorithm to solve this problem. The algorithm is as follows:

  • For each row of the matrix, find the smallest element and subtract it from every element in its row.
  • Repeat the step 1 for all columns.
  • Cover all zeros in the matrix using the minimum number of horizontal and vertical lines.
  • Test for Optimality : If the minimum number of covering lines is N , an optimal assignment is possible. Else if lines are lesser than N , an optimal assignment is not found and must proceed to 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.

Consider an example to understand the approach:

Let the 2D array be: 2500 4000 3500 4000 6000 3500 2000 4000 2500 Step 1: Subtract minimum of every row. 2500, 3500 and 2000 are subtracted from rows 1, 2 and 3 respectively. 0   1500  1000 500  2500   0 0   2000  500 Step 2: Subtract minimum of every column. 0, 1500 and 0 are subtracted from columns 1, 2 and 3 respectively. 0    0   1000 500  1000   0 0   500  500 Step 3: Cover all zeroes with minimum number of horizontal and vertical lines. Step 4: Since we need 3 lines to cover all zeroes, the optimal assignment is found.   2500   4000  3500  4000  6000   3500   2000  4000  2500 So the optimal cost is 4000 + 3500 + 2000 = 9500

For implementing the above algorithm, the idea is to use the max_cost_assignment() function defined in the dlib library . This function is an implementation of the Hungarian algorithm (also known as the Kuhn-Munkres algorithm) which runs in O(N 3 ) time. It solves the optimal assignment problem. 

Below is the implementation of the above approach:

Time Complexity: O(N 3 ) Auxiliary Space: O(N 2 )

Please Login to comment...

Similar reads.

  • Mathematical

advertisewithusBannerImg

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

MBA Notes

How to Solve the Assignment Problem: A Complete Guide

Table of Contents

Assignment problem is a special type of linear programming problem that deals with assigning a number of resources to an equal number of tasks in the most efficient way. The goal is to minimize the total cost of assignments while ensuring that each task is assigned to only one resource and each resource is assigned to only one task. In this blog, we will discuss the solution of the assignment problem using the Hungarian method, which is a popular algorithm for solving the problem.

Understanding the Assignment Problem

Before we dive into the solution, it is important to understand the problem itself. In the assignment problem, we have a matrix of costs, where each row represents a resource and each column represents a task. The objective is to assign each resource to a task in such a way that the total cost of assignments is minimized. However, there are certain constraints that need to be satisfied – each resource can be assigned to only one task and each task can be assigned to only one resource.

Solving the Assignment Problem

There are various methods for solving the assignment problem, including the Hungarian method, the brute force method, and the auction algorithm. Here, we will focus on the steps involved in solving the assignment problem using the Hungarian method, which is the most commonly used and efficient method.

Step 1: Set up the cost matrix

The first step in solving the assignment problem is to set up the cost matrix, which represents the cost of assigning a task to an agent. The matrix should be square and have the same number of rows and columns as the number of tasks and agents, respectively.

Step 2: Subtract the smallest element from each row and column

To simplify the calculations, we need to reduce the size of the cost matrix by subtracting the smallest element from each row and column. This step is called matrix reduction.

Step 3: Cover all zeros with the minimum number of lines

The next step is to cover all zeros in the matrix with the minimum number of horizontal and vertical lines. This step is called matrix covering.

Step 4: Test for optimality and adjust the matrix

To test for optimality, we need to calculate the minimum number of lines required to cover all zeros in the matrix. If the number of lines equals the number of rows or columns, the solution is optimal. If not, we need to adjust the matrix and repeat steps 3 and 4 until we get an optimal solution.

Step 5: Assign the tasks to the agents

The final step is to assign the tasks to the agents based on the optimal solution obtained in step 4. This will give us the most cost-effective or profit-maximizing assignment.

Solution of the Assignment Problem using the Hungarian Method

The Hungarian method is an algorithm that uses a step-by-step approach to find the optimal assignment. The algorithm consists of the following steps:

  • Subtract the smallest entry in each row from all the entries of the row.
  • Subtract the smallest entry in each column from all the entries of the column.
  • Draw the minimum number of lines to cover all zeros in the matrix. If the number of lines drawn is equal to the number of rows, we have an optimal solution. If not, go to step 4.
  • Determine the smallest entry not covered by any line. Subtract it from all uncovered entries and add it to all entries covered by two lines. Go to step 3.

The above steps are repeated until an optimal solution is obtained. The optimal solution will have all zeros covered by the minimum number of lines. The assignments can be made by selecting the rows and columns with a single zero in the final matrix.

Applications of the Assignment Problem

The assignment problem has various applications in different fields, including computer science, economics, logistics, and management. In this section, we will provide some examples of how the assignment problem is used in real-life situations.

Applications in Computer Science

The assignment problem can be used in computer science to allocate resources to different tasks, such as allocating memory to processes or assigning threads to processors.

Applications in Economics

The assignment problem can be used in economics to allocate resources to different agents, such as allocating workers to jobs or assigning projects to contractors.

Applications in Logistics

The assignment problem can be used in logistics to allocate resources to different activities, such as allocating vehicles to routes or assigning warehouses to customers.

Applications in Management

The assignment problem can be used in management to allocate resources to different projects, such as allocating employees to tasks or assigning budgets to departments.

Let’s consider the following scenario: a manager needs to assign three employees to three different tasks. Each employee has different skills, and each task requires specific skills. The manager wants to minimize the total time it takes to complete all the tasks. The skills and the time required for each task are given in the table below:

The assignment problem is to determine which employee should be assigned to which task to minimize the total time required. To solve this problem, we can use the Hungarian method, which we discussed in the previous blog.

Using the Hungarian method, we first subtract the smallest entry in each row from all the entries of the row:

Next, we subtract the smallest entry in each column from all the entries of the column:

We draw the minimum number of lines to cover all the zeros in the matrix, which in this case is three:

Since the number of lines is equal to the number of rows, we have an optimal solution. The assignments can be made by selecting the rows and columns with a single zero in the final matrix. In this case, the optimal assignments are:

  • Emp 1 to Task 3
  • Emp 2 to Task 2
  • Emp 3 to Task 1

This assignment results in a total time of 9 units.

I hope this example helps you better understand the assignment problem and how to solve it using the Hungarian method.

Solving the assignment problem may seem daunting, but with the right approach, it can be a straightforward process. By following the steps outlined in this guide, you can confidently tackle any assignment problem that comes your way.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you! 😔

Let us improve this post!

Tell us how we can improve this post?

Operations Research

1 Operations Research-An Overview

  • History of O.R.
  • Approach, Techniques and Tools
  • Phases and Processes of O.R. Study
  • Typical Applications of O.R
  • Limitations of Operations Research
  • Models in Operations Research
  • O.R. in real world

2 Linear Programming: Formulation and Graphical Method

  • General formulation of Linear Programming Problem
  • Optimisation Models
  • Basics of Graphic Method
  • Important steps to draw graph
  • Multiple, Unbounded Solution and Infeasible Problems
  • Solving Linear Programming Graphically Using Computer
  • Application of Linear Programming in Business and Industry

3 Linear Programming-Simplex Method

  • Principle of Simplex Method
  • Computational aspect of Simplex Method
  • Simplex Method with several Decision Variables
  • Two Phase and M-method
  • Multiple Solution, Unbounded Solution and Infeasible Problem
  • Sensitivity Analysis
  • Dual Linear Programming Problem

4 Transportation Problem

  • Basic Feasible Solution of a Transportation Problem
  • Modified Distribution Method
  • Stepping Stone Method
  • Unbalanced Transportation Problem
  • Degenerate Transportation Problem
  • Transhipment Problem
  • Maximisation in a Transportation Problem

5 Assignment Problem

  • Solution of the Assignment Problem
  • Unbalanced Assignment Problem
  • Problem with some Infeasible Assignments
  • Maximisation in an Assignment Problem
  • Crew Assignment Problem

6 Application of Excel Solver to Solve LPP

  • Building Excel model for solving LP: An Illustrative Example

7 Goal Programming

  • Concepts of goal programming
  • Goal programming model formulation
  • Graphical method of goal programming
  • The simplex method of goal programming
  • Using Excel Solver to Solve Goal Programming Models
  • Application areas of goal programming

8 Integer Programming

  • Some Integer Programming Formulation Techniques
  • Binary Representation of General Integer Variables
  • Unimodularity
  • Cutting Plane Method
  • Branch and Bound Method
  • Solver Solution

9 Dynamic Programming

  • Dynamic Programming Methodology: An Example
  • Definitions and Notations
  • Dynamic Programming Applications

10 Non-Linear Programming

  • Solution of a Non-linear Programming Problem
  • Convex and Concave Functions
  • Kuhn-Tucker Conditions for Constrained Optimisation
  • Quadratic Programming
  • Separable Programming
  • NLP Models with Solver

11 Introduction to game theory and its Applications

  • Important terms in Game Theory
  • Saddle points
  • Mixed strategies: Games without saddle points
  • 2 x n games
  • Exploiting an opponent’s mistakes

12 Monte Carlo Simulation

  • Reasons for using simulation
  • Monte Carlo simulation
  • Limitations of simulation
  • Steps in the simulation process
  • Some practical applications of simulation
  • Two typical examples of hand-computed simulation
  • Computer simulation

13 Queueing Models

  • Characteristics of a queueing model
  • Notations and Symbols
  • Statistical methods in queueing
  • The M/M/I System
  • The M/M/C System
  • The M/Ek/I System
  • Decision problems in queueing

Hungarian Method: Assignment Problem

Hungarian Method is an efficient method for solving assignment problems .

This method is based on the following principle:

  • If a constant is added to, or subtracted from, every element of a row and/or a column of the given cost matrix of an assignment problem, the resulting assignment problem has the same optimal solution as the original problem.

Hungarian Algorithm

The objective of this section is to examine a computational method - an algorithm - for deriving solutions to the assignment problems. The following steps summarize the approach:

Steps in Hungarian Method

1. Identify the minimum element in each row and subtract it from every element of that row.

2. Identify the minimum element in each column and subtract it from every element of that column.

3. Make the assignments for the reduced matrix obtained from steps 1 and 2 in the following way:

  • For every zero that becomes assigned, cross out (X) all other zeros in the same row and the same column.
  • If for a row and a column, there are two or more zeros and one cannot be chosen by inspection, then you are at liberty to choose the cell arbitrarily for assignment.

4. An optimal assignment is found, if the number of assigned cells equals the number of rows (and columns). In case you have chosen a zero cell arbitrarily, there may be alternate optimal solutions. If no optimal solution is found, go to step 5.

5. Draw the minimum number of vertical and horizontal lines necessary to cover all the zeros in the reduced matrix obtained from step 3 by adopting the following procedure:

  • Mark all the rows that do not have assignments.
  • Mark all the columns (not already marked) which have zeros in the marked rows.
  • Mark all the rows (not already marked) that have assignments in marked columns.
  • Repeat steps 5 (i) to (iii) until no more rows or columns can be marked.
  • Draw straight lines through all unmarked rows and marked columns.

You can also draw the minimum number of lines by inspection.

6. Select the smallest element from all the uncovered elements. Subtract this smallest element from all the uncovered elements and add it to the elements, which lie at the intersection of two lines. Thus, we obtain another reduced matrix for fresh assignment.

7. Go to step 3 and repeat the procedure until you arrive at an optimal assignment.

For the time being we assume that number of jobs is equal to number of machines or persons. Later in the chapter, we will remove this restrictive assumption and consider a special case where no. of facilities and tasks are not equal.

Share This Article

Operations Research Simplified Back Next

Goal programming Linear programming Simplex Method Transportation Problem

A Note on Solving the Transportation Model by the Hungarian Method of Assignment: Unification of the Transportation and Assignment Models

  • Conference paper
  • First Online: 20 December 2023
  • Cite this conference paper

the hungarian method for solving an assignment problem can also be used to solve mcq

  • Santosh Kumar 16 ,
  • Trust Tawanda 17 ,
  • Elias Munapo 18 &
  • Philimon Nyamugure 17  

Part of the book series: Lecture Notes in Networks and Systems ((LNNS,volume 855))

Included in the following conference series:

  • International Conference on Intelligent Computing & Optimization

78 Accesses

This short note extends the Hungarian method for the assignment for solving a transportation model. In the proposed approach, the optimality of the solution is established when the solution is feasible, hence a degenerate transportation solution poses no difficulties as is the case of the conventional transportation approach.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
  • Available as EPUB and PDF
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Hillier, F.S., Lieberman, G.J.: Introduction to Operations Research. ISBN 13:79812 59545962 (2015)

Google Scholar  

Munapo, E., Kumar, S.: Linear Integer Programming: Theory, Applications, Recent Developments, De Gruyter Series on the Applications of Mathematics in Engineering and Information Sciences. ISBN 978-3-11-070292-7 (2022)

Taha, H.A.: Operations Research: An Introduction, Pearson Educators, 10th edn. (2017)

Tawanda, T.: A node merging approach to the transhipment problem. Int. J. Syst. Assur. Eng. Manag. 8 (Suppl 1), 370–378 (2017). https://doi.org/10.1007/s13198-015-0396-9

Article   Google Scholar  

Winston, W.L.: Operations Research Applications and Algorithms, Duxbury Press, 4th edn. (2004)

Kuhn, H.W.: The Hungarian method of assignment problem. Naval Res. Log. Quart. 2 , 83–97 (1955)

Article   MathSciNet   Google Scholar  

Munapo, E., Nyamugure, P., Lesaoana, M., Kumar, S.: A note on unified approach to solving transportation and assignment models in operations research. Int. J. Math. Model. Simul. Appl. 5 , 140–149 (2012)

Eppen, G.D., Gould, F.J., Schmidt, C.P.: Introduction to Management Science, 4th edn. Prentice Hall, New Jersey (1993)

Sharma, J.K.: Operations Research: Theory and Applications. Trinity Press (2018)

Murthy, K.G.: An algorithm for ranking all the assignments in order of increasing costs. Oper. Res. 16 , 682–687 (1968)

Kumar, S., Al-Hasani, A., Al-Rabeeah, M., Ebehard, A.: A random search method for finding ‘k ≥ 2’ number of ranked optimal solution to an assignment problem. J. Phys. Conf. Ser. 1490 , 1–3 (2020). https://doi.org/10.1088/1742-6596/1490/1/012063

Download references

Author information

Authors and affiliations.

Department of Mathematical and Geospatial Sciences, School of Sciences, RMIT University, Melbourne, Australia

Santosh Kumar

Department of Statistics and Operations Research, National University of Science and Technology, Bulawayo, Zimbabwe

Trust Tawanda & Philimon Nyamugure

School of Economics and Decision Sciences, North West University, Mafikeng Campus, Mafikeng, South Africa

Elias Munapo

You can also search for this author in PubMed   Google Scholar

Corresponding author

Correspondence to Elias Munapo .

Editor information

Editors and affiliations.

Faculty of Electrical and Electronics Engineering, Ton Duc Thang University, Modeling Evolutionary Algorithms Simulation and Artificial Intelligence, Ho Chi Minh City, Vietnam

Pandian Vasant

Department of Computer Science, Chittagong University of Engineering & Technology, Chittagong, Bangladesh

Mohammad Shamsul Arefin

Federal Scientific Agroengineering Center VIM, Laboratory of Non-traditional Energy Systems, Russian University of Transport, Department of Theoretical and Applied Mechanics, 127994 Moscow, Russia;, Moscow, Russia

Vladimir Panchenko

Department of Computer Science, UOW Malaysia KDU Penang University Colleage, George Town, Malaysia

J. Joshua Thomas

Northwest University, Mmabatho, South Africa

Faculty of Engineering Management, Poznań University of Technology, Poznan, Poland

Gerhard-Wilhelm Weber

Facultad de Ciencias Económicas y Empresariales, Universidad Panamericana, Mexico City, Mexico

Roman Rodriguez-Aguilar

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Cite this paper.

Kumar, S., Tawanda, T., Munapo, E., Nyamugure, P. (2023). A Note on Solving the Transportation Model by the Hungarian Method of Assignment: Unification of the Transportation and Assignment Models. In: Vasant, P., et al. Intelligent Computing and Optimization. ICO 2023. Lecture Notes in Networks and Systems, vol 855. Springer, Cham. https://doi.org/10.1007/978-3-031-50158-6_30

Download citation

DOI : https://doi.org/10.1007/978-3-031-50158-6_30

Published : 20 December 2023

Publisher Name : Springer, Cham

Print ISBN : 978-3-031-50157-9

Online ISBN : 978-3-031-50158-6

eBook Packages : Intelligent Technologies and Robotics Intelligent Technologies and Robotics (R0)

Share this paper

Anyone you share the following link with will be able to read this content:

Sorry, a shareable link is not currently available for this article.

Provided by the Springer Nature SharedIt content-sharing initiative

  • Publish with us

Policies and ethics

  • Find a journal
  • Track your research

Procedure, Example Solved Problem | Operations Research - Solution of assignment problems (Hungarian Method) | 12th Business Maths and Statistics : Chapter 10 : Operations Research

Chapter: 12th business maths and statistics : chapter 10 : operations research.

Solution of assignment problems (Hungarian Method)

First check whether the number of rows is equal to the numbers of columns, if it is so, the assignment problem is said to be balanced.

Step :1 Choose the least element in each row and subtract it from all the elements of that row.

Step :2 Choose the least element in each column and subtract it from all the elements of that column. Step 2 has to be performed from the table obtained in step 1.

Step:3 Check whether there is atleast one zero in each row and each column and make an assignment as follows.

the hungarian method for solving an assignment problem can also be used to solve mcq

Step :4 If each row and each column contains exactly one assignment, then the solution is optimal.

Example 10.7

Solve the following assignment problem. Cell values represent cost of assigning job A, B, C and D to the machines I, II, III and IV.

the hungarian method for solving an assignment problem can also be used to solve mcq

Here the number of rows and columns are equal.

∴ The given assignment problem is balanced. Now let us find the solution.

Step 1: Select a smallest element in each row and subtract this from all the elements in its row.

the hungarian method for solving an assignment problem can also be used to solve mcq

Look for atleast one zero in each row and each column.Otherwise go to step 2.

Step 2: Select the smallest element in each column and subtract this from all the elements in its column.

the hungarian method for solving an assignment problem can also be used to solve mcq

Since each row and column contains atleast one zero, assignments can be made.

Step 3 (Assignment):

the hungarian method for solving an assignment problem can also be used to solve mcq

Thus all the four assignments have been made. The optimal assignment schedule and total cost is

the hungarian method for solving an assignment problem can also be used to solve mcq

The optimal assignment (minimum) cost

Example 10.8

Consider the problem of assigning five jobs to five persons. The assignment costs are given as follows. Determine the optimum assignment schedule.

the hungarian method for solving an assignment problem can also be used to solve mcq

∴ The given assignment problem is balanced.

Now let us find the solution.

The cost matrix of the given assignment problem is

the hungarian method for solving an assignment problem can also be used to solve mcq

Column 3 contains no zero. Go to Step 2.

the hungarian method for solving an assignment problem can also be used to solve mcq

Thus all the five assignments have been made. The Optimal assignment schedule and total cost is

the hungarian method for solving an assignment problem can also be used to solve mcq

The optimal assignment (minimum) cost = ` 9

Example 10.9

Solve the following assignment problem.

the hungarian method for solving an assignment problem can also be used to solve mcq

Since the number of columns is less than the number of rows, given assignment problem is unbalanced one. To balance it , introduce a dummy column with all the entries zero. The revised assignment problem is

the hungarian method for solving an assignment problem can also be used to solve mcq

Here only 3 tasks can be assigned to 3 men.

Step 1: is not necessary, since each row contains zero entry. Go to Step 2.

the hungarian method for solving an assignment problem can also be used to solve mcq

Step 3 (Assignment) :

the hungarian method for solving an assignment problem can also be used to solve mcq

Since each row and each columncontains exactly one assignment,all the three men have been assigned a task. But task S is not assigned to any Man. The optimal assignment schedule and total cost is

the hungarian method for solving an assignment problem can also be used to solve mcq

The optimal assignment (minimum) cost = ₹ 35

Related Topics

Privacy Policy , Terms and Conditions , DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.

Hungarian Algorithm Calculator Online

Photo of author

The Hungarian Algorithm Calculator is a powerful tool used to solve optimization problems known as the assignment problem. It finds the optimal assignment of tasks to resources, minimizing the total cost or maximizing the total profit. This calculator employs the Hungarian algorithm, a method that efficiently solves assignment problems by iteratively reducing the problem to a series of steps until an optimal assignment is achieved.

Formula of Hungarian Algorithm Calculator

The Hungarian Algorithm Calculator follows these steps:

Step1: Subtract the minimum value in each row from all the values in that row.

Step2: Subtract the minimum value in each column from all the values in that column.

Step3: Cover all zeros with the minimum number of lines.

Step : Test for optimality. If the number of lines drawn is equal to the number of rows or columns, an optimal assignment is found. If not, proceed to step 5.

Step5: Determine the smallest uncovered value (let it be k) and subtract it from all uncovered values. Then add it to all the values intersected by the lines. Return to step 3.

Step6: The optimal assignment is obtained from the resulting matrix.

You'll need to represent your problem as a matrix of costs or distances, and then apply the Hungarian algorithm steps iteratively until an optimal assignment is found.

General Terms Table

This table provides general terms related to the Hungarian Algorithm Calculator, helping users understand key concepts without needing to calculate each time .

Example of Hungarian Algorithm Calculator

Suppose we have a scenario where three workers (W1, W2, W3) are assign to three tasks (T1, T2, T3). The cost matrix representing the cost of assigning each worker to each task is as follows:

Using the Hungarian Algorithm Calculator, we can find the optimal assignment of workers to tasks. After calculation, the optimal assignment would be:

W1 -> T3 W2 -> T2 W3 -> T1

Most Common FAQs

The Algorithm Calculator is use to find the optimal assignment of tasks to resources, minimizing costs or maximizing profits.

The algorithm works by iteratively reducing the assignment problem to a series of steps until an optimal assignment is find. It involves subtracting row and column minima, covering zeros, and testing for optimality.

Yes, the calculator is applicable to various real-life scenarios such as workforce scheduling, job assignment, and resource allocation.

The calculator provides accurate results based on the input cost matrix and follows the rigorous steps of the algorithm to find the optimal assignment.

Yes, the calculator is capable of handling large datasets efficiently, making it suitable for complex optimization problems.

🚀 Upgrade Your Calculations with AI-Powered Precision!

Solve any problem in a snap with Calculatorshub Ai Calculator.

Related Calculators

Local Maxima Minima Calculator Online

Linear Independence Calculator Online

Interval Notation Number Line Calculator Online

Intersecting Lines Calculator Online

Diameter of A Cylinder Calculator Online

Half Cylinder Volume Calculator Online

Halfway Between Two Numbers Calculator Online

Growth Decay Calculator Online

Gaussian Elimination Calculator Online

Focal Width Calculator Online

Leave a Comment Cancel reply

Save my name, email, and website in this browser for the next time I comment.

Mcqmate logo

View all MCQs in

No comments yet

Related MCQs

  • The method used for solving an assignment problem is:
  • ........................... method is used to solve an assignment problem.
  • .................... is the popular method for solving an assignment problem.
  • Which of the following methods is used to solve an assignment problem:
  • Hungarian method was developed by ........................
  • Graphic method can be applied to solve a liner programming problem when there are only ........................... variables
  • An assignment problem can be solved by .........................
  • The assignment problem is:
  • In a maximisation assignment problem, the objective is to maximise .............................
  • While solving LP problem graphically, the area bounded by the constraints is called

IMAGES

  1. Assignment Problem (Part-3) Hungarian Method to solve Assignment Problem

    the hungarian method for solving an assignment problem can also be used to solve mcq

  2. Assignment problem Hungarian method

    the hungarian method for solving an assignment problem can also be used to solve mcq

  3. Lecture 3: Hungarian Method to solve assignment problem || Optimal

    the hungarian method for solving an assignment problem can also be used to solve mcq

  4. Hungarian Algorithm for Assignment Problem

    the hungarian method for solving an assignment problem can also be used to solve mcq

  5. Assignment Problem 1

    the hungarian method for solving an assignment problem can also be used to solve mcq

  6. [#1]Assignment Problem[Easy Steps to solve

    the hungarian method for solving an assignment problem can also be used to solve mcq

VIDEO

  1. 2. Minimal Assignment problem {Hungarian Method}

  2. Assignment problem. Hungarian method

  3. HUNGARIAN METHOD||ASSIGNMENT PROBLEM ||OPERATIONS RESEARCH|| Lecture

  4. 03 Assignment Problem Hungarian Method

  5. The assignment problem: The Hungarian method Part 1

  6. The assignment problem: The Hungarian method Part 6

COMMENTS

  1. Hungarian Method

    The Hungarian method is a computational optimization technique that addresses the assignment problem in polynomial time and foreshadows following primal-dual alternatives. In 1955, Harold Kuhn used the term "Hungarian method" to honour two Hungarian mathematicians, Dénes Kőnig and Jenő Egerváry. Let's go through the steps of the Hungarian method with the help of a solved example.

  2. Hungarian Algorithm for Assignment Problem

    The Hungarian algorithm, aka Munkres assignment algorithm, utilizes the following theorem for polynomial runtime complexity (worst case O(n 3)) and guaranteed optimality: If a number is added to or subtracted from all of the entries of any one row or column of a cost matrix, then an optimal assignment for the resulting cost matrix is also an ...

  3. PDF Hungarian method for assignment problem

    Hungarian method for assignment problem Step 1. Subtract the entries of each row by the row minimum. Step 2. Subtract the entries of each column by the column minimum. Step 3. Make an assignment to the zero entries in the resulting matrix. A = M 17 10 15 17 18 M 6 10 20 12 5 M 14 19 12 11 15 M 7 16 21 18 6 M −10

  4. Hungarian algorithm

    The Hungarian method is a combinatorial optimization algorithm that solves the assignment problem in polynomial time and which anticipated later primal-dual methods.It was developed and published in 1955 by Harold Kuhn, who gave it the name "Hungarian method" because the algorithm was largely based on the earlier works of two Hungarian mathematicians, Dénes Kőnig and Jenő Egerváry.

  5. Learn Hungarian Method

    The Hungarian method, also known as the Kuhn-Munkres algorithm, is a computational technique used to solve the assignment problem in polynomial time. It's a precursor to many primal-dual methods used today. The method was named in honor of Hungarian mathematicians Dénes Kőnig and Jenő Egerváry by Harold Kuhn in 1955.

  6. Difference between solving Assignment Problem using the Hungarian

    It solves all LP problems and focus in development is to be fast on average on all LPs and also to be fast-ish in the pathological cases. When using the Hungarian method, you do not build a model, you just pass the cost matrix to a tailored algorithm. You will then use an algorithm developed for that specific problem to solve it.

  7. PDF Variants of the hungarian method for assignment problems

    The Hungarian Method [ 11 is an algorithm for solving assignment problems that is 2. RESTATEMENT OF THE HUNGARIAN METHOD As considered in this paper, the assignment problem asks: Given an n-by-n matrix A = h.) of non-negative integers, find the permutation j,, . . . , jn of the integers 1, . . . , n 9

  8. Hungarian Algorithm for Assignment Problem

    Different approaches to solve this problem are discussed in this article. Approach: The idea is to use the Hungarian Algorithm to solve this problem. The algorithm is as follows: For each row of the matrix, find the smallest element and subtract it from every element in its row. Repeat the step 1 for all columns.

  9. How to Solve an Assignment Problem Using the Hungarian Method

    In this lesson we learn what is an assignment problem and how we can solve it using the Hungarian method.

  10. PDF Chapter 2 The Hungarian Method for the Assignment Problem

    realized that Egervary's paper gave a computationally trivial method for reducing´ the general assignment problem to a 0-1 problem. Thus, by putting the two ideas together, the Hungarian Method was born. I tested the algorithm by solving 12 by 12 problems with random 3-digit ratings by hand. I could do any such problem, with

  11. Assignment Problem, Maximization Example, Hungarian Method

    The Hungarian Method can also solve such assignment problems, as it is easy to obtain an equivalent minimization problem by converting every number in the matrix to an opportunity loss. The conversion is accomplished by subtracting all the elements of the given matrix from the highest element. It turns out that minimizing opportunity loss ...

  12. How to Solve the Assignment Problem: A Complete Guide

    Here, we will focus on the steps involved in solving the assignment problem using the Hungarian method, which is the most commonly used and efficient method. Step 1: Set up the cost matrix. The first step in solving the assignment problem is to set up the cost matrix, which represents the cost of assigning a task to an agent.

  13. Hungarian Method, Assignment Problem, Hungarian Algorithm

    Steps in Hungarian Method. 1. Identify the minimum element in each row and subtract it from every element of that row. 2. Identify the minimum element in each column and subtract it from every element of that column. 3. Make the assignments for the reduced matrix obtained from steps 1 and 2 in the following way: For each row or column with a ...

  14. Research and Implementation of Hungarian Method Based on the Structure

    Hungarian method is a classical method for solving assignment problems. It also can be widely used in other problems, such as matching problem. This paper researches its application on using structural index reduction method to solve high-index DAEs, based on the combinatorial relaxation theory.

  15. A Note on Solving the Transportation Model by the Hungarian Method of

    Hence the Hungarian method of assignment can be extended to sole the balances transportation model. 2.4 Modified Hungarian Method of Assignment for Solving Transportation Problem. The steps of the Hungarian Method of assignment for the balanced transportation model will be as follows: Step 1. Consider the balanced transportation model, as all ...

  16. Solution of assignment problems (Hungarian Method)

    Solve the following assignment problem. Solution: Since the number of columns is less than the number of rows, given assignment problem is unbalanced one. To balance it , introduce a dummy column with all the entries zero. The revised assignment problem is. Here only 3 tasks can be assigned to 3 men.

  17. linear programming

    2,725 13 35. That is exact matrix I got now when covering all zeros I have r=4 covering lines and since problem has n=5 since r<n. STEP3: now 1 is least uncovered element subtracting 1 from all uncover element and adding 1 to element at intersection of covering line I am left with matrix that has same problem only one zero in A and D but now r=n .

  18. Hungarian Algorithm Calculator Online

    The Hungarian Algorithm Calculator is a powerful tool used to solve optimization problems known as the assignment problem. It finds the optimal assignment of tasks to resources, minimizing the total cost or maximizing the total profit. This calculator employs the Hungarian algorithm, a method that efficiently solves assignment problems by ...

  19. Alternative assignment problem using hungarian method

    This video also solve the assignment problem using hungarian method with the different techniques in Operations Research

  20. MCQ Assignment

    To proceed with the MODI algorithm for solving an assignment problem, the number of dummy; allocations need to be added are a. n b. 2n c. n - 1 d. 2n - 1. The Hungarian method for solving an assignment problem can also be used to solve; a. A transportation problem b. A travelling salesman problem c. Both (a) and (b) d. Only (b)

  21. Assignment MCQ [Free PDF]

    Assignment Question 10. An assignment problem is solved to minimize the total processing time of four jobs (1, 2, 3 and 4) on four different machines such that each job is processed exactly by one machine and each machine processes exactly one job. The minimum total processing time is found to be 500 minutes.

  22. The Hungarian method for solving an assignment problem can also be used

    The Hungarian method for solving an assignment problem can also be used to solve: A. A transportation problem: B. A travelling salesman problem: C. A linear programming problem: D. Both a and b: Answer» B. A travelling salesman problem

  23. The Hungarian method for solving an assignment problem can also be used

    The Hungarian method for solving an assignment problem can also be used to solve: A. A transportation problem: B. A travelling salesman problem: C. A linear programming problem: D. Both a and b: Answer» B. A travelling salesman problem