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

how assignment problem is solved for an optimal solution

  • 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)
  • Count of nodes with maximum connection in an undirected graph
  • Erdos Renyl Model (for generating Random Graphs)
  • Types of Graphs with Examples
  • Clustering Coefficient in Graph Theory
  • Maximum number of edges in Bipartite graph
  • Find node having maximum number of common nodes with a given node K
  • Convert the undirected graph into directed graph such that there is no path of length greater than 1
  • Count of Disjoint Groups by grouping points that are at most K distance apart
  • Maximize count of nodes disconnected from all other nodes in a Graph
  • Program to find the number of region in Planar Graph
  • Cost of painting n * m grid
  • Ways to Remove Edges from a Complete Graph to make Odd Edges
  • Number of Simple Graph with N Vertices and M Edges
  • Balance pans using given weights that are powers of a number
  • Chiliagon Number
  • Sum of all the numbers in the Nth parenthesis
  • Shortest path in a graph from a source S to destination D with exactly K edges for multiple Queries
  • Find if two given Quadratic equations have common roots or not

Hungarian Algorithm for Assignment Problem | Set 1 (Introduction)

hungarian1

  • For each row of the matrix, find the smallest element and subtract it from every element in its row.
  • Do the same (as step 1) for all columns.
  • Cover all zeros in the matrix using minimum number of horizontal and vertical lines.
  • Test for Optimality: If the minimum number of covering lines is n, an optimal assignment is possible and we are finished. Else if lines are lesser than n, we haven’t found the optimal assignment, 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.
Try it before moving to see the solution

Explanation for above simple example:

  An example that doesn’t lead to optimal value in first attempt: In the above example, the first check for optimality did give us solution. What if we the number covering lines is less than n.

Time complexity : O(n^3), where n is the number of workers and jobs. This is because the algorithm implements the Hungarian algorithm, which is known to have a time complexity of O(n^3).

Space complexity :   O(n^2), where n is the number of workers and jobs. This is because the algorithm uses a 2D cost matrix of size n x n to store the costs of assigning each worker to a job, and additional arrays of size n to store the labels, matches, and auxiliary information needed for the algorithm.

In the next post, we will be discussing implementation of the above algorithm. The implementation requires more steps as we need to find minimum number of lines to cover all 0’s using a program. References: http://www.math.harvard.edu/archive/20_spring_05/handouts/assignment_overheads.pdf https://www.youtube.com/watch?v=dQDZNHwuuOY

Please Login to comment...

  • Mathematical
  • How to Delete Whatsapp Business Account?
  • Discord vs Zoom: Select The Efficienct One for Virtual Meetings?
  • Otter AI vs Dragon Speech Recognition: Which is the best AI Transcription Tool?
  • Google Messages To Let You Send Multiple Photos
  • 30 OOPs Interview Questions and Answers (2024)

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

OPERATIONS RESEARCH

Lesson 9. solution of assignment problem.

Current course

Hungarian Method Examples

Now we will examine a few highly simplified illustrations of Hungarian Method for solving an assignment problem .

Later in the chapter, you will find more practical versions of assignment models like Crew assignment problem , Travelling salesman problem , etc.

Example-1, Example-2

Example 1: Hungarian Method

The Funny Toys Company has four men available for work on four separate jobs. Only one man can work on any one job. The cost of assigning each man to each job is given in the following table. The objective is to assign men to jobs in such a way that the total cost of assignment is minimum.

This is a minimization example of assignment problem . We will use the Hungarian Algorithm to solve this problem.

Identify the minimum element in each row and subtract it from every element of that row. The result is shown in the following table.

"A man has one hundred dollars and you leave him with two dollars, that's subtraction." -Mae West

On small screens, scroll horizontally to view full calculation

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

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, choose the cell arbitrarily for assignment.

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.

