Job Scheduling Using Assignment Model

Last updated: β€’ Sources β€’ Methodology

Job Scheduling Using Assignment Model: Solved Examples

Many β€œjob scheduling” decisions are exactly assignment problems: assign each worker (or machine) to exactly one job (or shift/task), and each job to exactly one worker, to minimize total time/cost or minimize penalties (preference violations). In this one-to-one case, you can solve the schedule using the Hungarian algorithm.

For more solved matrices, see assignment problem examples. For code verification, see Hungarian algorithm in Python.

Scope boundary: if workers can do multiple jobs, jobs have time windows/precedence, or you need coverage constraints (k workers per shift), then the problem is no longer a pure assignment and typically requires ILP/MILP.
On this page

Quick takeaway: If the schedule is one-to-one, use assignment + Hungarian. If it involves sequences, coverage constraints, or multi-period decisions, use ILP/MILP.

Scheduling as an assignment model

Let x(i,j)=1 if worker i is scheduled to job/shift j. With cost/time/penalty c(i,j):

minimize   Ξ£_i Ξ£_j c(i,j) x(i,j)
subject to Ξ£_j x(i,j) = 1   for each worker i
           Ξ£_i x(i,j) = 1   for each job/shift j
           x(i,j) ∈ {0,1}

If workers β‰  jobs, you balance with dummy rows/columns: unbalanced assignment problem.

Worked examples (solved, Hungarian steps)

Worked example
Example 1 (4Γ—4): technician-job schedule (requires cover/adjust)

Goal: minimize total time (minutes).

      J1  J2  J3  J4
T1    12   7  11   8
T2     9  10   6   9
T3     8   9  12   7
T4    11   6   8  10

Step 1 β€” Row reduction

Row minima: T1=7, T2=6, T3=7, T4=6. Subtract:

      J1  J2  J3  J4
T1     5   0   4   1
T2     3   4   0   3
T3     1   2   5   0
T4     5   0   2   4

Step 2 β€” Column reduction

Column minima: J1=1, J2=0, J3=0, J4=0. Subtract:

      J1  J2  J3  J4
T1     4   0   4   1
T2     2   4   0   3
T3     0   2   5   0
T4     4   0   2   4

Step 3 β€” Independent zeros attempt

Zeros appear at (T1,J2), (T2,J3), (T3,J1), (T3,J4), (T4,J2). Column J2 is contested (T1 and T4 both depend on it), so we apply cover/adjust.

Step 4 β€” Cover all zeros with minimum lines

One minimum cover:

  • Cover column J2
  • Cover column J3
  • Cover row T3

That’s 3 lines < 4 β†’ adjust.

Step 5 β€” Adjustment

Uncovered cells are in rows T1,T2,T4 and columns J1,J4. Values: 4,1,2,3,4,4 β†’ smallest uncovered is k=1.

Subtract k from uncovered cells; add k to intersections of two lines; others unchanged. Updated matrix:

      J1  J2  J3  J4
T1     3   0   4   0
T2     1   4   0   2
T3     0   3   6   0
T4     3   0   2   3

Step 6 β€” Select independent zeros

Pick one zero per row and column:

  • T3 β†’ J1
  • T2 β†’ J3
  • T4 β†’ J2
  • T1 β†’ J4

Final schedule (original times)

  • T1 β†’ J4 = 8
  • T2 β†’ J3 = 6
  • T3 β†’ J1 = 8
  • T4 β†’ J2 = 6

Minimum total time = 28.

For a deep explanation of why the cover/adjust step preserves optimality, see the dual/potentials discussion in Hungarian algorithm explained.
Worked example
Example 2 (4Γ—4): shift assignment with penalties (full steps)

Here c(i,j) is a penalty score (lower is better). Assign each nurse to one shift.

         S1  S2  S3  S4
N1        2   6   3   7
N2        4   2   5   6
N3        6   4   2   4
N4        5   7   6   2

Step 1 β€” Row reduction

Row minima are 2 for every row. Subtract 2 from each row:

         S1  S2  S3  S4
N1        0   4   1   5
N2        2   0   3   4
N3        4   2   0   2
N4        3   5   4   0

Step 2 β€” Column reduction

Each column already has a 0 minimum, so no changes.

Step 3 β€” Select independent zeros

There is a clean one-to-one set of zeros (diagonal):

  • N1 β†’ S1
  • N2 β†’ S2
  • N3 β†’ S3
  • N4 β†’ S4

Final schedule (original penalties)

  • N1 β†’ S1 penalty 2
  • N2 β†’ S2 penalty 2
  • N3 β†’ S3 penalty 2
  • N4 β†’ S4 penalty 2

