UPI Study › Courses › Quantitative Analysis › Free lessons › Lesson 13.1 Free with a free account
The Assignment Problem
Quantitative Analysis · Chapter 13: Assignment ModelsSection 13.1 · lesson 54 of 5512 min · free with a free account
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Quantitative Analysis.
Lesson complete
Earn the 3 college credits for Quantitative Analysis
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Step by Step Through the Hungarian Algorithm →← Starting Simple and ImprovingNext lesson: Step by Step Through the Hungarian Algorithm →
In this lesson
What it is, where it appears, and why it matters.
- Recognise it as a special case of transportation
- Define its variables, constraints and objective
- Explain why total unimodularity gives 0-1 answers
- Formulate and solve a small binary LP
Transcript
Everything said in the video, section by section (1,641 words). Read along, or search it.
Assignment Problem · Section 13.1
The Assignment Problem
Welcome to section thirteen point one of Quantitative Analysis. This section is about the assignment problem. It answers one deceptively simple question. Who should do what? Four consultants and four projects. Four machines and four jobs. Each side matched exactly once, with nothing left over. That can sound more like a puzzle than a serious optimisation model. It is not. The assignment problem is a special case of the transportation problem. And it carries two beautiful properties that make it far easier to solve than it looks. By the end you will formulate one, solve one, and see exactly why greedy matching fails.
Definition
Matching Agents to Tasks, One to One
Start with the definition. The assignment problem matches a group of agents to an equal-sized group of tasks. The matching is strictly one to one. Every agent is assigned to exactly one task, and every task is done by exactly one agent. No agent sits idle, and no task is left uncovered. That is the whole structure, and it is remarkably clean. It is a special case of the transportation problem, and the word special is doing real work. A transportation problem allows any supplies and any demands. The assignment problem forces every supply and every demand to be exactly one. It also requires equal numbers of agents and tasks, which we call a balanced problem. What you get in return for those restrictions is a far easier problem to solve.
Four Ingredients
What Specifies an Assignment Problem
An assignment problem of a given size is specified by four ingredients. First, the agents. Workers, machines, salespeople, vehicles, consultants. Second, the tasks. Jobs, routes, territories, time slots, projects. Third, the cost matrix, written as a capital C. It is a square table with one row per agent and one column per task. The entry in row i, column j, is the cost of putting agent i on task j. That entry can be a cost, a profit, or a skill-fit score, depending on the question. Fourth, the decision variables, and these are purely binary. Each one equals one if that agent takes that task, and zero otherwise. Nothing in between is allowed. There is no such thing as half an assignment. Fix those four and the model writes itself, though in practice almost all the effort goes into the third ingredient.
Formal Model
The Minimisation Version
Here is the formal model, in its minimisation form. Minimise Z, the double sum over all agents and all tasks, of cost times variable. Only the cells you actually select contribute, because every other variable is zero. Then come two families of constraints. For every agent, that agent's row of variables sums to one. In words, each agent does exactly one task. For every task, that task's column of variables sums to one. In words, each task is done by exactly one agent. And every variable is restricted to zero or one. If your matrix holds profit, productivity or skill fit, simply replace minimise with maximise. Every other constraint stays exactly the same. One practical note. If agents and tasks are unequal in number, add dummy rows or columns at zero cost.
Where It Appears
Five Canonical Applications
So where does this template actually show up? Everywhere a manager must match a set of resources to a set of jobs. Personnel assignment matches employees to positions, maximising productivity or minimising training cost. Machine to job assignment matches machines to production jobs, minimising total setup plus processing time. Sales territory assignment matches salespeople to territories, maximising expected sales from existing relationships. Simplified vehicle routing matches delivery vehicles to pre-built routes, minimising distance or fuel cost. Project team formation matches specialists to project roles, maximising total skill fit across the team. The pattern to recognise is this. If a decision can be drawn as who does what, with each side matched exactly once, this is the model. The hard part is almost never the algebra. It is estimating the matrix. Choosing a metric, and filling in entries that genuinely separate good matches from bad.
Why Not General LP
Two Properties That Change Everything
At first glance this looks like any other binary integer program, to be thrown at branch and bound. Two properties make it dramatically easier than that. The first: integer solutions come for free. The constraint matrix of an assignment problem is totally unimodular. That means every square submatrix has a determinant of zero, plus one, or minus one. A classical result in polyhedral combinatorics applies here. An LP with a totally unimodular matrix and integer right-hand sides has integer-valued optimal corners. In plain language, drop the binary requirement, let each variable range between zero and one, and solve the LP. The answer comes back as zeros and ones anyway. No branch and bound, and no rounding. The second property is raw speed. The Hungarian algorithm, published by Kuhn in nineteen fifty-five, exploits this structure directly. It runs in order n cubed time, well ahead of general simplex on the same model. For a hundred agents the difference is academic. For ten thousand, the Hungarian method finishes in seconds where general solvers may take hours.
Worked Example
4 Consultants, 4 Client Projects
Time for a worked example. A consulting firm has four consultants and four client projects next month. The partner has rated each consultant's skill fit for each project, on a zero to one hundred scale. Higher means a better match. Consultant one scores eighty-five on A, ninety-two on B, seventy-eight on C, and eighty-eight on D. Consultant two scores seventy-six, eighty-one, ninety, and seventy-three. Consultant three scores eighty-nine, seventy, eighty-five, and ninety-five. Consultant four scores eighty-two, eighty-seven, ninety-four, and eighty. The firm wants each consultant on exactly one project, and each project staffed by exactly one consultant. The goal is to maximise total skill fit across all four matches. Because higher is better, this is a maximisation problem. The constraints do not change at all. Only the direction of the objective does.
Steps 1 and 2
Decision Variables and Objective
Step one. Define the decision variables. Let the variable for consultant i and project j equal one if that consultant takes that project. And zero otherwise. With four consultants and four projects, that is sixteen binary variables, one per cell. Step two. Write the objective function. Maximise Z as the sum of every score multiplied by its own variable. Consultant one contributes eighty-five, ninety-two, seventy-eight and eighty-eight. Consultant two contributes seventy-six, eighty-one, ninety and seventy-three. Consultant three contributes eighty-nine, seventy, eighty-five and ninety-five. Consultant four contributes eighty-two, eighty-seven, ninety-four and eighty. Each line is simply that consultant's row of the score matrix. Only four of those sixteen terms will survive, because the other twelve variables are zero.
Step 3
The Eight Equality Constraints
Step three. The constraints: eight equalities, in two families of four. The first family gives one equation per consultant. Consultant one's four variables must sum to one. The same holds for consultants two, three and four. The second family gives one equation per project. The four variables that could staff project A must sum to one. The same holds for projects B, C and D. Finally, every variable is binary. Zero or one, nothing else. Now, why do you need both families? Row sums alone would let two consultants pile onto the same project. Column sums alone would let one consultant take two projects at once. Together, they force a perfect one to one matching.
Step 4
The Optimal Assignment
Step four. Solve it. Whether you run the LP or the Hungarian algorithm, you get one unique best matching. Consultant one goes to project B, scoring ninety-two. Consultant two goes to project C, scoring ninety. Consultant three goes to project D, scoring ninety-five. Consultant four goes to project A, scoring eighty-two. The total skill fit is three hundred and fifty-nine, and every other variable is zero. Now, an important correction. The chapter's own answer table reports three hundred and fifty-seven. It pairs consultant two with project A, and consultant four with project C. That matching is two points short of the best one available. Enumerating all twenty-four possible matchings confirms that three hundred and fifty-nine is the true maximum. It is worth running that check yourself. Assignment answers are easy to eyeball, and easy to get wrong.
Why Greedy Fails
The Bigger Cell Can Lose the Bigger Total
That slip is not an accident. It is exactly the trap this chapter warns about. Look at project C. Consultant two rates it ninety, her own highest score. Consultant four rates it ninety-four, his own highest score. Only one of them can have it. The tempting move is to grab the biggest number, and give project C to consultant four. That wins ninety-four, but pushes consultant two down to project A at seventy-six, for a pair worth a hundred and seventy. The other way round, consultant two takes C for ninety and consultant four takes A for eighty-two. That pair is worth a hundred and seventy-two, which is better. The smaller single cell wins the bigger total, by two points. That is the whole lesson of the assignment problem. If you ignored the one-consultant-per-project rule, everyone would take their own favourite. That totals three hundred and seventy-one, but it is infeasible, because two consultants both want C.
Summary
What to Carry Forward
Let us gather the ideas worth keeping. The assignment problem matches agents to tasks one to one, to optimise a total cost or score. It is a special case of the transportation problem, with every supply and demand equal to one. The cost matrix is a square table whose entries rate each agent on each task. The decision variables are binary indicators of who does what. Two families of equality constraints, one per row and one per column, force the perfect matching. The constraint matrix is totally unimodular, so the relaxed LP returns zeros and ones by itself. No integer programming machinery is required at all. The Hungarian algorithm solves the problem in order n cubed, far faster than general simplex at scale. And greedy, pick-your-favourite matching is generally sub-optimal. The globally best combination is rarely the sum of the individually best choices. That gap, small as it looked here, is the entire reason this model exists.
About Quantitative Analysis at UPI Study
Quantitative Analysis (Math 250) is a self-paced online course of 55 video lessons in 13 chapters, from decision analysis and simulation to inventory and queuing models, project scheduling, linear programming and transportation models. It carries a NCCRS credit recommendation for 3 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus All Math courses Every course with PRO →
Compare: Statistics vs Quantitative Analysis
Why take it here
Why students take Quantitative Analysis with UPI Study
Where the credit goes
Universities that work with NCCRS
Quantitative Analysis carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About The Assignment Problem
What is the assignment problem in operations research?
How do you formulate an assignment problem as a linear program?
Why does the assignment problem give integer solutions without integer programming?
Why does picking the best match for each person fail in assignment problems?
About the Quantitative Analysis course
How many college credits is Quantitative Analysis?
How much does Quantitative Analysis cost and what is included?
Which universities accept UPI Study credits?
How long does Quantitative Analysis take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 3 credits in Quantitative Analysis.
55 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
3 credits · NCCRSEnroll →