Two-Station Job Scheduling with Setups and a Downtime Window
Dynamic ProgrammingModel answerLast updated
Assign and sequence three jobs across two parallel stations to minimize makespan, handling sequence-dependent changeovers, a precedence constraint, and a station blackout period.
Two-Station Job Scheduling with Setups and a Downtime Window
A small production facility has two workstations, W1 and W2, running in parallel. You need to schedule three jobs — A, B, and C — subject to the rules below. Your goal is to find the schedule that finishes all work as early as possible (minimum makespan).
Processing times (minutes)
| Job | W1 | W2 |
|---|---|---|
| A | 20 | 25 |
| B | 30 | 22 |
| C | 18 | 15 |
Changeover (setup) times
When a station switches from one job to the next, it needs a changeover. The first job on a station has no changeover. Times are the same on either station:
| From → To | A | B | C |
|---|---|---|---|
| A | — | 5 | 3 |
| B | 4 | — | 6 |
| C | 2 | 1 | — |
Constraints
- Precedence. Job B cannot begin processing until Job A has fully finished.
- Planned downtime. W1 is unavailable from t = 60 to t = 70 (exclusive). A job (including its changeover) may not start on W1 if doing so would overlap this window — it must wait until t = 70.
- Non-preemptive. Once a job starts on a station (after any changeover), it runs to completion without interruption.
Tasks
(a) Complexity. Argue informally why this class of problem is NP-hard. Identify the simpler well-known problems that reduce to it.
(b) Optimal schedule. Find the assignment of jobs to stations and their start/finish times that minimizes makespan. Show your reasoning — enumerate the candidates, apply the lower bound, and confirm the best schedule. You may use branch-and-bound or bitmask DP.
(c) General solver. For n jobs and m stations, describe a practical approach: either a mixed-integer program with disjunctive constraints, a constraint-programming model, or a construction heuristic with local search. Discuss complexity, how you would tighten the formulation or prune the search, and what quality guarantees (if any) exist.
Hints
Hint 1
Start with a lower bound. Job A must finish before Job B can start, so the earliest B can complete is (A's minimum processing time) + (B's minimum processing time). That number bounds the makespan from below — use it to prune candidates.
Hint 2
The downtime window on W1 falls in [60, 70). Check whether any candidate schedule actually reaches that range. If W1 goes idle after t = 20 in your best assignment, the blackout never comes into play and you can ignore it for that candidate.
Hint 3
For the general case, think about what makes this problem hard in even the simplest subcase: one station, no precedence, no downtime. Minimizing total changeover time along a fixed sequence of n jobs is equivalent to finding a minimum-cost Hamiltonian path — which is exactly the Asymmetric TSP.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
(a) NP-Hardness
The argument works by restriction: show that a well-known NP-hard problem is a special case.
Single station, no precedence, no downtime. Total processing time is fixed regardless of sequence. The only thing the schedule controls is the total changeover cost. Minimizing that cost means choosing the permutation of jobs that minimizes the sum of consecutive setup times — a minimum-cost Hamiltonian path through an asymmetric distance matrix. That is the Asymmetric Travelling Salesman Problem (ATSP), which is strongly NP-hard. This special case lives strictly inside our problem, so our problem is at least as hard.
Two stations, no setups, no precedence, no downtime (P2 || C_max). Deciding whether all jobs can finish by a given deadline is equivalent to PARTITION: can the job lengths be split into two groups with equal sums? PARTITION is NP-complete, so even the stripped-down two-station makespan problem is NP-hard.
Upshot. Our full model combines both hard cores — ATSP-style changeover sequencing and partition-style load balancing — plus precedence and downtime. The general problem is strongly NP-hard, which motivates exact search for small n and MIP/metaheuristics for large n.
(b) Optimal Schedule
Lower bound
The precedence constraint chains A into B. Whatever station each lands on:
- A finishes no earlier than min(20, 25) = 20.
- B then needs at least min(30, 22) = 22 more minutes.
- So C_max ≥ 20 + 22 = 42.
This bound is achievable only if A runs on W1 (finishes at 20) and B runs on W2 (takes 22 minutes starting at 20, finishing at 42), with zero changeover between them because they are on different stations.
Evaluating the candidate that hits 42
Place C on W2 before B. C starts at 0, finishes at 15. The changeover C→B = 1 minute fits entirely in [15, 20] while we wait for A to release B. B starts at 20 on W2, finishes at 42.
| Station | Job | Changeover | Start | Finish |
|---|---|---|---|---|
| W1 | A | — | 0 | 20 |
| W2 | C | — | 0 | 15 |
| W2 | B | C→B = 1 | 20 | 42 |
Makespan = 42. W1 goes idle at t = 20, so the [60, 70) blackout is irrelevant here.
Ruling out alternatives
- A on W1, B on W1 (same station): A finishes at 20, setup A→B = 5, B starts at 25, finishes at 55. Worse.
- A on W2 (25 min): B cannot start before 25. Even on W2 with no changeover, B finishes at 25 + 22 = 47. Worse.
- C on W1 after A: A ends at 20, setup A→C = 3, C runs [23, 41]. W1 idle after 41, blackout not hit. B on W2 starts at 20, finishes at 42. Same makespan — an alternative optimal schedule.
The lower bound argument proves 42 is optimal; no schedule can do better.
(c) General Solver for n Jobs, m Stations
Exact: Disjunctive MIP
Introduce:
- Binary x_{j,k}: job j is assigned to station k.
- Binary y_{i,j}: job i is sequenced before job j on their shared station.
- Continuous S_j: start of processing for job j.
- Continuous C_max: makespan.
Key constraint groups:
- Assignment: each job goes to exactly one station.
- Disjunctive ordering (for each pair i ≠ j, each station k, using big-M):
- If both assigned to k and i before j:
S_j ≥ S_i + p_{i,k} + s_{i,j}.
- If both assigned to k and i before j:
- Precedence (a → b):
S_b ≥ S_a + Σ_k p_{a,k} · x_{a,k}. - Downtime [lo, hi) on station k: add a binary per job for "scheduled before the window." Push the start past
hiif processing would overlap. - Makespan:
C_max ≥ S_j + Σ_k p_{j,k} · x_{j,k}for all j.
Big-M values should be tightened per pair (use the sum of all processing and setup times as the horizon). For practical instances up to ~30 jobs, CP-SAT (Google OR-Tools) typically outperforms MIP here because it handles interval variables, transition-time matrices, and non-availability constraints natively without big-M weaknesses.
Heuristic for large n: NEH + Tabu Search
Construction (NEH-style):
- Sort jobs by decreasing
min_k p_{j,k}, respecting a topological order from precedence. - Greedily insert each job at the (station, position) that gives the lowest partial makespan. Cost: O(n² · m).
Improvement (Tabu Search):
- Neighborhoods: relocate one job to a different station or position; swap two jobs on the same or different stations.
- Reject any move that violates a precedence constraint.
- Recompute station timelines incrementally from the affected position — O(n) per move.
- Tabu tenure of roughly 7–15 steps; aspiration criterion: accept a tabu move if it improves the global best.
- Simulated annealing is a reasonable alternative with easier parameter tuning.
Quality bounds. There is no polynomial-time constant-factor approximation for the general problem (unless P = NP), but two lower bounds give a quality certificate at any point:
- The longest precedence-weighted path using
min_k p_{j,k}. (Σ_j min_k p_{j,k}) / m— the ideal load balance ignoring setups.
The gap between the heuristic solution and max(these bounds) tells you how far from optimal you might be.
Common mistakes to avoid
- Forgetting the first-job rule. The first job on a station has no changeover. Forgetting this inflates computed makespans and leads to wrong pruning.
- Treating the downtime as a hard shift. You only need to delay a job if its [start, finish) window actually overlaps [lo, hi). If a job finishes before
loor starts afterhi, no adjustment is needed. - Ignoring anticipatory setups. A changeover on W2 can run while a job is still finishing on W1. This often lets you absorb the setup into the wait time imposed by a precedence constraint, at zero extra cost — as seen in the example above.
- Using a loose big-M. Setting M = 10⁶ when the horizon is 200 produces a weak LP relaxation and slow MIP solve. Always bound M tightly per variable pair.