The task is to use VAM to allocate contractors to tasks. It scales to large problems, so ideally keep sorts out of the iterative cycle. It works as follows:

**Step 1:** Balance the given transportation problem if either (total supply $\gt$ total demand) or (total
supply $\lt$ total demand)

**Step 2:** Determine the penalty cost for each row and column by subtracting the lowest cell cost in the
row or column from the next lowest cell cost in the same row or column.

**Step 3:** Select the row or column with the highest penalty cost (breaking ties arbitrarily or choosing
the lowest-cost cell).

**Step 4:** Allocate as much as possible to the feasible cell with the lowest transportation cost in the row
or column with the highest penalty cost.

**Step 5:** Repeat steps 2, 3 and 4 until all requirements have been meet.

**Step 6:** Compute total transportation cost for the feasible allocations.

For this task assume that the model is balanced.

For each task and contractor (row and column above) calculating the difference between the smallest two values produces:

Determine the largest difference (D or E above). In the case of ties I shall choose the one with the lowest price (in this case E because the lowest price for D is Z=15, whereas for E it is Z=11). For your choice determine the minimum cost (chosen E above so Z=11 is chosen now). Allocate as much as possible from Z to E (50 in this case limited by Z's supply). Adjust the supply and demand accordingly. If demand or supply becomes 0 for a given task or contractor it plays no further part. In this case Z is out of it. If you choose arbitrarily, and chose D Repeat until all supply and demand is met:

Finally calculate the cost of your solution. In the example given it is $£ 3100$:

The optimal solution determined by GLPK is $£ 3100$: