D2 2.2 - Allocation as a linear program
You will formulate one-to-one allocation problems using binary variables, complete worker and task constraints, and objectives that respect dummy and forbidden assignments.
A variable answers yes or no
Three workers and three tasks produce nine decision variables. Why does a complete allocation have only three of them equal to one?
Each variable answers a separate yes-or-no question: does this worker do this task? The constraints will make those answers fit together into one complete allocation.
You already know
The Hungarian lesson assigns one worker to each task, uses independent choices, and interprets dummy assignments in context. A feasible allocation must respect every pairing restriction. Formulating a model does not require solving it.
A linear program minimises or maximises a linear objective subject to linear constraints and specified variable domains. Here the objective adds costs or profits, and the domains make each pairing a yes-or-no decision.
In this lesson, workers A, B, C and tasks P, Q, R form a square problem in which every worker does exactly one task and every task is done by exactly one worker.
Binary allocation variable
Define
where and .
Thus . It is an indicator of a whole assignment, not an amount of work or a number of hours.
For example, assigns A to Q. It forces the other two variables in A's row to zero and the other two in Q's column to zero, once the one-per-row and one-per-column constraints are imposed.
[DIAGRAM: asset_name: Binary variables describing a complete allocation; asset_slug: 9fm0-d2-184-binary-allocation; caption: AQ, BR and CP are selected; every worker and task has total1.; description: A three-by-three binary table with ones only at AQ,BR,CP and zeros elsewhere, displaying row and column totals1 to connect whole allocation decisions to their linear constraints.]

There are only six complete allocations of three workers to three tasks: A has three choices, B then has two, and C has one. With five workers and five tasks, the count is already . The variables describe all candidate pairs; a feasible solution selects just one compatible set.
Key idea
Allocation variables are binary. “Exactly one task for each worker” means each row sums to ; “exactly one worker for each task” means each column sums to .
Row and column totals alone do not make every feasible numerical table a whole allocation.
Write the objective and every assignment equation
A selected route contributes its original cost once, so multiply each cost by the corresponding binary variable. The constraints contain coefficient , because each selected assignment counts as one worker–task pairing.
A complete square allocation model
For workers and tasks, with original costs ,
For original profits , maximise with the same assignment constraints.
Not in the formula booklet: learn it.
Use the complete row and column equations in a square exact-allocation formulation. Do not stop after writing just one set. A correct objective cannot repair a model that allows two workers to do the same task.
Worked example 1: a minimum-cost allocation model
Question. Each of three workers must do one of three tasks, and each task must be done once. Costs in pounds are
Formulate a linear programming model. Do not solve it.
Plan. Define binary assignment indicators, minimise the original cost, and write all three worker and all three task equations.
Let if worker is assigned task , and otherwise, where , .
Why does task P use a column equation? Its worker can be A, B or C, but exactly one of those three decisions must equal .
Answer. The stated binary domains, cost minimisation and six assignment equations form the required model.
Check. Set , with all other variables zero. All six equations hold and . This is a check of the model, rather than a requested solution method.
Worked example 2 changes only the original AQ cost, from to pounds. The workers and tasks are unchanged.
Worked example 2: changing one cost leaves feasibility unchanged
Question. Formulate the revised minimum-cost allocation problem.
Plan. Keep the binary definitions and every assignment equation. Change just the AQ coefficient.
For the same definitions , , , write
Why do the constraints not change? A higher price does not make a previously possible worker–task pairing impossible. It changes the objective value when that pairing is selected.
Answer. Minimise the revised cost over exactly the same binary feasible set.
Check. The earlier assignment still has ones at AQ, BR, CP. Its cost is now , exactly more because AQ is selected once. An allocation not using AQ would have no cost change.
Original costs with minimisation, or original profits with maximisation, make the interpretation easiest. A correctly transformed Hungarian cost objective is equivalent, but its coefficients must be paired with minimisation rather than maximisation.
Watch out
Wrong: define as a number of hours, allow arbitrary fractions, or write only the three worker equations. Right: define a binary yes-or-no assignment and include both the worker and task equations.
Change the same original cost once more.
Continue this lesson.
You’re previewing NovaLearn without an account. Create a free account to read the rest.
Create free account