Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An assignment problem is not infeasible just because there are more workers than tasks—or more tasks than workers. First decide which side must be fully assigned, then check whether the allowed worker–task pairings can satisfy that requirement. Use dummy assignments only to represent a real outcome such as an idle worker or uncovered task, and give that outcome an appropriate cost.

First decide what “assigned” means

Write down the coverage rule before changing the cost matrix. Does every worker need a task? Must every task be covered? Must both sides be fully matched? Or is any maximum-size partial matching acceptable? These are different models, and the right treatment of an unbalanced problem depends on which rule applies.

In a rectangular one-to-one assignment, the larger side can have unmatched members. For example, a model with five workers and four tasks can assign each task to a different worker while leaving one worker unassigned. Google’s OR-Tools example demonstrates this directly, without requiring a square matrix: Solving an Assignment Problem.

SciPy’s linear_sum_assignment also supports rectangular cost matrices; its documentation says the larger side need not be fully assigned: SciPy linear_sum_assignment. That behavior may be sufficient when leaving some entities unmatched is allowed. If your policy requires full coverage on both sides, unequal set sizes instead require an explicit policy for the surplus entities.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to diagnose an infeasible assignment

  1. State the coverage requirement. Specify whether workers, tasks, both sides, or neither side must be fully matched.
  2. Check the dimensions and sides. Confirm that rows and columns represent the intended workers and tasks, and establish whether unmatched members of the larger side are permitted.
  3. Mark incompatible pairs as unavailable. A worker who cannot perform a task should not be offered that pairing as an ordinary assignment choice.
  4. Check whether enough distinct allowed pairs remain. Count only valid pairings that can satisfy the required matching size; do not assume that a matrix with enough rows and columns guarantees a feasible match.
  5. Look for bottlenecks. Inspect groups of workers that can reach too few distinct tasks, and check the symmetric case for groups of tasks with too few compatible workers.
  6. Choose a valid remedy. Depending on the real policy, allow unmatched entities, enable additional pairings, add meaningful dummy choices, relax a requirement, or use a model that supports the full set of constraints.

For example, three workers who can collectively perform only two distinct tasks cannot all be assigned at once, even if the overall problem contains additional tasks that none of those workers can do. Balancing the matrix dimensions does not fix this compatibility bottleneck.

When to use dummy assignments

Dummy rows or columns can make a rectangular matrix square, but they are not merely a mathematical patch: each dummy match represents an outcome. A worker matched to a dummy task might mean idle capacity; a task matched to a dummy worker might mean an uncovered task. Set the dummy cost to reflect the consequence of that outcome. A zero cost is appropriate only when leaving the worker idle or the task uncovered is genuinely costless under the model.

  1. Identify which side has surplus entities and how the unmatched outcome should be represented.
  2. Add enough dummy rows or columns to balance the dimensions if your chosen formulation requires a square matrix.
  3. Assign each dummy match a cost that represents its actual penalty or consequence.
  4. Confirm that dummy choices are allowed only where the intended policy permits an entity to remain unmatched.

Dummy choices address a size mismatch; they do not make forbidden real pairings possible. If the required number of real matches cannot be made from the allowed worker–task pairs, adding dummy rows or columns alone does not resolve that structural incompatibility.

How to represent forbidden worker–task pairs

Exclude an incompatible pair from the available choices when the solver supports it. OR-Tools’ linear assignment documentation demonstrates omitting incompatible assignments; it also shows that enough restrictions can leave no possible assignment: OR-Tools Linear Sum Assignment Solver.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A large finite penalty is not the same as forbidding a pair: if all other choices are more costly or unavailable, a solver may still select it. Prefer explicit exclusion where supported. If your formulation requires a numeric penalty instead, verify that its magnitude is safe for the cost bounds and numerical behavior of the solver; do not treat an arbitrary “big M” as a universal substitute for an unavailable edge.

Choose a solver that fits the model

Problem structure Suitable approach What to check
Simple one-to-one cost minimization A specialized linear assignment solver Its rectangular and unmatched-entity semantics must match your coverage rule.
Additional logical or other non-assignment constraints A more general MIP or CP-SAT model Represent the extra rules explicitly rather than disguising them as ordinary costs.
Full matching required on the smaller side of a bipartite graph A full-matching routine, such as SciPy’s sparse routine Confirm that a matching of the required cardinality exists among allowed edges.

Google describes its linear sum assignment solver as specialized for the simple assignment problem and notes that MIP and CP-SAT handle a wider range of problems: OR-Tools Linear Sum Assignment Solver. Use a general solver when the model includes dependencies or rules beyond one-to-one assignment, rather than trying to encode those rules as cost values.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Understand what “full matching” means in SciPy

SciPy’s sparse min_weight_full_bipartite_matching routine requires a full matching of cardinality equal to the smaller partition and raises an error if no such matching exists: SciPy min_weight_full_bipartite_matching. Here, “full” does not mean every vertex on both sides is matched when the partitions differ in size; it means that the matching covers the smaller side.

Check the documentation for the SciPy version deployed in your application and confirm the function’s matching semantics before treating “full” as equivalent to a perfect matching. For SciPy’s rectangular linear_sum_assignment, the larger side may remain partly unmatched, as described in its version 1.0.0 documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
ISE Introduction to Operations Research
  • ISBN 9781260575873 is international edition of Introduction to Operations Research 11th edition. No access code included.

When the Hungarian algorithm is relevant

For a basic assignment problem, the Hungarian algorithm is one recognized approach. Google’s OR-Tools reference identifies it as the Kuhn–Munkres algorithm and documents an O(n4) complexity bound for that implementation. The reference advises using its graph linear assignment implementation, whose complexity is usually smaller: OR-Tools Linear Sum Assignment Solver. That bound is specific to the cited implementation; it is not a universal complexity claim for every assignment solver, nor a measured runtime guarantee.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.