Minimum total penalty = 8.

In penalty-based scheduling, the key modeling work is constructing penalty values that reflect real tradeoffs (preferences, fatigue, skill mismatch).
Worked example
Example 3 (unbalanced): 4 employees, 3 shifts + OFF dummy (full steps)

You have 4 employees but only 3 shifts (S1–S3). One employee must be OFF (idle). Add a dummy shift OFF so the matrix becomes 4Γ—4.

Penalty matrix (OFF penalty = 0 means idling is acceptable):

         S1  S2  S3  OFF
E1        1   9   7    0
E2        6   4   3    0
E3        5   8   1    0
E4        7   6   9    0

Step 1 β€” Row reduction

Each row has a minimum of 0 (because OFF=0), so row reduction makes no change.

Step 2 β€” Column reduction

Column minima are: S1=1, S2=4, S3=1, OFF=0. Subtract them:

         S1  S2  S3  OFF
E1        0   5   6    0
E2        5   0   2    0
E3        4   4   0    0
E4        6   2   8    0

Step 3 β€” Select independent zeros

We must use OFF exactly once (one employee off). A conflict-free zero selection is:

  • E1 β†’ S1 (0)
  • E2 β†’ S2 (0)
  • E3 β†’ S3 (0)
  • E4 β†’ OFF (0)

Final schedule (original penalties)

  • E1 β†’ S1 penalty 1
  • E2 β†’ S2 penalty 4
  • E3 β†’ S3 penalty 1
  • E4 β†’ OFF penalty 0

Minimum total penalty = 6.

If you want to discourage OFF assignments, set OFF penalty to a positive value (e.g., overtime replacement cost) and re-solve. See unbalanced assignment problem.

When scheduling is not assignment

Scheduling stops being a pure assignment problem when decisions are not one-to-one or when cost depends on time/sequence/interactions:

  • Multiple jobs per worker (within the horizon)
  • Time windows and precedence constraints
  • Coverage constraints (k workers per shift, skill mix)
  • Interaction costs between pairs of assignments (layout/flow style) β†’ QAP

For broader modeling: how to model ILP, ILP beginner’s guide, ILP vs MILP.

Questions people ask

Questions people ask
When is job scheduling exactly an assignment problem?

Job scheduling is exactly an assignment problem when the rules are one-to-one in the chosen planning horizon: every worker must be assigned to exactly one job/shift, and every job/shift must be covered by exactly one worker. Under those assumptions, the schedule is literally a perfect matching between workers and jobs.

The Hungarian algorithm is efficient because it exploits that strict structure. If your scheduling decisions violate any one-to-one rule (e.g., a worker does multiple jobs, or a job requires multiple workers), then you need a different model class.

Questions people ask
How should I choose dummy penalties for OFF / idle / unfilled jobs?

Dummy penalties encode the tradeoff you are willing to make. A dummy cost of 0 means β€œidle/unfilled is free,” which is rarely true in operations unless you truly have excess capacity or the work is optional. If leaving a shift unfilled is expensive (service-level impact), dummy penalties should reflect that.

In many applications, dummy penalty is a composite: overtime replacement cost + service penalty + fairness penalty. The goal is not just mathematical feasibility; it’s to preserve the real meaning of the schedule.

Questions people ask
Should I use Hungarian or ILP/MILP for scheduling?

Use Hungarian when the problem is one-to-one and costs depend only on the pair (worker, job). It is fast, stable, and interpretable.

Use ILP/MILP when you add realistic constraints: coverage, max nights per week, rest-time constraints, fairness as hard limits, multi-period planning, time windows, precedence, or any coupling between assignments. Start with how to model ILP.

What to do next

  1. Full algorithm lecture: Hungarian algorithm explained.
  2. More solved matrices: assignment examples.
  3. Verify in code: Hungarian in Python.
  4. Generalize beyond assignment: ILP/MILP.

Disclaimer

This guide is for educational and informational purposes. Real scheduling problems often include constraints and time structure not captured by one-to-one assignment (coverage rules, multi-period planning, legal constraints, precedence, time windows, travel time). Penalty modeling requires careful calibration to match real tradeoffs. Always validate assumptions and results for your use case. Read the full disclaimer.

Related guides

Sources
  1. Kuhn (1955) β€” The Hungarian method for the assignment problem
  2. Munkres (1957) β€” Algorithms for the Assignment and Transportation Problems (SIAM)
  3. Burkard, Dell’Amico, Martello β€” Assignment Problems (SIAM book page)
  4. Wikipedia β€” Assignment problem (overview)