You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🧩 Constraint Solving POTD:Problem of the Day: Job-Shop Scheduling
#74835
You have jobs and machines. Each job is a fixed sequence of operations, and each operation must run on a specific machine for a fixed duration. A machine processes at most one operation at a time, and the operations of a job must run in order. Find start times that minimize the makespan, the finish time of the last operation.
Small instance (3 jobs, 3 machines, written as (machine, duration)):
Job
Operations in order
J1
(M1, 3) → (M2, 2) → (M3, 2)
J2
(M1, 2) → (M3, 1) → (M2, 4)
J3
(M2, 4) → (M3, 3)
Input: number of jobs n, machines m, and operation lists with durations. Output: a start time s_{j,k} for each operation that satisfies all constraints and minimizes C_max.
This instance has optimal makespan 11, which I confirmed by exhaustive enumeration of all semi-active schedules. One optimal schedule:
Factory floors and semiconductor fabs: routing lots through machines with fixed process orders.
Cloud and HPC: placing dependent tasks on limited hardware while keeping throughput high.
Surgery and clinic planning: each patient follows a fixed pathway through shared rooms and staff.
Modeling Approaches
1. Constraint Programming with interval variables
Variables: start s_o ∈ [0, H] for each operation o, with fixed duration d_o.
Precedence:s_{j,k+1} ≥ s_{j,k} + d_{j,k} within each job.
Machine capacity: a global NoOverlap over the intervals on each machine.
Objective: minimize C = max_j (s_{j,last} + d_{j,last}).
Trade-off: this is the most natural model. It gives strong propagation through NoOverlap, but bounds from the objective are weaker than LP bounds.
Example Model (Pseudo-code)
for each job j, operation k:
s[j,k] in 0..H
for each job j, k = 0..len(j)-2:
s[j,k+1] >= s[j,k] + d[j,k] # job precedence
for each machine m:
NoOverlap({ interval(s[j,k], d[j,k]) : (j,k) on m })
C >= s[j,last_j] + d[j,last_j] for all j
minimize C
This snippet is pseudo-code only. I did not run it through a solver.
2. Mixed-Integer Programming with big-M disjunctions
Variables: continuous s_o ≥ 0, plus binary y_{o,p} set to 1 when o precedes p on the same machine.
Disjunction: for each pair (o,p) on one machine, s_o + d_o ≤ s_p + M(1 − y_{o,p}) and s_p + d_p ≤ s_o + M·y_{o,p}.
Precedence and objective: the same as the CP model.
Trade-off: the formulation is compact and easy to write in any MIP solver. The big-M relaxation is weak, so proving optimality takes a lot of branching.
Key Techniques
Disjunctive propagation (edge-finding): for a machine, if a set of operations cannot fit before a deadline without one of them finishing last, the solver can tighten start-time bounds. This is where most of CP's power on scheduling comes from.
Failure-directed search: instead of fixed variable ordering, branch on the variables involved in recent failures (Vilím, Laborie & Shaw, 2015). This tends to beat static heuristics on hard scheduling instances.
One-machine relaxation bound: for each machine, compute heads (earliest start) and tails (min. work after) and solve the preemptive relaxation with Jackson's rule. Here it gives a bound of 10 on M2, while the true optimum is 11, so search must close the remaining gap.
Challenge Corner
Why 10 isn't enough: the one-machine bound on M2 is 10, yet the optimum is 11. Can you find a stronger argument that rules out makespan 10?
Setup times: if switching from job i to job j on a machine costs t_{ij}, how does this change the NoOverlap model? (Hint: check how CP Optimizer's noOverlap supports transition distances.)
Fewer variables: can you model the same problem using only the machine sequence, as a permutation with repetition, and still get propagation?
References
Rossi, van Beek & Walsh (eds.), Handbook of Constraint Programming, Elsevier, 2006. Scheduling chapters cover interval variables and NoOverlap.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Problem Statement
You have jobs and machines. Each job is a fixed sequence of operations, and each operation must run on a specific machine for a fixed duration. A machine processes at most one operation at a time, and the operations of a job must run in order. Find start times that minimize the makespan, the finish time of the last operation.
Small instance (3 jobs, 3 machines, written as
(machine, duration)):Input: number of jobs
n, machinesm, and operation lists with durations.Output: a start time
s_{j,k}for each operation that satisfies all constraints and minimizesC_max.This instance has optimal makespan 11, which I confirmed by exhaustive enumeration of all semi-active schedules. One optimal schedule:
Why It Matters
Modeling Approaches
1. Constraint Programming with interval variables
s_o ∈ [0, H]for each operationo, with fixed durationd_o.s_{j,k+1} ≥ s_{j,k} + d_{j,k}within each job.NoOverlapover the intervals on each machine.C = max_j (s_{j,last} + d_{j,last}).Trade-off: this is the most natural model. It gives strong propagation through
NoOverlap, but bounds from the objective are weaker than LP bounds.Example Model (Pseudo-code)
This snippet is pseudo-code only. I did not run it through a solver.
2. Mixed-Integer Programming with big-M disjunctions
s_o ≥ 0, plus binaryy_{o,p}set to 1 whenoprecedespon the same machine.(o,p)on one machine,s_o + d_o ≤ s_p + M(1 − y_{o,p})ands_p + d_p ≤ s_o + M·y_{o,p}.Trade-off: the formulation is compact and easy to write in any MIP solver. The big-M relaxation is weak, so proving optimality takes a lot of branching.
Key Techniques
Challenge Corner
ito jobjon a machine costst_{ij}, how does this change theNoOverlapmodel? (Hint: check how CP Optimizer'snoOverlapsupports transition distances.)References
NoOverlap.All reactions