Use Horizontal Scrollbar to View Full Table Calculation

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 (ii) and (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.

Select the smallest element (i.e., 1) 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.

Now again make the assignments for the reduced matrix.

Final Table: Hungarian Method

Since the number of assignments is equal to the number of rows (& columns), this is the optimal solution.

The total cost of assignment = A1 + B4 + C2 + D3

Substituting values from original table: 20 + 17 + 17 + 24 = Rs. 78.

Share This Article

Operations Research Simplified Back Next

Goal programming Linear programming Simplex Method Transportation Problem

Search

www.springer.com The European Mathematical Society

  • StatProb Collection
  • Recent changes
  • Current events
  • Random page
  • Project talk
  • Request account
  • What links here
  • Related changes
  • Special pages
  • Printable version
  • Permanent link
  • Page information
  • View source

Assignment problem

The problem of optimally assigning $ m $ individuals to $ m $ jobs. It can be formulated as a linear programming problem that is a special case of the transport problem :

maximize $ \sum _ {i,j } c _ {ij } x _ {ij } $

$$ \sum _ { j } x _ {ij } = a _ {i} , i = 1 \dots m $$

(origins or supply),

$$ \sum _ { i } x _ {ij } = b _ {j} , j = 1 \dots n $$

(destinations or demand), where $ x _ {ij } \geq 0 $ and $ \sum a _ {i} = \sum b _ {j} $, which is called the balance condition. The assignment problem arises when $ m = n $ and all $ a _ {i} $ and $ b _ {j} $ are $ 1 $.

If all $ a _ {i} $ and $ b _ {j} $ in the transposed problem are integers, then there is an optimal solution for which all $ x _ {ij } $ are integers (Dantzig's theorem on integral solutions of the transport problem).

In the assignment problem, for such a solution $ x _ {ij } $ is either zero or one; $ x _ {ij } = 1 $ means that person $ i $ is assigned to job $ j $; the weight $ c _ {ij } $ is the utility of person $ i $ assigned to job $ j $.

The special structure of the transport problem and the assignment problem makes it possible to use algorithms that are more efficient than the simplex method . Some of these use the Hungarian method (see, e.g., [a5] , [a1] , Chapt. 7), which is based on the König–Egervary theorem (see König theorem ), the method of potentials (see [a1] , [a2] ), the out-of-kilter algorithm (see, e.g., [a3] ) or the transportation simplex method.

In turn, the transportation problem is a special case of the network optimization problem.

A totally different assignment problem is the pole assignment problem in control theory.

  • This page was last edited on 5 April 2020, at 18:48.
  • Privacy policy
  • About Encyclopedia of Mathematics
  • Disclaimers
  • Impressum-Legal

Quadratic assignment problem

Author: Thomas Kueny, Eric Miller, Natasha Rice, Joseph Szczerba, David Wittmann (SysEn 5800 Fall 2020)

  • 1 Introduction
  • 2.1 Koopmans-Beckman Mathematical Formulation
  • 2.2.1 Parameters
  • 2.3.1 Optimization Problem
  • 2.4 Computational Complexity
  • 2.5 Algorithmic Discussions
  • 2.6 Branch and Bound Procedures
  • 2.7 Linearizations
  • 3.1 QAP with 3 Facilities
  • 4.1 Inter-plant Transportation Problem
  • 4.2 The Backboard Wiring Problem
  • 4.3 Hospital Layout
  • 4.4 Exam Scheduling System
  • 5 Conclusion
  • 6 References

Introduction

The Quadratic Assignment Problem (QAP), discovered by Koopmans and Beckmann in 1957 [1] , is a mathematical optimization module created to describe the location of invisible economic activities. An NP-Complete problem, this model can be applied to many other optimization problems outside of the field of economics. It has been used to optimize backboards, inter-plant transportation, hospital transportation, exam scheduling, along with many other applications not described within this page.

Theory, Methodology, and/or Algorithmic Discussions

Koopmans-beckman mathematical formulation.

Economists Koopmans and Beckman began their investigation of the QAP to ascertain the optimal method of locating important economic resources in a given area. The Koopmans-Beckman formulation of the QAP aims to achieve the objective of assigning facilities to locations in order to minimize the overall cost. Below is the Koopmans-Beckman formulation of the QAP as described by neos-guide.org.

Quadratic Assignment Problem Formulation

{\displaystyle F=(F_{ij})}

Inner Product

{\displaystyle A,B}

Note: The true objective cost function only requires summing entries above the diagonal in the matrix comprised of elements

{\displaystyle F_{i,j}(X_{\phi }DX_{\phi }^{T})_{i,j}}

Since this matrix is symmetric with zeroes on the diagonal, dividing by 2 removes the double count of each element to give the correct cost value. See the Numerical Example section for an example of this note.

Optimization Problem

With all of this information, the QAP can be summarized as:

{\displaystyle \min _{X\in P}\langle F,XDX^{T}\rangle }

Computational Complexity

QAP belongs to the classification of problems known as NP-complete, thus being a computationally complex problem. QAP’s NP-completeness was proven by Sahni and Gonzalez in 1976, who states that of all combinatorial optimization problems, QAP is the “hardest of the hard”. [2]

Algorithmic Discussions

While an algorithm that can solve QAP in polynomial time is unlikely to exist, there are three primary methods for acquiring the optimal solution to a QAP problem:

  • Dynamic Program
  • Cutting Plane

Branch and Bound Procedures

The third method has been proven to be the most effective in solving QAP, although when n > 15, QAP begins to become virtually unsolvable.

The Branch and Bound method was first proposed by Ailsa Land and Alison Doig in 1960 and is the most commonly used tool for solving NP-hard optimization problems.

A branch-and-bound algorithm consists of a systematic enumeration of candidate solutions by means of state space search: the set of candidate solutions is thought of as forming a rooted tree with the full set at the root. The algorithm explores branches of this tree, which represent subsets of the solution set. Before one lists all of the candidate solutions of a branch, the branch is checked against upper and lower estimated bounds on the optimal solution, and the branch is eliminated if it cannot produce a better solution than the best one found so far by the algorithm.

Linearizations

The first attempts to solve the QAP eliminated the quadratic term in the objective function of

{\displaystyle min\sum _{i=1}^{n}\sum _{j=1}^{n}c{_{\phi (i)\phi (j)}}+\sum _{i=1}^{n}b{_{\phi (i)}}}

in order to transform the problem into a (mixed) 0-1 linear program. The objective function is usually linearized by introducing new variables and new linear (and binary) constraints. Then existing methods for (mixed) linear integer programming (MILP) can be applied. The very large number of new variables and constraints, however, usually poses an obstacle for efficiently solving the resulting linear integer programs. MILP formulations provide LP relaxations of the problem which can be used to compute lower bounds.

Numerical Example

Qap with 3 facilities.

{\displaystyle D={\begin{bmatrix}0&5&6\\5&0&3.6\\6&3.6&0\end{bmatrix}}}

Applications

Inter-plant transportation problem.

The QAP was first introduced by Koopmans and Beckmann to address how economic decisions could be made to optimize the transportation costs of goods between both manufacturing plants and locations. [1] Factoring in the location of each of the manufacturing plants as well as the volume of goods between locations to maximize revenue is what distinguishes this from other linear programming assignment problems like the Knapsack Problem.

The Backboard Wiring Problem

As the QAP is focused on minimizing the cost of traveling from one location to another, it is an ideal approach to determining the placement of components in many modern electronics. Leon Steinberg proposed a QAP solution to optimize the layout of elements on a blackboard by minimizing the total amount of wiring required. [4]

When defining the problem Steinberg states that we have a set of n elements

{\displaystyle E=\left\{E_{1},E_{2},...,E_{n}\right\}}

as well as a set of r points

{\displaystyle P_{1},P_{2},...,P_{r}}

In his paper he derives the below formula:

{\displaystyle min\sum _{1\leq i\leq j\leq n}^{}C_{ij}(d_{s(i)s(j))})}

In his paper Steinberg a backboard with a 9 by 4 array, allowing for 36 potential positions for the 34 components that needed to be placed on the backboard. For the calculation, he selected a random initial placement of s1 and chose a random family of 25 unconnected sets.

The initial placement of components is shown below:

how assignment problem is solved for an optimal solution

After the initial placement of elements, it took an additional 35 iterations to get us to our final optimized backboard layout. Leading to a total of 59 iterations and a final wire length of 4,969.440.

how assignment problem is solved for an optimal solution

Hospital Layout

Building new hospitals was a common event in 1977 when Alealid N Elshafei wrote his paper on "Hospital Layouts as a Quadratic Assignment Problem". [5] With the high initial cost to construct the hospital and to staff it, it is important to ensure that it is operating as efficiently as possible. Elshafei's paper was commissioned to create an optimization formula to locate clinics within a building in such a way that minimizes the total distance that a patient travels within the hospital throughout the year. When doing a study of a major hospital in Cairo he determined that the Outpatient ward was acting as a bottleneck in the hospital and focused his efforts on optimizing the 17 departments there.

Elshafei identified the following QAP to determine where clinics should be placed:

{\displaystyle min\sum _{i,j}\sum _{k,q}f_{ik}d_{jq}y_{ij}y_{kq}}

For the Cairo hospital with 17 clinics, and one receiving and recording room bringing us to a total of 18 facilities. By running the above optimization Elshafei was able to get the total distance per year down to 11,281,887 from a distance of 13,973,298 based on the original hospital layout.

Exam Scheduling System

The scheduling system uses matrices for Exams, Time Slots, and Rooms with the goal of reducing the rate of schedule conflicts. To accomplish this goal, the “examination with the highest cross faculty student is been prioritized in the schedule after which the examination with the highest number of cross-program is considered and finally with the highest number of repeating student, at each stage group with the highest number of student are prioritized.” [6]

{\displaystyle n!}

  • ↑ 1.0 1.1 1.2 Koopmans, T., & Beckmann, M. (1957). Assignment Problems and the Location of Economic Activities. Econometrica, 25(1), 53-76. doi:10.2307/1907742
  • ↑ 2.0 2.1 Quadratic Assignment Problem. (2020). Retrieved December 14, 2020, from https://neos-guide.org/content/quadratic-assignment-problem
  • ↑ 3.0 3.1 3.2 Burkard, R. E., Çela, E., Pardalos, P. M., & Pitsoulis, L. S. (2013). The Quadratic Assignment Problem. https://www.opt.math.tugraz.at/~cela/papers/qap_bericht.pdf .
  • ↑ 4.0 4.1 Leon Steinberg. The Backboard Wiring Problem: A Placement Algorithm. SIAM Review . 1961;3(1):37.
  • ↑ 5.0 5.1 Alwalid N. Elshafei. Hospital Layout as a Quadratic Assignment Problem. Operational Research Quarterly (1970-1977) . 1977;28(1):167. doi:10.2307/300878
  • ↑ 6.0 6.1 Muktar, D., & Ahmad, Z.M. (2014). Examination Scheduling System Based On Quadratic Assignment.

Navigation menu

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.

how assignment problem is solved for an optimal solution

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.

how assignment problem is solved for an optimal solution

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.

how assignment problem is solved for an optimal solution

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.

how assignment problem is solved for an optimal solution

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

Step 3 (Assignment):

how assignment problem is solved for an optimal solution

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

how assignment problem is solved for an optimal solution

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.

how assignment problem is solved for an optimal solution

∴ The given assignment problem is balanced.

Now let us find the solution.

The cost matrix of the given assignment problem is

how assignment problem is solved for an optimal solution

Column 3 contains no zero. Go to Step 2.

how assignment problem is solved for an optimal solution

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

how assignment problem is solved for an optimal solution

The optimal assignment (minimum) cost = ` 9

Example 10.9

Solve the following assignment problem.

how assignment problem is solved for an optimal 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

how assignment problem is solved for an optimal solution

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.

how assignment problem is solved for an optimal solution

Step 3 (Assignment) :

how assignment problem is solved for an optimal solution

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

how assignment problem is solved for an optimal solution

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.

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

Google OR-Tools

  • Google OR-Tools
  • Español – América Latina
  • Português – Brasil
  • Tiếng Việt

Solving an Assignment Problem

This section presents an example that shows how to solve an assignment problem using both the MIP solver and the CP-SAT solver.

In the example there are five workers (numbered 0-4) and four tasks (numbered 0-3). Note that there is one more worker than in the example in the Overview .

The costs of assigning workers to tasks are shown in the following table.

The problem is to assign each worker to at most one task, with no two workers performing the same task, while minimizing the total cost. Since there are more workers than tasks, one worker will not be assigned a task.

MIP solution

The following sections describe how to solve the problem using the MPSolver wrapper .

Import the libraries

The following code imports the required libraries.

Create the data

The following code creates the data for the problem.

The costs array corresponds to the table of costs for assigning workers to tasks, shown above.

Declare the MIP solver

The following code declares the MIP solver.

Create the variables

The following code creates binary integer variables for the problem.

Create the constraints

Create the objective function.

The following code creates the objective function for the problem.

The value of the objective function is the total cost over all variables that are assigned the value 1 by the solver.

Invoke the solver

The following code invokes the solver.

Print the solution

The following code prints the solution to the problem.

Here is the output of the program.

Complete programs

Here are the complete programs for the MIP solution.

CP SAT solution

The following sections describe how to solve the problem using the CP-SAT solver.

Declare the model

The following code declares the CP-SAT model.

The following code sets up the data for the problem.

The following code creates the constraints for the problem.

Here are the complete programs for the CP-SAT solution.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-01-02 UTC.

Book cover

Computing in Engineering and Technology pp 155–164 Cite as

Optimal Solution for Fuzzy Assignment Problem and Applications

  • Sanjivani M. Ingle 18 &
  • Kirtiwant P. Ghadle 18  
  • Conference paper
  • First Online: 17 October 2019

1014 Accesses

1 Citations

Part of the book series: Advances in Intelligent Systems and Computing ((AISC,volume 1025))

Assignment problem is the biggest significant problem in decision-making. In this paper, a novel technique is planned to discover the best possible solution to a balanced fuzzy assignment problem (FAP). We derive two formulae; one is related to the odd number of fuzzy numbers and another is related to the even number of fuzzy numbers to discover better answer from the existing answer to the FAP. Proposed technique give the best possible solution to balanced FAP in the fewer number of iteration than existing techniques. An algebraic illustration is specified to authenticate the process of proposed technique which is based on industrial environment and education domain.

  • Balanced fuzzy assignment problem
  • Hexagonal fuzzy numbers
  • Pentagonal fuzzy numbers

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

Buying options

  • 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
  • Durable hardcover edition

Tax calculation will be finalised at checkout

Purchases are for personal use only

Zadeh, L.: Fuzzy set. Inf. Control 8 , 338–353 (1965)

Article   Google Scholar  

Pandian, P., Kavitha, K.: A new method for solving fuzzy assignment problems. Ann. Pure Appl. Math 1 (1), 69–83 (2012)

Google Scholar  

Kadhirvel, K., Balamurugan, K.: Method for solving Hungarian assignment problems using the triangular and trapezoidal fuzzy number. Int. J. Eng. Res. Appl. (IJERA) 2 (5), 399–403 (2012)

Berghman, L., Leus, R., Spieksma, F.: Optimal solutions for a dock assignment problem with trailer transportation. Ann. Oper. Res. 3–25 (2014)

Khandelwal, A.: A modified approach for assignment method. Int. J. Latest Res. Sci. Technol. 3 (2), 136–138 (2014)

MathSciNet   Google Scholar  

Nirmala, G., Anju, G.: Cost minimization assignment problem using fuzzy quantifier. Int. J. Comput. Sci. Inf. Technol. 5 (6), 7948–7950 (2014)

Anuradha, D.: On solving fuzzy solid assignment problems. Int. Res. J. Eng. Technol. (IRJET) 2 (5), 322–325 (2015)

Singh, J., Thakur, N.: A Novel method to solve assignment problem in fuzzy environment. Ind. Eng. Lett. 5 (2), 31–35 (2015)

Frimpong, F., Owusu, A.: Allocation of classroom space using linear programming (A case study: Premier nurses training college, Kumasi). J. Econ. Sustain. Dev. 6 (2), 12–19 (2015)

Ghadle, K., Pathade, P.: Optimal solution of balanced and unbalanced fuzzy transportation problem using hexagonal fuzzy number. Int. J. Math. Res. 5 (2), 131–137 (2016)

Ghadle, K., Pathade, P.: An improvement to one’s BCM for balance and unbalance transshipment problem by using fuzzy numbers. Accepted Springer Book Series-Trends in Mathematics (2018)

Ghadle, K., Ingle, S.: Optimal solution of a mixed type fuzzy transportation problem. Int. J. Fuzzy Math. Arch. 15(1), 83–89 (2018)

Download references

Author information

Authors and affiliations.

Department of Mathematics, Dr. Babasaheb Ambedkar, Marathwada University, Aurangabad, 431004, MS, India

Sanjivani M. Ingle & Kirtiwant P. Ghadle

You can also search for this author in PubMed   Google Scholar

Corresponding author

Correspondence to Sanjivani M. Ingle .

Editor information

Editors and affiliations.

Department of Electronics and Telecommunication Engineering, Dr. Babasaheb Ambedkar Technological University, Lonere, Maharashtra, India

Brijesh Iyer

Department of Computer Engineering, Dr. Babasaheb Ambedkar Technological University, Lonere, Maharashtra, India

P. S. Deshpande

Department of Electronics and Computer Engineering, Indian Institute of Technology Roorkee, Roorkee, Uttarakhand, India

S. C. Sharma

Deogiri Institute of Engineering and Management Studies, Aurangabad, Maharashtra, India

Ulhas Shiurkar

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Singapore Pte Ltd.

About this paper

Cite this paper.

Ingle, S.M., Ghadle, K.P. (2020). Optimal Solution for Fuzzy Assignment Problem and Applications. In: Iyer, B., Deshpande, P., Sharma, S., Shiurkar, U. (eds) Computing in Engineering and Technology. Advances in Intelligent Systems and Computing, vol 1025. Springer, Singapore. https://doi.org/10.1007/978-981-32-9515-5_15

Download citation

DOI : https://doi.org/10.1007/978-981-32-9515-5_15

Published : 17 October 2019

Publisher Name : Springer, Singapore

Print ISBN : 978-981-32-9514-8

Online ISBN : 978-981-32-9515-5

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

IMAGES

  1. 8 Steps For Effective Problem Solving

    how assignment problem is solved for an optimal solution

  2. Solution of Assignment Problems

    how assignment problem is solved for an optimal solution

  3. The most effective problem-solving strat

    how assignment problem is solved for an optimal solution

  4. (PDF) A New Method for Finding an Optimal Solution of Assignment Problem

    how assignment problem is solved for an optimal solution

  5. Alternative Solution in Assignment Problem

    how assignment problem is solved for an optimal solution

  6. 7 Most Effective Ways For How To Solve Assignment Problems

    how assignment problem is solved for an optimal solution

VIDEO

  1. Assignment problem |Introduction

  2. Introduction to Assignment Problem Unbalanced Hungarian Method|Linear Programming|Dream Maths

  3. Assignment Problems- Multiple Optimal Assignments

  4. Search an Element in an Array Using Binary Search

  5. The Transportation Problem Lecture 10 : Optimization, Practice for Problem Solving

  6. Optimal substructure: the optimal solution to a problem of size n, can be derived from the optima

COMMENTS

  1. Assignment problem

    This is an unbalanced assignment problem. One way to solve it is to invent a fourth dummy task, perhaps called "sitting still doing nothing", with a cost of 0 for the taxi assigned to it. This reduces the problem to a balanced assignment problem, which can then be solved in the usual way and still give the best solution to the problem.

  2. Hungarian Method

    Hungarian Method to Solve Assignment Problems. ... 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 ...

  3. 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 ...

  4. ES-3: Lesson 9. SOLUTION OF ASSIGNMENT PROBLEM

    The assignment problem can be solved by the following four methods: a) Complete enumeration method. b) Simplex Method. c) Transportation method. d) Hungarian method. 9.2.1 Complete enumeration method. In this method, a list of all possible assignments among the given resources and activities is prepared.

  5. Hungarian Method Examples, Assignment Problem

    We will use the Hungarian Algorithm to solve this problem. ... 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. Table . Use Horizontal Scrollbar to View ...

  6. PDF The Assignment Problem and Primal-Dual Algorithms 1 Assignment Problem

    If we subtract the same amount from each entry in a row of C, we will not change the optimal solution. If we subtract the same amount from each entry in a column of C, we will not change the optimal solution. Observation 2. Consider an assignment problem with cost matrix C. If C 0, and there exists an assignment which only assigns ito jif c

  7. Assignment problem

    The assignment problem arises when $ m = n $ and all $ a _ {i} $ and $ b _ {j} $ are $ 1 $. If all $ a _ {i} $ and $ b _ {j} $ in the transposed problem are integers, then there is an optimal solution for which all $ x _ {ij } $ are integers (Dantzig's theorem on integral solutions of the transport problem). In the assignment problem, for such ...

  8. PDF Lecture 8: Assignment Algorithms

    Hungarian algorithm steps for minimization problem. Step 1: For each row, subtract the minimum number in that row from all numbers in that row. Step 2: For each column, subtract the minimum number in that column from all numbers in that column. Step 3: Draw the minimum number of lines to cover all zeroes.

  9. Quadratic assignment problem

    For the optimal solution = (), the calculation is as follows: = [] [] [] = [], (), = [] Looking at the figure of the optimal solution, the flow distance values are repeated in this matrix which is why the sum of all elements must be divided by 2. This gives , = so the minimum cost is 86.5.. Optimal Solution for the example with facility/location pairings listed.

  10. The Assignment Problem

    The assignment problem is one of the fundamental combinatorial optimization problems in the branch of optimization or operations research in mathematics. ... It will only produce integer solutions. These special constraint matrices are called uni-modular matrices (See: ... Simplex Method adapted to solve the assignment problem in bi-partite graphs

  11. Assignment Problem and Hungarian Algorithm

    This problem is known as the assignment problem. The assignment problem is a special case of the transportation problem, which in turn is a special case of the min-cost flow problem, so it can be solved using algorithms that solve the more general cases. Also, our problem is a special case of binary integer linear programming problem (which is ...

  12. The assignment problem revisited

    First, we give a detailed review of two algorithms that solve the minimization case of the assignment problem, the Bertsekas auction algorithm and the Goldberg & Kennedy algorithm. It was previously alluded that both algorithms are equivalent. We give a detailed proof that these algorithms are equivalent. Also, we perform experimental results comparing the performance of three algorithms for ...

  13. Solution of assignment problems (Hungarian Method)

    The optimal assignment (minimum) cost = ` 9. Example 10.9. 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

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

    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.

  15. Linear Assignment Problems in Combinatorial Optimization

    The reason for suboptimality lies in the fact that each of the assignment problems solved during the progress of Algorithm 1 may have alternative optimal solutions. A "wrong" choice of an alternative solution deviates the algorithm from the optimal execution "path". ... P and Q are nonnegative integers and the Hungarian algorithm ...

  16. Operations Research with R

    The assignment problem represents a special case of linear programming problem used for allocating resources (mostly workforce) in an optimal way; it is a highly useful tool for operation and project managers for optimizing costs. The lpSolve R package allows us to solve LP assignment problems with just very few lines of code.

  17. PDF UNIT 5 ASSIGNMENT PROBLEMS

    Assignment Problems 7 Hungarian Method of Solving an Assignment Problem The steps for obtaining an optimal solution of an assignment problem are as follows: 1. Check whether the given matrix is square. If not, make it square by adding a suitable number of dummy rows (or columns) with 0 cost/time elements. 2.

  18. Nash Balanced Assignment Problem

    The Balanced Assignment Problem (BAP) is a variant of the classic AP where instead of minimizing the total cost, we minimize the max-min distance which is the difference between the maximum assignment cost and the minimum one in the assignment solution. In [ 2 ], the authors proposed an efficient threshold-based algorithm to solve the BAP in ...

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

    Here is the video about assignment problem - Hungarian method with algorithm.NOTE: After row and column scanning, If you stuck with more than one zero in th...

  20. Solving an Assignment Problem

    This section presents an example that shows how to solve an assignment problem using both the MIP solver and the CP-SAT solver. Example. In the example there are five workers (numbered 0-4) and four tasks (numbered 0-3).

  21. A New Method for Finding an Optimal Solution of Assignment Problem

    Abdur [2] proposed a new approach to solve an unbalanced assignment problem by converting it to balanced one. Ahmed and Ahmad [3], Dutta and Pal [4] have developed modified versions of Hungarian ...

  22. Finding an Optimal Solution of Assignment Problem

    The personnel-assignment problem is the problem of choosing an optimal assignment of n men to n jobs, assuming that numerical ratings are given for each man's performance on each job.

  23. Optimal Solution for Fuzzy Assignment Problem and Applications

    We solved two numerical examples one is for cost minimizing and second, is for time minimizing balanced fuzzy assignment problem whose fuzzy optimal solution given by our system. For those problems, we convert the hexagonal and pentagonal fuzzy number into the triangular fuzzy number respectively due to this the lengthy calculation is minimized ...