Question

In: Computer Science

Assignment problem. Give a small example of an assignment problem statement. Outline an algorithm for solving...

Assignment problem.

  1. Give a small example of an assignment problem statement.

  1. Outline an algorithm for solving the assignment problem.

  1. Is your algorithm polynomial? Explain.

Solutions

Expert Solution

Before diving into the problem, let's start with the definition part of the algorithm. Also, please drop a "LIKE" on the post for the efforts.

Definition:

An assignment problem is a unique case of a transportation problem where the primary objective is to assign quite a number of resources to be in the equal count with activities to minimize the total cost and maximize the net profit of allocation.

The problem of this algorithm arises because of the availability of resources such as men, machines etc. have varying degrees of efficiency for performing different activities, therefore, cost, profit or loss of performing the different activities is different.

Example:

You work as a manager for a chip manufacturer, and you currently have 3 people on the road meeting clients. Your salespeople are in Jaipur, Pune and Bangalore, and you want them to fly to three other cities: Delhi, Mumbai and Kerala. The table below shows the cost of airline tickets in INR between the cities:

The question: where would you send each of your salespeople in order to minimize fair?

Possible assignment: Cost = 11000 INR

Other Possible assignment: Cost = 9500 INR and this is the best of the 3! possible assignments.

Brute force solution is to consider every possible assignment implies a complexity of Ω(n!).

The Hungarian algorithm, aka Munkres assignment algorithm, utilizes the following theorem for polynomial runtime complexity (worst case O(n3)) 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 optimal assignment for the original cost matrix.

We reduce our original weight matrix to contain zeros, by using the above theorem. We try to assign tasks to agents such that each agent is doing only one task and the penalty incurred in each case is zero.

Core of the algorithm (assuming square matrix):

  1. For each row of the matrix, find the smallest element and subtract it from every element in its row.
  2. Do the same (as step 1) for all columns.
  3. Cover all zeros in the matrix using minimum number of horizontal and vertical lines.
  4. 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.
  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.

    An explanation for an above simple example:

     
    Below is the cost matrix of example given in above diagrams.
     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,
    we have found the optimal assignment. 
     2500  4000  3500
     4000  6000  3500
     2000  4000  2500
    
    So the optimal cost is 4000 + 3500 + 2000 = 9500
    

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

     
    cost matrix:
     1500  4000  4500
     2000  6000  3500
     2000  4000  2500
    
    Step 1: Subtract minimum of every row.
    1500, 2000 and 2000 are subtracted from rows 1, 2 and 
    3 respectively.
    
      0    2500  3000
      0    4000  1500
      0    2000   500
    
    Step 2: Subtract minimum of every column.
    0, 2000 and 500 are subtracted from columns 1, 2 and 3 
    respectively.
    
      0     500  2500
      0    2000  1000 
      0      0      0 
    
    Step 3: Cover all zeroes with minimum number of 
    horizontal and vertical lines.
    Step 4:  Since we only need 2 lines to cover all zeroes,
    we have NOT found the optimal assignment. 
    
    Step 5:  We subtract the smallest uncovered entry 
    from all uncovered rows. Smallest entry is 500.
     -500    0   2000
     -500  1500   500
       0     0      0
    
    Then we add the smallest entry to all covered columns, we get
       0     0   2000
       0   1500   500
      500    0      0
    
    Now we return to Step 3:. Here we cover again using
    lines. and go to Step 4:. Since we need 3 lines to 
    cover, we found the optimal solution.
     1500  4000  4500
     2000  6000  3500
     2000  4000  2500
    
    So the optimal cost is 4000 + 2000 + 2500 = 8500
    

I hope now you are clear with the assignment problem statement. If you need more explanation, do let me know in the comment. Also, DROP A LIKE ON THIS POST!


Related Solutions

give an example of a time u used good judgement and logic in solving a problem?
please keep answers briefgive an example of a time u used good judgement and logic in solving a problem?how did u convince your co-workers/ colleagues that your decision was the best for the business?why did you think your logic was the best solution ?
Summarize the strategic hands for problem-solving, and give an example of the meaning of each one...
Summarize the strategic hands for problem-solving, and give an example of the meaning of each one which of the following best summarizes the strategic hand there may be more than one strategy and provide an example of the meaning A there may be several strategies to solving the problem, however only one of them will find the correct answer. For example, there is more than one strategy to stop exit squared plus 3X +2 = 0 however, only one of...
Describe an efficient recursive algorithm for solving the element uniqueness problem
Describe an efficient recursive algorithm for solving the element uniqueness problem, which runs in time that is at most O(n2) in the worst case without using sorting.    
Problem Solving/Goal Setting Checkpoint Provide an example of a time when you used the problem solving...
Problem Solving/Goal Setting Checkpoint Provide an example of a time when you used the problem solving and decision making. What is the role of creativity in the problem solving process? What are three ways that you can increase your personal creativity? Respond to the following in a essay: Describe a time you encountered a problem that required you to use the problem solving and decision making steps on page 150 of the textbook. How did you solve the problem using...
Consider the bankers algorithm for deadlock avoidance. Give an example of this algorithm for 7 processes...
Consider the bankers algorithm for deadlock avoidance. Give an example of this algorithm for 7 processes and 5 resource types.
Please write a Java algorithm solving the following problem: Implement a Java method to check if...
Please write a Java algorithm solving the following problem: Implement a Java method to check if a binary tree is balanced. For this assignment, a balanced tree is defined to be a tree such that the heights of the two subtrees of any node never differ by more than one. 1. First, please create the following two classes supporting the Binary Tree Node and the Binary Tree: public class BinTreeNode<T> { private T key; private Object satelliteData; private BinTreeNode<T> parent;...
In constraint satisfaction, local search is a method for solving the problem. Is this an example...
In constraint satisfaction, local search is a method for solving the problem. Is this an example of a hill climbing search or gradient decent search? Why? How would you convert the algorithm between the two?
Is quicksort a stable sorting algorithm? If yes, prove it, if not, give an example
Is quicksort a stable sorting algorithm? If yes, prove it, if not, give an example
Recall the dynamic programming algorithm we saw in class for solving the 0/1 knapsack problem for...
Recall the dynamic programming algorithm we saw in class for solving the 0/1 knapsack problem for n objects with a knapsack capacity of K. In particular, we characterized our recurrence OPT(j, W) to be following quantity: OPT(j, W) := The maximum profit that can be obtained when selecting from objects 1, 2, . . . , j with a knapsack capacity of W , where (after filling in our dynamic programming table), we return the value stored at OPT(n, K)...
Problem 15. Give an example of a two mutually exclusive events. Problem 16. Give an example...
Problem 15. Give an example of a two mutually exclusive events. Problem 16. Give an example of three events E, F, and G so that each pair of events is mutually exclusive Problem 17. Consider a situation where #(all) = 100, #(E) = 32, #(F) = 52, and #(E ∩ F) = 13. 1. Find P(E | F). 2. Calculate #(E ∩ F) #(F) and explain why this matches the value in part 1. Problem 18. Suppose we have 30...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT